Commit graph

10 commits

Author SHA1 Message Date
Kenneth Graunke
32aaf89823 glsl: Rename various ir_* files to lower_* and opt_*.
This helps distinguish between lowering passes, optimization passes, and
other compiler code.
2010-11-15 16:34:20 -08:00
Ian Romanick
4e5b41c2f6 glsl2: Allow copy / constant propagation into array indices 2010-09-03 11:55:22 -07:00
Eric Anholt
2dd3ae0d4a glsl2: Teach copy propagation about "if" and "loop" instructions.
This lets us track copies across basic block boundaries.  The loop
doesn't get a filled out list of available copies into it yet, though.

glsl-fs-raytrace drops from 585 to 535 Mesa IR instructions out of the
compiler, and it appears that Yo Frankie's largest shaders decrease in
Mesa IR count by about 10% as well.
2010-08-09 17:14:31 -07:00
Aras Pranckevicius
63cddb27d7 copy_propagation: do propagation into non-out call params 2010-08-06 14:13:15 -07:00
Eric Anholt
c5b9cab499 glsl2: Catch pointless copies in copy propagation.
We wouldn't want to go rewriting dereferences to variables to point at
the same variable it did before.  While I didn't find a way to trigger
that, a shader in Yo Frankie managed to produce a self-assignment by
passing a constant to a function doing self assignment like this.

Cleans up the IR for glsl-deadcode-self-assign.shader_test
2010-08-05 09:17:45 -07:00
Ian Romanick
5a7758efbe glsl2: Add ir_assignment::write_mask and associated methods
Replace swizzles on the LHS with additional swizzles on the RHS and a
write mask in the assignment instruction.  As part of this add
ir_assignment::set_lhs.  Ideally we'd make ir_assignment::lhs private
to prevent erroneous writes, but that would require a lot of code
butchery at this point.

Add ir_assignment constructor that takes an explicit write mask.  This
is required for ir_assignment::clone, but it can also be used in other
places.  Without this, ir_assignment clones lose their write masks,
and incorrect IR is generated in optimization passes.

Add ir_assignment::whole_variable_written method.  This method gets
the variable on the LHS if the whole variable is written or NULL
otherwise.  This is different from
ir->lhs->whole_variable_referenced() because the latter has no
knowledge of the write mask stored in the ir_assignment.

Gut all code from ir_to_mesa that handled swizzles on the LHS of
assignments.  There is probably some other refactoring that could be
done here, but that can be left for another day.
2010-08-04 16:47:27 -07:00
Eric Anholt
b87259d3ef glsl2: Fix copy propagation in the presence of derefs in array indexes.
We would clear the in_lhs flag early, avoiding copy propagation on the
array index variable (oops) and then copy propagating on the array
variable (ouch).  Just avoid all copy propagation on the LHS instead.
2010-07-12 16:07:02 -07:00
Kenneth Graunke
c6099a65f8 glsl2: Create new talloc contexts the "right" way. 2010-06-30 13:52:24 -07:00
Kenneth Graunke
5f3fe44595 Use a more sensible context in copy propagation. 2010-06-28 11:14:47 -07:00
Eric Anholt
2928588267 glsl2: Move the compiler to the subdirectory it will live in in Mesa. 2010-06-24 15:36:00 -07:00
Renamed from ir_copy_propagation.cpp (Browse further)