diff options
author | Kenneth Graunke <[email protected]> | 2013-11-22 02:10:15 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-01-13 11:38:19 -0800 |
commit | 838a6871bbcd8cd0493bb39b188129f7d49de47e (patch) | |
tree | 78a442fbc3ee72f5e13d2130d8aee34cfd9b97b7 | |
parent | 5f7e778fa1b1e969a1b15e3650dec49b0026ed08 (diff) |
glsl: Convert piles of foreach_iter to foreach_list_safe.
In these cases, we edit the list (or at least might be), so we use the
foreach_list_safe variant.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/glsl/ir.cpp | 4 | ||||
-rw-r--r-- | src/glsl/ir_rvalue_visitor.cpp | 4 | ||||
-rw-r--r-- | src/glsl/lower_vec_index_to_cond_assign.cpp | 4 | ||||
-rw-r--r-- | src/glsl/lower_vec_index_to_swizzle.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_array_splitting.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_constant_propagation.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_copy_propagation.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_dead_code_local.cpp | 16 | ||||
-rw-r--r-- | src/glsl/opt_dead_functions.cpp | 8 | ||||
-rw-r--r-- | src/glsl/opt_function_inlining.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_if_simplification.cpp | 8 | ||||
-rw-r--r-- | src/glsl/opt_structure_splitting.cpp | 8 |
12 files changed, 36 insertions, 36 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 720fcdcd883..6ffa987f6d2 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1717,8 +1717,8 @@ ir_rvalue::error_value(void *mem_ctx) void visit_exec_list(exec_list *list, ir_visitor *visitor) { - foreach_iter(exec_list_iterator, iter, *list) { - ((ir_instruction *)iter.get())->accept(visitor); + foreach_list_safe(n, list) { + ((ir_instruction *) n)->accept(visitor); } } diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp index 9d8ccd94a06..fcbe9448d9c 100644 --- a/src/glsl/ir_rvalue_visitor.cpp +++ b/src/glsl/ir_rvalue_visitor.cpp @@ -123,8 +123,8 @@ ir_rvalue_base_visitor::rvalue_visit(ir_assignment *ir) ir_visitor_status ir_rvalue_base_visitor::rvalue_visit(ir_call *ir) { - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); + foreach_list_safe(n, &ir->actual_parameters) { + ir_rvalue *param = (ir_rvalue *) n; ir_rvalue *new_param = param; handle_rvalue(&new_param); diff --git a/src/glsl/lower_vec_index_to_cond_assign.cpp b/src/glsl/lower_vec_index_to_cond_assign.cpp index 8080006c1d0..fe6a3f208a1 100644 --- a/src/glsl/lower_vec_index_to_cond_assign.cpp +++ b/src/glsl/lower_vec_index_to_cond_assign.cpp @@ -197,8 +197,8 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) ir_visitor_status ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) { - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); + foreach_list_safe(n, &ir->actual_parameters) { + ir_rvalue *param = (ir_rvalue *) n; ir_rvalue *new_param = convert_vector_extract_to_cond_assign(param); if (new_param != param) { diff --git a/src/glsl/lower_vec_index_to_swizzle.cpp b/src/glsl/lower_vec_index_to_swizzle.cpp index 46985791ef6..b5bb00c3027 100644 --- a/src/glsl/lower_vec_index_to_swizzle.cpp +++ b/src/glsl/lower_vec_index_to_swizzle.cpp @@ -131,8 +131,8 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_assignment *ir) ir_visitor_status ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) { - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); + foreach_list_safe(n, &ir->actual_parameters) { + ir_rvalue *param = (ir_rvalue *) n; ir_rvalue *new_param = convert_vector_extract_to_swizzle(param); if (new_param != param) { diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index 70660eb0d9d..f37d0902201 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -224,8 +224,8 @@ ir_array_reference_visitor::get_split_list(exec_list *instructions, } /* Trim out variables we found that we can't split. */ - foreach_iter(exec_list_iterator, iter, variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list_safe(n, &variable_list) { + variable_entry *entry = (variable_entry *) n; if (debug) { printf("array %s@%p: decl %d, split %d\n", diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index 6fe16a93f02..a2d1b0f7582 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -398,8 +398,8 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask) return; /* Remove any entries currently in the ACP for this kill. */ - foreach_iter(exec_list_iterator, iter, *this->acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_list_safe(n, this->acp) { + acp_entry *entry = (acp_entry *) n; if (entry->var == var) { entry->write_mask &= ~write_mask; diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp index 887fdebda07..3a73342683b 100644 --- a/src/glsl/opt_copy_propagation.cpp +++ b/src/glsl/opt_copy_propagation.cpp @@ -292,8 +292,8 @@ ir_copy_propagation_visitor::kill(ir_variable *var) assert(var != NULL); /* Remove any entries currently in the ACP for this kill. */ - foreach_iter(exec_list_iterator, iter, *acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_list_safe(n, acp) { + acp_entry *entry = (acp_entry *) n; if (entry->lhs == var || entry->rhs == var) { entry->remove(); diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 66522b9c766..e7d46edbe3e 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -70,8 +70,8 @@ public: void kill_channels(ir_variable *const var, int used) { - foreach_iter(exec_list_iterator, iter, *this->assignments) { - assignment_entry *entry = (assignment_entry *)iter.get(); + foreach_list_safe(n, this->assignments) { + assignment_entry *entry = (assignment_entry *) n; if (entry->lhs == var) { if (var->type->is_scalar() || var->type->is_vector()) { @@ -119,8 +119,8 @@ public: /* For the purpose of dead code elimination, emitting a vertex counts as * "reading" all of the currently assigned output variables. */ - foreach_iter(exec_list_iterator, iter, *this->assignments) { - assignment_entry *entry = (assignment_entry *)iter.get(); + foreach_list_safe(n, this->assignments) { + assignment_entry *entry = (assignment_entry *) n; if (entry->lhs->data.mode == ir_var_shader_out) { if (debug) printf("kill %s\n", entry->lhs->name); @@ -196,8 +196,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) printf("looking for %s.0x%01x to remove\n", var->name, ir->write_mask); - foreach_iter(exec_list_iterator, iter, *assignments) { - assignment_entry *entry = (assignment_entry *)iter.get(); + foreach_list_safe(n, assignments) { + assignment_entry *entry = (assignment_entry *) n; if (entry->lhs != var) continue; @@ -258,8 +258,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) */ if (debug) printf("looking for %s to remove\n", var->name); - foreach_iter(exec_list_iterator, iter, *assignments) { - assignment_entry *entry = (assignment_entry *)iter.get(); + foreach_list_safe(n, assignments) { + assignment_entry *entry = (assignment_entry *) n; if (entry->lhs == var) { if (debug) diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp index 2896072abca..8bb278e4537 100644 --- a/src/glsl/opt_dead_functions.cpp +++ b/src/glsl/opt_dead_functions.cpp @@ -123,8 +123,8 @@ do_dead_functions(exec_list *instructions) * the unused ones, and remove function definitions that have no more * signatures. */ - foreach_iter(exec_list_iterator, iter, v.signature_list) { - signature_entry *entry = (signature_entry *)iter.get(); + foreach_list_safe(n, &v.signature_list) { + signature_entry *entry = (signature_entry *) n; if (!entry->used) { entry->signature->remove(); @@ -137,8 +137,8 @@ do_dead_functions(exec_list *instructions) /* We don't just do this above when we nuked a signature because of * const pointers. */ - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list_safe(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir_function *func = ir->as_function(); if (func && func->signatures.is_empty()) { diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp index 95c3f70d452..2ae18c14f53 100644 --- a/src/glsl/opt_function_inlining.cpp +++ b/src/glsl/opt_function_inlining.cpp @@ -349,8 +349,8 @@ ir_variable_replacement_visitor::visit_leave(ir_dereference_record *ir) ir_visitor_status ir_variable_replacement_visitor::visit_leave(ir_call *ir) { - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); + foreach_list_safe(n, &ir->actual_parameters) { + ir_rvalue *param = (ir_rvalue *) n; ir_rvalue *new_param = param; replace_rvalue(&new_param); diff --git a/src/glsl/opt_if_simplification.cpp b/src/glsl/opt_if_simplification.cpp index db59b131dbc..2bec8252ea5 100644 --- a/src/glsl/opt_if_simplification.cpp +++ b/src/glsl/opt_if_simplification.cpp @@ -90,13 +90,13 @@ ir_if_simplification_visitor::visit_leave(ir_if *ir) * that matters out. */ if (condition_constant->value.b[0]) { - foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { - ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + foreach_list_safe(n, &ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *) n; ir->insert_before(then_ir); } } else { - foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { - ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + foreach_list_safe(n, &ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *) n; ir->insert_before(else_ir); } } diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp index b668dc21c04..1ec537b132b 100644 --- a/src/glsl/opt_structure_splitting.cpp +++ b/src/glsl/opt_structure_splitting.cpp @@ -315,8 +315,8 @@ do_structure_splitting(exec_list *instructions) visit_list_elements(&refs, instructions); /* Trim out variables we can't split. */ - foreach_iter(exec_list_iterator, iter, refs.variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list_safe(n, &refs.variable_list) { + variable_entry *entry = (variable_entry *) n; if (debug) { printf("structure %s@%p: decl %d, whole_access %d\n", @@ -337,8 +337,8 @@ do_structure_splitting(exec_list *instructions) /* Replace the decls of the structures to be split with their split * components. */ - foreach_iter(exec_list_iterator, iter, refs.variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list_safe(n, &refs.variable_list) { + variable_entry *entry = (variable_entry *) n; const struct glsl_type *type = entry->var->type; entry->mem_ctx = ralloc_parent(entry->var); |