Eric Anholt
ebefeb2bdd
Attach a pointer to variable names in LIR dumping.
...
Since variable names are not unique, and we like to make lots of
__retvals and assignment_tmps and a,b,c,d this helps in debugging.
2010-06-24 13:32:35 -07:00
Eric Anholt
4b6fd39c89
Add a virtual clone() method to ir_instruction.
...
This will be used by function inlining, the linker, and avoiding double
usage of the LHS deref chains in ++, *=, and similar operations.
2010-06-23 15:20:29 -07:00
Eric Anholt
e46a454305
ir: Give ir_instruction a print visitor helper.
...
This avoids spamming each file with includes of ir_print_visitor.h
because someone was doing debugging at some point, and is less typing
when doing debugging.
2010-06-22 18:18:30 -07:00
Eric Anholt
ac95f2f8c8
Include stdio.h and stdlib.h everywhere, and don't cook our own #define NULL.
2010-06-22 12:30:55 -07:00
Kenneth Graunke
be298063b5
ir_print_visitor: Add support for ir_texture.
2010-06-09 11:14:57 -07:00
Kenneth Graunke
13e1b6b725
ir_reader: Read record_refs.
...
Also changes the print visitor to not emit extraneous parenthesis.
2010-05-26 15:24:53 -07:00
Ian Romanick
36ea28646c
Refactor ir_dereference data fields to subclasses
2010-05-26 15:23:25 -07:00
Ian Romanick
c7b1046a9f
Refactor ir_dereference support for ir_visitor
...
Move the accept method for visitors from ir_dereference to the derived
classes.
2010-05-26 15:23:25 -07:00
Kenneth Graunke
b0e0da5f07
Use %p rather than %08x when printing pointers to fix compile.
2010-05-01 00:38:36 -07:00
Ian Romanick
a2c6df5566
Track and print user defined structure types
2010-04-28 18:22:54 -07:00
Ian Romanick
36d8a64a95
IR print visitor: Move logic for printing the whole program to _mesa_print_ir
2010-04-28 18:22:54 -07:00
Ian Romanick
7d82c765a8
IR print visitor: Just print the name of structures
...
Treat structure types like other non-array types. We'll have to print
the structure defintion elsewhere.
2010-04-28 18:22:54 -07:00
Kenneth Graunke
3b96996b7e
Move array of operator strings out of ir_print_visitor.cpp.
...
Also implement a reverse-lookup function for use in the IR reader.
2010-04-28 15:42:07 -07:00
Kenneth Graunke
0e385196f6
ir_print_visitor: Re-parenthesize ir_call output.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
dde9678162
ir_print_visitor: Print return type of ir_function_signatures.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
405e122a47
ir_print_visitor: Print (constant bool (1)) instead of "true"
...
It might be better to simply handle "true" in the reader, but since
booleans normally aren't printed as "true" or "false", we may as well go
for consistency.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
2bc582d265
ir_print_visitor: Remove unnecessary parens around expression operands.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
668d0a992a
ir_print_visitor: Remove unnecessary parens around array size in types.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
aecdefa8c0
ir_print_visitor: Fix unclosed parenthesis in (call...
2010-04-28 15:34:52 -07:00
Kenneth Graunke
c84f636c97
ir_print_visitor: Fix unclosed parenthesis in (assign ...
...
Also remove useless parens around subexpressions.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1168d95109
ir_print_visitor: Remove unnecessary parenthesis around variable names.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1a3a096bf5
ir_print_visitor: print the type of expressions.
...
This can be useful for debugging - it allows us to see that the inferred
type is what we think it should be. Furthermore, it will allow the IR
reader to avoid complex, operator-specific type inference.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
295bb7ff8d
ir_print_visitor: Remove unnecessary parenthesis around type names.
...
Parenthesis should only be present for compound types (i.e. arrays
or structures). For atomic types, simply print the symbol.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1f0cb24f8b
Print full type for ir_constant instead of base and component count.
...
vec4 and mat2x2 have the same base type and number of components;
printing the full type allows us to distinguish the two.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
3289886688
Remove ir_label since it is no longer used.
2010-04-21 15:37:10 -07:00
Kenneth Graunke
9fa99f3b6c
Refactor IR function representation.
...
Now, ir_function is emitted as part of the IR instructions, rather than
simply existing in the symbol table. Individual ir_function_signatures
are not emitted themselves, but only as part of ir_function.
2010-04-21 15:36:36 -07:00
Eric Anholt
fbc7c0b8f2
Make function bodies rely on the parameter variable declarations.
...
Previously, generating inlined function bodies was going to be
difficult, as there was no mapping between the body's declaration of
variables where parameter values were supposed to live and the
parameter variables that a caller would use in paramater setup.
Presumably this also have been a problem for actual codegen.
2010-04-07 17:23:23 -07:00
Eric Anholt
894ea972a4
Put function bodies under function signatures, instead of flat in the parent.
...
This will let us know the length of function bodies for the purpose of
inlining (among other uses).
2010-04-07 17:23:23 -07:00
Ian Romanick
d6313d7a01
Add some newlines when printing ir_loop instructions
2010-04-07 11:42:36 -07:00
Ian Romanick
f8e31e00b1
Add ir_loop_jump to represent 'break' and 'continue' in loops
2010-04-07 11:42:30 -07:00
Ian Romanick
fad607a9be
Add ir_loop to represent loops
...
This touches a lot of files because everything derived from ir_visitor
has to be updated. This is the primary disadvantage of the visitor pattern.
2010-04-07 11:41:50 -07:00
Eric Anholt
b94e402cff
Add some linebreaks in the ir_print_visitor of if statement bodies.
2010-04-06 12:13:02 -07:00
Eric Anholt
c2cb84e17b
Add bool/int conversion as IR operations.
...
Fixes constructor-09.glsl and CorrectParse2.frag.
2010-04-02 11:22:41 -07:00
Eric Anholt
dc58b3f8cc
Add conversion of bool to float as an IR operation to match int to float.
2010-04-02 11:22:41 -07:00
Eric Anholt
aeab105342
Remove fake ir_binop_logic_not. I think you meant ir_unop_logic_not.
2010-04-02 11:22:41 -07:00
Ian Romanick
3c6fea3048
Implement ir_if (for if-statments) and conversion from AST
...
The following tests now pass:
glslparsertest/shaders/if1.frag
glslparsertest/shaders/if2.frag
The following tests that used to pass now fail. It appears that most
of these fail because ast_nequal and ast_equal are not converted to HIR.
shaders/glsl-unused-varying.frag
shaders/glsl-fs-sqrt-branch.frag
2010-03-29 15:17:11 -07:00
Eric Anholt
01665262e5
Implement exp2() and log2(), and make ir_unop_exp and ir_unop_log be base e.
...
Making the base e functions IR operations is not a clear win. i965
doesn't support it, it doesn't look like r600 supports it, but r500
does. It should be easily supportable as a lowering pass, though.
2010-03-29 12:48:45 -07:00
Eric Anholt
44d68fd06f
Add sqrt() builtin as an IR operation.
...
Following a discussion in #dri-devel, I think this makes more sense
than implementing it as RSQ RCP CMP as Mesa did. The i965 has a
hardware sqrt that should work, and AMD is suppposed to be able to
implement it as RSQ RCP with an alternate floating point mode so that
the 0.0 case is handled like we want.
2010-03-29 12:48:45 -07:00
Eric Anholt
ddd2e83db2
Add builtin pow() function.
2010-03-29 12:48:45 -07:00
Eric Anholt
e65e12fdbc
IR print visitor: Print out something for the operator.
2010-03-26 17:51:40 -07:00
Ian Romanick
d1dfe8b994
IR print visitor: Print expressions a little better
2010-03-26 17:42:10 -07:00
Ian Romanick
5508129fd8
IR print visitor: print function calls
2010-03-26 17:30:30 -07:00
Ian Romanick
d811d47609
Add glsl_type::components to query total number of components in a type
2010-03-26 14:43:11 -07:00
Kenneth Graunke
affc1413ac
Move swizzles out of ir_dereference and into their own class.
...
Also turn generate_swizzle into a static "create" method of the new
class; we'll want to use it for the IR reader as well.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com >
2010-03-26 14:00:59 -07:00
Kenneth Graunke
fb9fb5f51d
Add new abstract ir_rvalue class; rework accordingly.
...
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com >
2010-03-26 13:58:48 -07:00
Ian Romanick
7954922473
IR print visitor: Finish printing constants
2010-03-25 18:40:48 -07:00
Ian Romanick
d14642739e
IR print visitor: Remove most of the newlines from the printed output
...
This makes it a lot easier to read... if you have a really wide display.
2010-03-25 18:40:48 -07:00
Ian Romanick
d7388f389d
IR print visitor: print expressions
...
Not quite complete. The operator is not yet printed.
2010-03-25 18:40:48 -07:00
Ian Romanick
8c70a62193
IR print visitor: print ir_dereference instructions
...
Also make a slight change to ir_variable. The ir_dereference tracks
the number of nested dereferences. If an ir_variable is visited and
the count is non-zero, just print the name of the variable.
2010-03-25 18:40:36 -07:00
Ian Romanick
6e7c278e24
IR print visitor: Less newlines when printing ir_variables
2010-03-25 18:39:59 -07:00