diff options
author | Eric Anholt <[email protected]> | 2010-04-16 12:53:46 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-04-16 12:56:18 -0700 |
commit | 0d42321ec1aaeaf60ee2dd8b1872182065ebc057 (patch) | |
tree | 84614938e2409734fcb9c9eba62bc470343d5311 /ir_function_inlining.cpp | |
parent | 4950a68bf22ede6f4f368c9783e5401816159574 (diff) |
Add support for inlining calls done inside of expressions.
Diffstat (limited to 'ir_function_inlining.cpp')
-rw-r--r-- | ir_function_inlining.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp index e03673e632d..af6a477d9b4 100644 --- a/ir_function_inlining.cpp +++ b/ir_function_inlining.cpp @@ -31,6 +31,7 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_function_inlining.h" +#include "ir_expression_flattening.h" #include "glsl_types.h" class variable_remap : public exec_node { @@ -305,10 +306,23 @@ can_inline(ir_call *call) } bool +automatic_inlining_predicate(ir_instruction *ir) +{ + ir_call *call = ir->as_call(); + + if (call && can_inline(call)) + return true; + + return false; +} + +bool do_function_inlining(exec_list *instructions) { bool progress = false; + do_expression_flattening(instructions, automatic_inlining_predicate); + foreach_iter(exec_list_iterator, iter, *instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); ir_assignment *assign = ir->as_assignment(); |