summaryrefslogtreecommitdiffstats
path: root/src/glsl/lower_jumps.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Lower break instructions when necessary at the end of a loop.Paul Berry2011-07-081-1/+54
| | | | | | | | | | | | | | | | | | Normally lower_jumps.cpp doesn't need to lower a break instruction that occurs at the end of a loop, because all back-ends can produce proper GPU instructions for a break instruction in this "canonical" location. However, if other break instructions within the loop are already being lowered, then a break instruction at the end of the loop needs to be lowered too, since after the optimization is complete a new conditional break will be inserted at the end of the loop. Without this patch, lower_jumps.cpp may require multiple passes in order to lower all jumps. This results in sub-optimal output because lower_jumps.cpp produces a brand new set of temporary variables each time it is run, and the redundant temporary variables are not guaranteed to be eliminated by later optimization passes. Fixes unit test test_lower_breaks_6.
* glsl: In lower_jumps.cpp, lower both branches of a conditional.Paul Berry2011-07-081-1/+4
| | | | | | | | | | | | | | | Previously, lower_jumps.cpp would break out of its loop after lowering a jump instruction in just the then- or else-branch of a conditional, and it would fail to lower a jump instruction occurring in the other branch. Without this patch, lower_jumps.cpp may require multiple passes in order to lower all jumps. This results in sub-optimal output because lower_jumps.cpp produces a brand new set of temporary variables each time it is run, and the redundant temporary variables are not guaranteed to be eliminated by later optimization passes. Fixes unit test test_lower_returns_4.
* glsl: Use foreach_list in lower_jumps.cppPaul Berry2011-07-081-1/+12
| | | | | | | | | | | | | | | | | | | | | | | The visitor class in lower_jumps.cpp never removes or replaces the instruction being visited, but it frequently alters or removes the instructions that follow it. Therefore, to make sure the altered IR is visited, it needs to iterate through exec_lists using foreach_list rather than visit_exec_list(). Without this patch, lower_jumps.cpp may require multiple passes in order to lower all jumps. This results in sub-optimal output because lower_jumps.cpp produces a brand new set of temporary variables each time it is run, and the redundant temporary variables are not guaranteed to be eliminated by later optimization passes. Also, certain invariants assumed by lower_jumps.cpp may fail to hold, causing assertion failures. Fixes unit tests test_lower_pulled_out_jump, test_lower_unified_returns, test_lower_guarded_conditional_break, test_lower_return_non_void_at_end_of_loop, and test_lower_returns_3. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: lower unconditional returns and continues in loops.Paul Berry2011-07-081-8/+54
| | | | | | | | | | | | | | | | | Previously, lower_jumps.cpp would only lower return and continue statements that appeared inside conditionals. This patch makes it lower unconditional returns and continue statements that occur inside a loop. Such unconditional flow control statements would be unlikely to be explicitly coded by a reasonable user, however they might arise as a result of other optimizations. Without this patch, lower_jumps.cpp might not lower certain return and continue statements, causing some backends to fail. Fixes unit tests test_lower_return_void_at_end_of_loop and test_remove_continue_at_end_of_loop.
* glsl: Lower unconditional return statements.Paul Berry2011-07-081-0/+14
| | | | | | | | | | Previously, lower_jumps.cpp only lowered return statements that appeared inside of an if statement. Without this patch, lower_jumps.cpp might not lower certain return statements, causing some back-ends to fail (as in bug #36669). Fixes unit test test_lower_returns_1.
* glsl: Refactor logic for determining whether to lower return statements.Paul Berry2011-07-081-7/+12
| | | | | | | | Previously, do_lower_jumps.cpp determined whether to lower return statements in ir_lower_jumps_visitor::should_lower_jumps(). Moved this logic to ir_lower_jumps_visitor::visit(ir_function_signature *), so that it can be used in determining whether to lower a return statement at the end of a function.
* glsl: Add explanatory comments to lower_jumps.cpp.Paul Berry2011-07-081-14/+322
| | | | | | No functional change. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: remove trailing comma to silence warningBrian Paul2011-01-121-1/+1
|
* glsl: fix lowering conditional returns in subroutinesFabian Bieler2010-12-091-1/+5
| | | | | | this fix applies to the lower_sub_return 'branch' of the lower_jumps pass Fixes piglit tests glsl-functions-5 and glsl-functions-6.
* glsl: Add comments to lower_jumps (from the commit message).Kenneth Graunke2010-12-011-0/+31
| | | | | This is essentially Luca's commit message, but placed at the top of the file.
* glsl: Remove "discard" support from lower_jumps.Kenneth Graunke2010-12-011-11/+2
| | | | | | | | | | | | The new lower_discard and opt_discard_simplification passes should handle all the necessary transformations, so lower_jumps doesn't need to support it. Also, lower_jumps incorrectly handled conditional discards - it would unconditionally truncate all code after the discard. Rather than fixing the bug, simply remove the code. NOTE: This is a candidate for the 7.9 branch.
* glsl: Fix Doxygen tag \file in recently renamed filesChad Versace2010-11-171-1/+1
|
* glsl: Rename various ir_* files to lower_* and opt_*.Kenneth Graunke2010-11-151-0/+544
This helps distinguish between lowering passes, optimization passes, and other compiler code.