diff options
author | Eric Anholt <[email protected]> | 2010-07-27 11:28:26 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-07-27 11:46:05 -0700 |
commit | 66d4c65ee2c311ea0c71c39a28456d0c11798d6b (patch) | |
tree | 1ac5615584028ada121a23c83101e6b45c28408e /src/glsl/ir_dead_code.cpp | |
parent | 8bbdf6e7cdfc3265439761a06eea79627f4ee2fa (diff) |
glsl2: Make the dead code handler make its own talloc context.
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.
Diffstat (limited to 'src/glsl/ir_dead_code.cpp')
-rw-r--r-- | src/glsl/ir_dead_code.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index ea78107f493..4804407bdc3 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -146,13 +146,12 @@ ir_dead_code_visitor::visit_leave(ir_assignment *ir) * for usage on an unlinked instruction stream. */ bool -do_dead_code(struct _mesa_glsl_parse_state *state, - exec_list *instructions) +do_dead_code(exec_list *instructions) { ir_dead_code_visitor v; bool progress = false; - v.mem_ctx = state; + v.mem_ctx = talloc_new(NULL); v.run(instructions); foreach_iter(exec_list_iterator, iter, v.variable_list) { @@ -188,6 +187,8 @@ do_dead_code(struct _mesa_glsl_parse_state *state, progress = true; } } + talloc_free(v.mem_ctx); + return progress; } @@ -199,8 +200,7 @@ do_dead_code(struct _mesa_glsl_parse_state *state, * with global scope. */ bool -do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, - exec_list *instructions) +do_dead_code_unlinked(exec_list *instructions) { bool progress = false; @@ -211,7 +211,7 @@ do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, foreach_iter(exec_list_iterator, sigiter, *f) { ir_function_signature *sig = (ir_function_signature *) sigiter.get(); - if (do_dead_code(state, &sig->body)) + if (do_dead_code(&sig->body)) progress = true; } } |