diff options
author | Kenneth Graunke <[email protected]> | 2013-11-22 01:25:42 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-01-13 11:38:19 -0800 |
commit | 5f7e778fa1b1e969a1b15e3650dec49b0026ed08 (patch) | |
tree | 40bd6e3e5175ccd2ca49a783b7680ee2c947b775 /src/glsl | |
parent | fb6d9798a0c6eefd512f5b0f19eed34af8f4f257 (diff) |
glsl: Convert piles of foreach_iter to the newer foreach_list macro.
foreach_iter and exec_list_iterators have been deprecated for some time now;
we just hadn't ever bothered to convert code to the newer foreach_list
and foreach_list_safe macros.
In these cases, we aren't editing the list, so we can use foreach_list
rather than foreach_list_safe.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 4 | ||||
-rw-r--r-- | src/glsl/builtin_functions.cpp | 4 | ||||
-rw-r--r-- | src/glsl/ir.cpp | 4 | ||||
-rw-r--r-- | src/glsl/ir_basic_block.cpp | 10 | ||||
-rw-r--r-- | src/glsl/ir_clone.cpp | 16 | ||||
-rw-r--r-- | src/glsl/ir_expression_flattening.cpp | 4 | ||||
-rw-r--r-- | src/glsl/ir_function.cpp | 10 | ||||
-rw-r--r-- | src/glsl/ir_print_visitor.cpp | 32 | ||||
-rw-r--r-- | src/glsl/ir_reader.cpp | 24 | ||||
-rw-r--r-- | src/glsl/ir_validate.cpp | 4 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 9 | ||||
-rw-r--r-- | src/glsl/lower_if_to_cond_assign.cpp | 8 | ||||
-rw-r--r-- | src/glsl/opt_array_splitting.cpp | 12 | ||||
-rw-r--r-- | src/glsl/opt_constant_propagation.cpp | 20 | ||||
-rw-r--r-- | src/glsl/opt_constant_variable.cpp | 9 | ||||
-rw-r--r-- | src/glsl/opt_copy_propagation.cpp | 16 | ||||
-rw-r--r-- | src/glsl/opt_copy_propagation_elements.cpp | 8 | ||||
-rw-r--r-- | src/glsl/opt_dead_code.cpp | 9 | ||||
-rw-r--r-- | src/glsl/opt_dead_code_local.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_dead_functions.cpp | 4 | ||||
-rw-r--r-- | src/glsl/opt_function_inlining.cpp | 6 | ||||
-rw-r--r-- | src/glsl/opt_structure_splitting.cpp | 8 | ||||
-rw-r--r-- | src/glsl/s_expression.cpp | 8 |
23 files changed, 113 insertions, 120 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ef8e699e02b..4cc8eb18dc8 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3818,8 +3818,8 @@ ast_function_definition::hir(exec_list *instructions, * Add these to the symbol table. */ state->symbols->push_scope(); - foreach_iter(exec_list_iterator, iter, signature->parameters) { - ir_variable *const var = ((ir_instruction *) iter.get())->as_variable(); + foreach_list(n, &signature->parameters) { + ir_variable *const var = ((ir_instruction *) n)->as_variable(); assert(var != NULL); diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 038e47363a4..5b8463a8942 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -2398,8 +2398,8 @@ builtin_builder::call(ir_function *f, ir_variable *ret, exec_list params) { exec_list actual_params; - foreach_iter(exec_list_iterator, it, params) { - ir_variable *var = ((ir_instruction *)it.get())->as_variable(); + foreach_list(node, ¶ms) { + ir_variable *var = ((ir_instruction *) node)->as_variable(); actual_params.push_tail(var_ref(var)); } diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index ba6903d8a3f..720fcdcd883 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1739,8 +1739,8 @@ steal_memory(ir_instruction *ir, void *new_ctx) */ if (constant != NULL) { if (constant->type->is_record()) { - foreach_iter(exec_list_iterator, iter, constant->components) { - ir_constant *field = (ir_constant *)iter.get(); + foreach_list(n, &constant->components) { + ir_constant *field = (ir_constant *) n; steal_memory(field, ir); } } else if (constant->type->is_array()) { diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index 2cbc682d46c..426fda2f202 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -58,8 +58,8 @@ void call_for_basic_blocks(exec_list *instructions, ir_instruction *leader = NULL; ir_instruction *last = NULL; - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir_if *ir_if; ir_loop *ir_loop; ir_function *ir_function; @@ -90,10 +90,8 @@ void call_for_basic_blocks(exec_list *instructions, * and the body of main(). Perhaps those instructions ought * to live inside of main(). */ - foreach_iter(exec_list_iterator, fun_iter, *ir_function) { - ir_function_signature *ir_sig; - - ir_sig = (ir_function_signature *)fun_iter.get(); + foreach_list(func_node, &ir_function->signatures) { + ir_function_signature *ir_sig = (ir_function_signature *) func_node; call_for_basic_blocks(&ir_sig->body, callback, data); } diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 4e5cf68caa5..cb732a51a0d 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -123,13 +123,13 @@ ir_if::clone(void *mem_ctx, struct hash_table *ht) const { ir_if *new_if = new(mem_ctx) ir_if(this->condition->clone(mem_ctx, ht)); - foreach_iter(exec_list_iterator, iter, this->then_instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, &this->then_instructions) { + ir_instruction *ir = (ir_instruction *) n; new_if->then_instructions.push_tail(ir->clone(mem_ctx, ht)); } - foreach_iter(exec_list_iterator, iter, this->else_instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, &this->else_instructions) { + ir_instruction *ir = (ir_instruction *) n; new_if->else_instructions.push_tail(ir->clone(mem_ctx, ht)); } @@ -141,8 +141,8 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const { ir_loop *new_loop = new(mem_ctx) ir_loop(); - foreach_iter(exec_list_iterator, iter, this->body_instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, &this->body_instructions) { + ir_instruction *ir = (ir_instruction *) n; new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht)); } @@ -158,8 +158,8 @@ ir_call::clone(void *mem_ctx, struct hash_table *ht) const exec_list new_parameters; - foreach_iter(exec_list_iterator, iter, this->actual_parameters) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, &this->actual_parameters) { + ir_instruction *ir = (ir_instruction *) n; new_parameters.push_tail(ir->clone(mem_ctx, ht)); } diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index b44e68ca364..c1cadb122bc 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -59,8 +59,8 @@ do_expression_flattening(exec_list *instructions, { ir_expression_flattening_visitor v(predicate); - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir->accept(&v); } diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index bd5318d231b..40cf5894af8 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -141,9 +141,8 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state, * multiple ways to apply these conversions to the actual arguments of a * call such that the call can be made to match multiple signatures." */ - foreach_iter(exec_list_iterator, iter, signatures) { - ir_function_signature *const sig = - (ir_function_signature *) iter.get(); + foreach_list(n, &this->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; /* Skip over any built-ins that aren't available in this shader. */ if (sig->is_builtin() && !sig->is_builtin_available(state)) @@ -212,9 +211,8 @@ ir_function_signature * ir_function::exact_matching_signature(_mesa_glsl_parse_state *state, const exec_list *actual_parameters) { - foreach_iter(exec_list_iterator, iter, signatures) { - ir_function_signature *const sig = - (ir_function_signature *) iter.get(); + foreach_list(n, &this->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; /* Skip over any built-ins that aren't available in this shader. */ if (sig->is_builtin() && !sig->is_builtin_available(state)) diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 01c5f7f1c36..9458595585f 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -61,8 +61,8 @@ _mesa_print_ir(exec_list *instructions, } printf("(\n"); - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir->print(); if (ir->ir_type != ir_type_function) printf("\n"); @@ -179,8 +179,8 @@ void ir_print_visitor::visit(ir_function_signature *ir) printf("(parameters\n"); indentation++; - foreach_iter(exec_list_iterator, iter, ir->parameters) { - ir_variable *const inst = (ir_variable *) iter.get(); + foreach_list(n, &ir->parameters) { + ir_variable *const inst = (ir_variable *) n; indent(); inst->accept(this); @@ -196,8 +196,8 @@ void ir_print_visitor::visit(ir_function_signature *ir) printf("(\n"); indentation++; - foreach_iter(exec_list_iterator, iter, ir->body) { - ir_instruction *const inst = (ir_instruction *) iter.get(); + foreach_list(n, &ir->body) { + ir_instruction *const inst = (ir_instruction *) n; indent(); inst->accept(this); @@ -215,8 +215,8 @@ void ir_print_visitor::visit(ir_function *ir) { printf("(function %s\n", ir->name); indentation++; - foreach_iter(exec_list_iterator, iter, *ir) { - ir_function_signature *const sig = (ir_function_signature *) iter.get(); + foreach_list(n, &ir->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; indent(); sig->accept(this); printf("\n"); @@ -440,8 +440,8 @@ ir_print_visitor::visit(ir_call *ir) if (ir->return_deref) ir->return_deref->accept(this); printf(" ("); - foreach_iter(exec_list_iterator, iter, *ir) { - ir_instruction *const inst = (ir_instruction *) iter.get(); + foreach_list(n, &ir->actual_parameters) { + ir_instruction *const inst = (ir_instruction *) n; inst->accept(this); } @@ -487,8 +487,8 @@ ir_print_visitor::visit(ir_if *ir) printf("(\n"); indentation++; - foreach_iter(exec_list_iterator, iter, ir->then_instructions) { - ir_instruction *const inst = (ir_instruction *) iter.get(); + foreach_list(n, &ir->then_instructions) { + ir_instruction *const inst = (ir_instruction *) n; indent(); inst->accept(this); @@ -504,8 +504,8 @@ ir_print_visitor::visit(ir_if *ir) printf("(\n"); indentation++; - foreach_iter(exec_list_iterator, iter, ir->else_instructions) { - ir_instruction *const inst = (ir_instruction *) iter.get(); + foreach_list(n, &ir->else_instructions) { + ir_instruction *const inst = (ir_instruction *) n; indent(); inst->accept(this); @@ -526,8 +526,8 @@ ir_print_visitor::visit(ir_loop *ir) printf("(loop (\n"); indentation++; - foreach_iter(exec_list_iterator, iter, ir->body_instructions) { - ir_instruction *const inst = (ir_instruction *) iter.get(); + foreach_list(n, &ir->body_instructions) { + ir_instruction *const inst = (ir_instruction *) n; indent(); inst->accept(this); diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 7970112ec51..f5185d28484 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -170,8 +170,8 @@ ir_reader::scan_for_prototypes(exec_list *instructions, s_expression *expr) return; } - foreach_iter(exec_list_iterator, it, list->subexpressions) { - s_list *sub = SX_AS_LIST(it.get()); + foreach_list(n, &list->subexpressions) { + s_list *sub = SX_AS_LIST(n); if (sub == NULL) continue; // not a (function ...); ignore it. @@ -315,8 +315,8 @@ ir_reader::read_instructions(exec_list *instructions, s_expression *expr, return; } - foreach_iter(exec_list_iterator, it, list->subexpressions) { - s_expression *sub = (s_expression*) it.get(); + foreach_list(n, &list->subexpressions) { + s_expression *sub = (s_expression *) n; ir_instruction *ir = read_instruction(sub, loop_ctx); if (ir != NULL) { /* Global variable declarations should be moved to the top, before @@ -403,8 +403,8 @@ ir_reader::read_declaration(s_expression *expr) ir_variable *var = new(mem_ctx) ir_variable(type, s_name->value(), ir_var_auto); - foreach_iter(exec_list_iterator, it, s_quals->subexpressions) { - s_symbol *qualifier = SX_AS_SYMBOL(it.get()); + foreach_list(n, &s_quals->subexpressions) { + s_symbol *qualifier = SX_AS_SYMBOL(n); if (qualifier == NULL) { ir_read_error(expr, "qualifier list must contain only symbols"); return NULL; @@ -656,8 +656,8 @@ ir_reader::read_call(s_expression *expr) exec_list parameters; - foreach_iter(exec_list_iterator, it, params->subexpressions) { - s_expression *expr = (s_expression*) it.get(); + foreach_list(n, ¶ms->subexpressions) { + s_expression *expr = (s_expression *) n; ir_rvalue *param = read_rvalue(expr); if (param == NULL) { ir_read_error(expr, "when reading parameter to function call"); @@ -796,8 +796,8 @@ ir_reader::read_constant(s_expression *expr) if (type->is_array()) { unsigned elements_supplied = 0; exec_list elements; - foreach_iter(exec_list_iterator, it, values->subexpressions) { - s_expression *elt = (s_expression *) it.get(); + foreach_list(n, &values->subexpressions) { + s_expression *elt = (s_expression *) n; ir_constant *ir_elt = read_constant(elt); if (ir_elt == NULL) return NULL; @@ -817,13 +817,13 @@ ir_reader::read_constant(s_expression *expr) // Read in list of values (at most 16). unsigned k = 0; - foreach_iter(exec_list_iterator, it, values->subexpressions) { + foreach_list(n, &values->subexpressions) { if (k >= 16) { ir_read_error(values, "expected at most 16 numbers"); return NULL; } - s_expression *expr = (s_expression*) it.get(); + s_expression *expr = (s_expression *) n; if (type->base_type == GLSL_TYPE_FLOAT) { s_number *value = SX_AS_NUMBER(expr); diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 4bbb3ce6599..527acea4c35 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -813,8 +813,8 @@ validate_ir_tree(exec_list *instructions) v.run(instructions); - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; visit_tree(ir, check_node_type, NULL); } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e820f0f9fc6..14e2ff61062 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1338,9 +1338,8 @@ link_intrastage_shaders(void *mem_ctx, if (other == NULL) continue; - foreach_iter (exec_list_iterator, iter, *f) { - ir_function_signature *sig = - (ir_function_signature *) iter.get(); + foreach_list(n, &f->signatures) { + ir_function_signature *sig = (ir_function_signature *) n; if (!sig->is_defined || sig->is_builtin()) continue; @@ -1453,8 +1452,8 @@ link_intrastage_shaders(void *mem_ctx, if (linked->Stage == MESA_SHADER_GEOMETRY) { unsigned num_vertices = vertices_per_prim(prog->Geom.InputType); geom_array_resize_visitor input_resize_visitor(num_vertices, prog); - foreach_iter(exec_list_iterator, iter, *linked->ir) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, linked->ir) { + ir_instruction *ir = (ir_instruction *) n; ir->accept(&input_resize_visitor); } } diff --git a/src/glsl/lower_if_to_cond_assign.cpp b/src/glsl/lower_if_to_cond_assign.cpp index 1e7ce51c707..f15b217e09d 100644 --- a/src/glsl/lower_if_to_cond_assign.cpp +++ b/src/glsl/lower_if_to_cond_assign.cpp @@ -178,12 +178,12 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) ir_assignment *assign; /* Check that both blocks don't contain anything we can't support. */ - foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { - ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + foreach_list(n, &ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *) n; visit_tree(then_ir, check_control_flow, &found_control_flow); } - foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { - ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + foreach_list(n, &ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *) n; visit_tree(else_ir, check_control_flow, &found_control_flow); } if (found_control_flow) diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index e946e0ae58b..70660eb0d9d 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -135,8 +135,8 @@ ir_array_reference_visitor::get_variable_entry(ir_variable *var) if (var->type->is_unsized_array()) return NULL; - foreach_iter(exec_list_iterator, iter, this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list(n, &this->variable_list) { + variable_entry *entry = (variable_entry *) n; if (entry->var == var) return entry; } @@ -270,8 +270,8 @@ ir_array_splitting_visitor::get_splitting_entry(ir_variable *var) { assert(var); - foreach_iter(exec_list_iterator, iter, *this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list(n, this->variable_list) { + variable_entry *entry = (variable_entry *) n; if (entry->var == var) { return entry; } @@ -368,8 +368,8 @@ optimize_split_arrays(exec_list *instructions, bool linked) /* Replace the decls of the arrays 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(n, &refs.variable_list) { + variable_entry *entry = (variable_entry *) n; const struct glsl_type *type = entry->var->type; const struct glsl_type *subtype; diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index f1a6fbdaa64..6fe16a93f02 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -172,8 +172,8 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) channel = i; } - foreach_iter(exec_list_iterator, iter, *this->acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_list(n, this->acp) { + acp_entry *entry = (acp_entry *) n; if (entry->var == deref->var && entry->write_mask & (1 << channel)) { found = entry; break; @@ -318,8 +318,8 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions) this->killed_all = false; /* Populate the initial acp with a constant of the original */ - foreach_iter(exec_list_iterator, iter, *orig_acp) { - acp_entry *a = (acp_entry *)iter.get(); + foreach_list(n, orig_acp) { + acp_entry *a = (acp_entry *) n; this->acp->push_tail(new(this->mem_ctx) acp_entry(a)); } @@ -334,8 +334,8 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions) this->acp = orig_acp; this->killed_all = this->killed_all || orig_killed_all; - foreach_iter(exec_list_iterator, iter, *new_kills) { - kill_entry *k = (kill_entry *)iter.get(); + foreach_list(n, new_kills) { + kill_entry *k = (kill_entry *) n; kill(k->var, k->write_mask); } } @@ -379,8 +379,8 @@ ir_constant_propagation_visitor::visit_enter(ir_loop *ir) this->acp = orig_acp; this->killed_all = this->killed_all || orig_killed_all; - foreach_iter(exec_list_iterator, iter, *new_kills) { - kill_entry *k = (kill_entry *)iter.get(); + foreach_list(n, new_kills) { + kill_entry *k = (kill_entry *) n; kill(k->var, k->write_mask); } @@ -411,8 +411,8 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask) /* Add this writemask of the variable to the list of killed * variables in this block. */ - foreach_iter(exec_list_iterator, iter, *this->kills) { - kill_entry *entry = (kill_entry *)iter.get(); + foreach_list(n, this->kills) { + kill_entry *entry = (kill_entry *) n; if (entry->var == var) { entry->write_mask |= write_mask; diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index a026c51c31e..22a0fe1d107 100644 --- a/src/glsl/opt_constant_variable.cpp +++ b/src/glsl/opt_constant_variable.cpp @@ -194,13 +194,12 @@ do_constant_variable_unlinked(exec_list *instructions) { bool progress = false; - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir_function *f = ir->as_function(); if (f) { - foreach_iter(exec_list_iterator, sigiter, *f) { - ir_function_signature *sig = - (ir_function_signature *) sigiter.get(); + foreach_list(signode, &f->signatures) { + ir_function_signature *sig = (ir_function_signature *) signode; if (do_constant_variable(&sig->body)) progress = true; } diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp index db5dfc1534f..887fdebda07 100644 --- a/src/glsl/opt_copy_propagation.cpp +++ b/src/glsl/opt_copy_propagation.cpp @@ -167,8 +167,8 @@ ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) ir_variable *var = ir->var; - foreach_iter(exec_list_iterator, iter, *this->acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_list(n, this->acp) { + acp_entry *entry = (acp_entry *) n; if (var == entry->lhs) { ir->var = entry->rhs; @@ -217,8 +217,8 @@ ir_copy_propagation_visitor::handle_if_block(exec_list *instructions) this->killed_all = false; /* Populate the initial acp with a copy of the original */ - foreach_iter(exec_list_iterator, iter, *orig_acp) { - acp_entry *a = (acp_entry *)iter.get(); + foreach_list(n, orig_acp) { + acp_entry *a = (acp_entry *) n; this->acp->push_tail(new(this->mem_ctx) acp_entry(a->lhs, a->rhs)); } @@ -233,8 +233,8 @@ ir_copy_propagation_visitor::handle_if_block(exec_list *instructions) this->acp = orig_acp; this->killed_all = this->killed_all || orig_killed_all; - foreach_iter(exec_list_iterator, iter, *new_kills) { - kill_entry *k = (kill_entry *)iter.get(); + foreach_list(n, new_kills) { + kill_entry *k = (kill_entry *) n; kill(k->var); } } @@ -277,8 +277,8 @@ ir_copy_propagation_visitor::visit_enter(ir_loop *ir) this->acp = orig_acp; this->killed_all = this->killed_all || orig_killed_all; - foreach_iter(exec_list_iterator, iter, *new_kills) { - kill_entry *k = (kill_entry *)iter.get(); + foreach_list(n, new_kills) { + kill_entry *k = (kill_entry *) n; kill(k->var); } diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp index ba8a0f532fd..7f82a284bac 100644 --- a/src/glsl/opt_copy_propagation_elements.cpp +++ b/src/glsl/opt_copy_propagation_elements.cpp @@ -244,8 +244,8 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) /* Try to find ACP entries covering swizzle_chan[], hoping they're * the same source variable. */ - foreach_iter(exec_list_iterator, iter, *this->acp) { - acp_entry *entry = (acp_entry *)iter.get(); + foreach_list(n, this->acp) { + acp_entry *entry = (acp_entry *) n; if (var == entry->lhs) { for (int c = 0; c < chans; c++) { @@ -325,8 +325,8 @@ ir_copy_propagation_elements_visitor::handle_if_block(exec_list *instructions) this->killed_all = false; /* Populate the initial acp with a copy of the original */ - foreach_iter(exec_list_iterator, iter, *orig_acp) { - acp_entry *a = (acp_entry *)iter.get(); + foreach_list(n, orig_acp) { + acp_entry *a = (acp_entry *) n; this->acp->push_tail(new(this->mem_ctx) acp_entry(a)); } diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index a8d8b4a394c..af53d94fdea 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -129,13 +129,12 @@ do_dead_code_unlinked(exec_list *instructions) { bool progress = false; - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; ir_function *f = ir->as_function(); if (f) { - foreach_iter(exec_list_iterator, sigiter, *f) { - ir_function_signature *sig = - (ir_function_signature *) sigiter.get(); + foreach_list(signode, &f->signatures) { + ir_function_signature *sig = (ir_function_signature *) signode; /* The setting of the uniform_locations_assigned flag here is * irrelevent. If there is a uniform declaration encountered * inside the body of the function, something has already gone diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 43a01662a35..66522b9c766 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -280,8 +280,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) printf("add %s\n", var->name); printf("current entries\n"); - foreach_iter(exec_list_iterator, iter, *assignments) { - assignment_entry *entry = (assignment_entry *)iter.get(); + foreach_list(n, assignments) { + assignment_entry *entry = (assignment_entry *) n; printf(" %s (0x%01x)\n", entry->lhs->name, entry->available); } diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp index cd3b2c12e89..2896072abca 100644 --- a/src/glsl/opt_dead_functions.cpp +++ b/src/glsl/opt_dead_functions.cpp @@ -74,8 +74,8 @@ public: signature_entry * ir_dead_functions_visitor::get_signature_entry(ir_function_signature *sig) { - foreach_iter(exec_list_iterator, iter, this->signature_list) { - signature_entry *entry = (signature_entry *)iter.get(); + foreach_list(n, &this->signature_list) { + signature_entry *entry = (signature_entry *) n; if (entry->signature == sig) return entry; } diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp index c8f42a4245a..95c3f70d452 100644 --- a/src/glsl/opt_function_inlining.cpp +++ b/src/glsl/opt_function_inlining.cpp @@ -107,7 +107,7 @@ ir_call::generate_inline(ir_instruction *next_ir) ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); num_parameters = 0; - foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters) + foreach_list(n, &this->callee->parameters) num_parameters++; parameters = new ir_variable *[num_parameters]; @@ -161,8 +161,8 @@ ir_call::generate_inline(ir_instruction *next_ir) exec_list new_instructions; /* Generate the inlined body of the function to a new list */ - foreach_iter(exec_list_iterator, iter, callee->body) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(n, &callee->body) { + ir_instruction *ir = (ir_instruction *) n; ir_instruction *new_ir = ir->clone(ctx, ht); new_instructions.push_tail(new_ir); diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp index 414f0000db5..b668dc21c04 100644 --- a/src/glsl/opt_structure_splitting.cpp +++ b/src/glsl/opt_structure_splitting.cpp @@ -107,8 +107,8 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var) || var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out) return NULL; - foreach_iter(exec_list_iterator, iter, this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list(n, &this->variable_list) { + variable_entry *entry = (variable_entry *) n; if (entry->var == var) return entry; } @@ -209,8 +209,8 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) if (!var->type->is_record()) return NULL; - foreach_iter(exec_list_iterator, iter, *this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + foreach_list(n, this->variable_list) { + variable_entry *entry = (variable_entry *) n; if (entry->var == var) { return entry; } diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp index 1bdf6bca61f..6906ff0eb67 100644 --- a/src/glsl/s_expression.cpp +++ b/src/glsl/s_expression.cpp @@ -162,8 +162,8 @@ void s_symbol::print() void s_list::print() { printf("("); - foreach_iter(exec_list_iterator, it, this->subexpressions) { - s_expression *expr = (s_expression*) it.get(); + foreach_list(n, &this->subexpressions) { + s_expression *expr = (s_expression *) n; expr->print(); if (!expr->next->is_tail_sentinel()) printf(" "); @@ -201,11 +201,11 @@ s_match(s_expression *top, unsigned n, s_pattern *pattern, bool partial) return false; unsigned i = 0; - foreach_iter(exec_list_iterator, it, list->subexpressions) { + foreach_list(node, &list->subexpressions) { if (i >= n) return partial; /* More actual items than the pattern expected */ - s_expression *expr = (s_expression *) it.get(); + s_expression *expr = (s_expression *) node; if (expr == NULL || !pattern[i].match(expr)) return false; |