* 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);
{
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));
}
*/
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()) {
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;
* 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);
}
{
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));
}
{
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));
}
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));
}
{
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);
}
* 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))
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))
}
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");
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);
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);
{
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");
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);
}
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);
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);
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);
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.
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
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;
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");
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;
// 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);
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);
}
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;
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);
}
}
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)
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;
}
{
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;
}
/* 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;
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;
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));
}
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);
}
}
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);
}
/* 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;
{
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;
}
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;
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));
}
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);
}
}
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);
}
/* 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++) {
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));
}
{
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
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);
}
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;
}
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];
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);
|| 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;
}
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;
}
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(" ");
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;
virtual_grf_used[i] = false;
}
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- vec4_instruction *inst = (vec4_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ vec4_instruction *inst = (vec4_instruction *) node;
if (inst->dst.file == GRF)
virtual_grf_used[inst->dst.reg] = true;
}
prog_data->total_grf = next;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- vec4_instruction *inst = (vec4_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ vec4_instruction *inst = (vec4_instruction *) node;
assign(hw_reg_mapping, &inst->dst);
assign(hw_reg_mapping, &inst->src[0]);
variable_storage *entry;
- foreach_iter(exec_list_iterator, iter, this->variables) {
- entry = (variable_storage *)iter.get();
+ foreach_list(node, &this->variables) {
+ entry = (variable_storage *) node;
if (entry->var == var)
return entry;
assert(sig);
- foreach_iter(exec_list_iterator, iter, sig->body) {
- ir_instruction *ir = (ir_instruction *)iter.get();
+ foreach_list(node, &sig->body) {
+ ir_instruction *ir = (ir_instruction *) node;
ir->accept(this);
}
src_reg temp_base = get_temp(ir->type);
dst_reg temp = dst_reg(temp_base);
- foreach_iter(exec_list_iterator, iter, ir->components) {
- ir_constant *field_value = (ir_constant *)iter.get();
+ foreach_list(node, &ir->components) {
+ ir_constant *field_value = (ir_constant *) node;
int size = type_size(field_value->type);
assert(size > 0);
mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i;
break;
case OPCODE_CAL:
- foreach_iter(exec_list_iterator, iter, v->function_signatures) {
- function_entry *entry = (function_entry *)iter.get();
+ foreach_list(n, &v->function_signatures) {
+ function_entry *entry = (function_entry *) n;
if (entry->sig_id == mesa_instructions[i].BranchTarget) {
mesa_instructions[i].BranchTarget = entry->inst;
int *acp_level = rzalloc_array(mem_ctx, int, this->next_temp * 4);
int level = 0;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *) node;
assert(inst->dst.file != PROGRAM_TEMPORARY
|| inst->dst.index < this->next_temp);
prog->NumTemporaries = v.next_temp;
int num_instructions = 0;
- foreach_iter(exec_list_iterator, iter, v.instructions) {
+ foreach_list(node, &v.instructions) {
num_instructions++;
}
*/
mesa_inst = mesa_instructions;
i = 0;
- foreach_iter(exec_list_iterator, iter, v.instructions) {
- const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
+ foreach_list(node, &v.instructions) {
+ const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *) node;
mesa_inst->Opcode = inst->op;
mesa_inst->CondUpdate = inst->cond_update;
/* Search immediate storage to see if we already have an identical
* immediate that we can use instead of adding a duplicate entry.
*/
- foreach_iter(exec_list_iterator, iter, this->immediates) {
- entry = (immediate_storage *)iter.get();
+ foreach_list(node, &this->immediates) {
+ entry = (immediate_storage *) node;
if (entry->size == size &&
entry->type == datatype &&
variable_storage *entry;
- foreach_iter(exec_list_iterator, iter, this->variables) {
- entry = (variable_storage *)iter.get();
+ foreach_list(node, &this->variables) {
+ entry = (variable_storage *) node;
if (entry->var == var)
return entry;
assert(sig);
- foreach_iter(exec_list_iterator, iter, sig->body) {
- ir_instruction *ir = (ir_instruction *)iter.get();
+ foreach_list(node, &sig->body) {
+ ir_instruction *ir = (ir_instruction *) node;
ir->accept(this);
}
st_src_reg temp_base = get_temp(ir->type);
st_dst_reg temp = st_dst_reg(temp_base);
- foreach_iter(exec_list_iterator, iter, ir->components) {
- ir_constant *field_value = (ir_constant *)iter.get();
+ foreach_list(node, &ir->components) {
+ ir_constant *field_value = (ir_constant *) node;
int size = type_size(field_value->type);
assert(size > 0);
{
function_entry *entry;
- foreach_iter(exec_list_iterator, iter, this->function_signatures) {
- entry = (function_entry *)iter.get();
+ foreach_list(node, &this->function_signatures) {
+ entry = (function_entry *) node;
if (entry->sig == sig)
return entry;
entry->bgn_inst = NULL;
/* Allocate storage for all the parameters. */
- foreach_iter(exec_list_iterator, iter, sig->parameters) {
- ir_variable *param = (ir_variable *)iter.get();
+ foreach_list(node, &sig->parameters) {
+ ir_variable *param = (ir_variable *) node;
variable_storage *storage;
storage = find_variable_storage(param);
{
v->samplers_used = 0;
- foreach_iter(exec_list_iterator, iter, v->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &v->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
if (is_tex_instruction(inst->op)) {
v->samplers_used |= 1 << inst->sampler;
memset(tempWrites, 0, sizeof(unsigned) * MAX_TEMPS);
memset(outputWrites, 0, sizeof(outputWrites));
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
unsigned prevWriteMask = 0;
/* Give up if we encounter relative addressing or flow control. */
void
glsl_to_tgsi_visitor::rename_temp_register(int index, int new_index)
{
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
unsigned j;
for (j=0; j < num_inst_src_regs(inst->op); j++) {
int loop_start = -1; /* index of the first active BGNLOOP (if any) */
unsigned i = 0, j;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
for (j=0; j < num_inst_src_regs(inst->op); j++) {
if (inst->src[j].file == PROGRAM_TEMPORARY &&
int loop_start = -1; /* index of the first active BGNLOOP (if any) */
int i = 0;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
if (inst->dst.file == PROGRAM_TEMPORARY && inst->dst.index == index) {
return (depth == 0) ? i : loop_start;
int last = -1; /* index of last instruction that reads the temporary */
unsigned i = 0, j;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
for (j=0; j < num_inst_src_regs(inst->op); j++) {
if (inst->src[j].file == PROGRAM_TEMPORARY &&
int last = -1; /* index of last instruction that writes to the temporary */
int i = 0;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
if (inst->dst.file == PROGRAM_TEMPORARY && inst->dst.index == index)
last = (depth == 0) ? i : -2;
int *acp_level = rzalloc_array(mem_ctx, int, this->next_temp * 4);
int level = 0;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
assert(inst->dst.file != PROGRAM_TEMPORARY
|| inst->dst.index < this->next_temp);
int level = 0;
int removed = 0;
- foreach_iter(exec_list_iterator, iter, this->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &this->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
assert(inst->dst.file != PROGRAM_TEMPORARY
|| inst->dst.index < this->next_temp);
/* Now copy the instructions from the original glsl_to_tgsi_visitor into the
* new visitor. */
- foreach_iter(exec_list_iterator, iter, original->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &original->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
glsl_to_tgsi_instruction *newinst;
st_src_reg src_regs[3];
/* Now copy the instructions from the original glsl_to_tgsi_visitor into the
* new visitor. */
- foreach_iter(exec_list_iterator, iter, original->instructions) {
- glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get();
+ foreach_list(node, &original->instructions) {
+ glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *) node;
glsl_to_tgsi_instruction *newinst;
st_src_reg src_regs[3];
goto out;
}
i = 0;
- foreach_iter(exec_list_iterator, iter, program->immediates) {
- immediate_storage *imm = (immediate_storage *)iter.get();
+ foreach_list(node, &program->immediates) {
+ immediate_storage *imm = (immediate_storage *) node;
assert(i < program->num_immediates);
t->immediates[i++] = emit_immediate(t, imm->values, imm->type, imm->size);
}
/* Emit each instruction in turn:
*/
- foreach_iter(exec_list_iterator, iter, program->instructions) {
+ foreach_list(n, &program->instructions) {
set_insn_start(t, ureg_get_instruction_number(ureg));
- compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *)iter.get(),
- clamp_color);
+ compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *) n, clamp_color);
}
/* Fix up all emitted labels:
do {
progress = GL_FALSE;
- foreach_iter(exec_list_iterator, iter, v->function_signatures) {
- function_entry *entry = (function_entry *)iter.get();
+ foreach_list(node, &v->function_signatures) {
+ function_entry *entry = (function_entry *) node;
if (!entry->bgn_inst) {
v->current_function = entry;