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);
}
}
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);
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) {
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) {
}
/* 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",
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;
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();
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()) {
/* 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);
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;
*/
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)
* 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();
/* 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()) {
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);
* 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);
}
}
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",
/* 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);