diff options
author | Eric Anholt <eric@anholt.net> | 2010-04-05 15:24:28 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-04-06 11:42:31 -0700 |
commit | 62735694a1dfc09a16ea32312877cd49c7982118 (patch) | |
tree | 3b43d12a28486866cfc677dac356bda211c8b54f /glsl_parser_extras.cpp | |
parent | 271e1996734c3948b71b6f28bae37e25b7ec048a (diff) |
Add a constant folding optimization pass.
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r-- | glsl_parser_extras.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index eb19ed7b91..84a3fd9071 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -34,6 +34,7 @@ #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" +#include "ir_constant_folding.h" #include "ir_print_visitor.h" void @@ -647,6 +648,16 @@ main(int argc, char **argv) _mesa_ast_to_hir(&instructions, &state); + /* Optimization passes */ + if (!state.error) { + /* Constant folding */ + foreach_iter(exec_list_iterator, iter, instructions) { + ir_constant_folding_visitor v; + ((ir_instruction *)iter.get())->accept(& v); + } + } + + /* Print out the resulting IR */ printf("\n\n"); if (!state.error) { |