This cuts runtime by around 20% from talloc_parent() lookups.
/* List of variable_entry */
exec_list variable_list;
+
+ void *mem_ctx;
};
return entry;
}
- void *ctx = talloc_parent(var);
-
- variable_entry *entry = new(ctx) variable_entry(var);
+ variable_entry *entry = new(mem_ctx) variable_entry(var);
this->variable_list.push_tail(entry);
return entry;
}
* for usage on an unlinked instruction stream.
*/
bool
-do_dead_code(exec_list *instructions)
+do_dead_code(struct _mesa_glsl_parse_state *state,
+ exec_list *instructions)
{
ir_dead_code_visitor v;
bool progress = false;
+ v.mem_ctx = state;
v.run(instructions);
foreach_iter(exec_list_iterator, iter, v.variable_list) {
* with global scope.
*/
bool
-do_dead_code_unlinked(exec_list *instructions)
+do_dead_code_unlinked(struct _mesa_glsl_parse_state *state,
+ exec_list *instructions)
{
bool progress = false;
foreach_iter(exec_list_iterator, sigiter, *f) {
ir_function_signature *sig =
(ir_function_signature *) sigiter.get();
- if (do_dead_code(&sig->body))
+ if (do_dead_code(state, &sig->body))
progress = true;
}
}
bool do_constant_variable(exec_list *instructions);
bool do_constant_variable_unlinked(exec_list *instructions);
bool do_copy_propagation(exec_list *instructions);
-bool do_dead_code(exec_list *instructions);
+bool do_dead_code(struct _mesa_glsl_parse_state *state,
+ exec_list *instructions);
bool do_dead_code_local(exec_list *instructions);
-bool do_dead_code_unlinked(exec_list *instructions);
+bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state,
+ exec_list *instructions);
bool do_function_inlining(exec_list *instructions);
bool do_if_simplification(exec_list *instructions);
bool do_swizzle_swizzle(exec_list *instructions);
progress = do_if_simplification(&shader->ir) || progress;
progress = do_copy_propagation(&shader->ir) || progress;
progress = do_dead_code_local(&shader->ir) || progress;
- progress = do_dead_code_unlinked(&shader->ir) || progress;
+ progress = do_dead_code_unlinked(state, &shader->ir) || progress;
progress = do_constant_variable_unlinked(&shader->ir) || progress;
progress = do_constant_folding(&shader->ir) || progress;
progress = do_vec_index_to_swizzle(&shader->ir) || progress;
progress = do_if_simplification(&shader->ir) || progress;
progress = do_copy_propagation(&shader->ir) || progress;
progress = do_dead_code_local(&shader->ir) || progress;
- progress = do_dead_code_unlinked(&shader->ir) || progress;
+ progress = do_dead_code_unlinked(state, &shader->ir) || progress;
progress = do_constant_variable_unlinked(&shader->ir) || progress;
progress = do_constant_folding(&shader->ir) || progress;
progress = do_vec_index_to_swizzle(&shader->ir) || progress;