summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_optimization.h
Commit message (Collapse)AuthorAgeFilesLines
* glsl2: Add a pass to strip out noop swizzles.Eric Anholt2010-08-131-0/+1
| | | | | | With the glsl2-965 branch, the optimization of glsl-algebraic-rcp-rcp regressed due to noop swizzles hiding information from ir_algebraic. This cleans up those noop swizzles for us.
* glsl2: Move the common optimization passes to a helper function.Eric Anholt2010-08-131-0/+2
| | | | | These are passes that we expect all codegen to be happy with. The other lowering passes for Mesa IR are moved to the Mesa IR generator.
* glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))Eric Anholt2010-08-091-0/+1
| | | | | | All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic.
* glsl2: Add constant propagation.Eric Anholt2010-08-091-0/+1
| | | | | | | | Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness.
* glsl2: Add a pass to convert exp and log to exp2 and log2.Eric Anholt2010-08-051-0/+1
| | | | | | | | | Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG opcode that doesn't do what we want. This also lets the multiplication coefficients in there get constant-folded, possibly. Fixes: glsl-fs-log
* ir_structure_splitting: New pass to chop structures into their components.Eric Anholt2010-08-051-0/+1
| | | | | | | This doesn't do anything if your structure goes through an uninlined function call or if whole-structure assignment occurs. As such, the impact is limited, at least until we do some global copy propagation to reduce whole-structure assignment.
* glsl2: Add a pass for removing unused functions.Eric Anholt2010-08-051-0/+1
| | | | | | | | | For a shader involving many small functions, this avoids running optimization across all of them after they've been inlined post-linking. Reduces the runtime of linking and running a fragment shader from Yo Frankie from 1.6 seconds to 0.9 seconds (-44.9%, +/- 3.3%).
* glsl2: Add new tree grafting optimization pass.Eric Anholt2010-07-311-0/+1
|
* glsl2: Make the dead code handler make its own talloc context.Eric Anholt2010-07-271-4/+2
| | | | | This way, we don't need to pass in a parse state, and the context doesn't grow with the number of passes through optimization.
* glsl2: Add optimization pass for algebraic simplifications.Eric Anholt2010-07-271-1/+2
| | | | | | This cleans up the assembly output of almost all the non-logic tests glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically, flattening to a temporary and squaring it).
* glsl2: Add a pass for converting if statements to conditional assignment.Eric Anholt2010-07-191-0/+1
| | | | This will be used on 915 and similar hardware of that generation.
* glsl2: Add a new pass at the IR level to break down matrix ops to vector ops.Eric Anholt2010-07-121-0/+1
| | | | | | | This will be used by the Mesa IR and likely most HW backends, as it allows other optimizations to occur that might not otherwise. Fixes glsl-vs-mat-sub-1, glsl-vs-mat-div-1.
* glsl2: Add a pass to simplify if statements returning from both sides.Eric Anholt2010-07-071-0/+1
| | | | | | | | | | | | | | | This allows function inlining making the following tests work even without function calls implemented: glsl-fs-functions-2 glsl-fs-functions-3 glsl-vs-functions glsl-vs-functions-2 glsl-vs-functions-3 glsl-vs-vec4-indexing-5 (Note that those tests were designed to trigger actual function calls, and this defeats them. However, those testcases ended up catching the bug in the previous commit.)
* glsl2: Add pass for supporting variable vector indexing in rvalues.Eric Anholt2010-07-061-0/+1
| | | | | | | The Mesa IR needs this to support vector indexing correctly, and hardware backends such as 915 would want this behavior as well. Fixes glsl-vs-vec4-indexing-2.
* glsl2: Add a pass to break ir_binop_div to _mul and _rcp.Eric Anholt2010-07-021-0/+1
| | | | This results in constant folding of a constant divisor.
* glsl2: Add a pass to convert mod(a, b) to b * fract(a/b).Eric Anholt2010-07-011-0/+1
| | | | This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod.
* glsl2: Use the parser state as the talloc context for dead code elimination.Eric Anholt2010-06-251-2/+4
| | | | This cuts runtime by around 20% from talloc_parent() lookups.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+41