diff options
author | Jason Ekstrand <[email protected]> | 2016-04-26 18:34:19 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-04-28 15:54:48 -0700 |
commit | 707e72f13bb78869ee95d3286980bf1709cba6cf (patch) | |
tree | 351ee47ca2ac2b54fb7ef0e8effa65a6e81b2c80 /src/compiler | |
parent | 261d62de33b6192ec31f034a9897d034a37fa582 (diff) |
nir: Switch the arguments to nir_foreach_instr
This matches the "foreach x in container" pattern found in many other
programming languages. Generated by the following regular expression:
s/nir_foreach_instr(\([^,]*\),\s*\([^,]*\))/nir_foreach_instr(\2, \1)/
and similar expressions for nir_foreach_instr_safe etc.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler')
50 files changed, 82 insertions, 82 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index bf8ddedc5b8..37a15cf5bc5 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1708,7 +1708,7 @@ nir_index_ssa_defs(nir_function_impl *impl) unsigned index = 0; nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) nir_foreach_ssa_def(instr, index_ssa_def_cb, &index); } @@ -1725,7 +1725,7 @@ nir_index_instrs(nir_function_impl *impl) unsigned index = 0; nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) instr->index = index++; } diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index e8899640d23..604eb4e11fe 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1434,13 +1434,13 @@ nir_block_last_instr(nir_block *block) return exec_node_data(nir_instr, tail, node); } -#define nir_foreach_instr(block, instr) \ +#define nir_foreach_instr(instr, block) \ foreach_list_typed(nir_instr, instr, node, &(block)->instr_list) -#define nir_foreach_instr_reverse(block, instr) \ +#define nir_foreach_instr_reverse(instr, block) \ foreach_list_typed_reverse(nir_instr, instr, node, &(block)->instr_list) -#define nir_foreach_instr_safe(block, instr) \ +#define nir_foreach_instr_safe(instr, block) \ foreach_list_typed_safe(nir_instr, instr, node, &(block)->instr_list) -#define nir_foreach_instr_reverse_safe(block, instr) \ +#define nir_foreach_instr_reverse_safe(instr, block) \ foreach_list_typed_reverse_safe(nir_instr, instr, node, &(block)->instr_list) typedef struct nir_if { @@ -2018,7 +2018,7 @@ nir_after_cf_node_and_phis(nir_cf_node *node) nir_block *block = nir_cf_node_as_block(nir_cf_node_next(node)); assert(block->cf_node.type == nir_cf_node_block); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_phi) return nir_before_instr(instr); } diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 4388c5f21f9..e61f5d2184e 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -524,7 +524,7 @@ ${pass_name}_block(nir_block *block, const bool *condition_flags, { bool progress = false; - nir_foreach_instr_reverse_safe(block, instr) { + nir_foreach_instr_reverse_safe(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index e231387c889..18272235564 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -523,7 +523,7 @@ clone_block(clone_state *state, struct exec_list *cf_list, const nir_block *blk) /* We need this for phi sources */ add_remap(state, nblk, blk); - nir_foreach_instr(blk, instr) { + nir_foreach_instr(instr, blk) { if (instr->type == nir_instr_type_phi) { /* Phi instructions are a bit of a special case when cloning because * we don't want inserting the instruction to automatically handle diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c index ea5741288ce..64d9a86cde7 100644 --- a/src/compiler/nir/nir_control_flow.c +++ b/src/compiler/nir/nir_control_flow.c @@ -241,7 +241,7 @@ split_block_beginning(nir_block *block) * sourcse will be messed up. This will reverse the order of the phi's, but * order shouldn't matter. */ - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -256,7 +256,7 @@ split_block_beginning(nir_block *block) static void rewrite_phi_preds(nir_block *block, nir_block *old_pred, nir_block *new_pred) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -274,7 +274,7 @@ static void insert_phi_undef(nir_block *block, nir_block *pred) { nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -404,7 +404,7 @@ split_block_before_instr(nir_instr *instr) assert(instr->type != nir_instr_type_phi); nir_block *new_block = split_block_beginning(instr->block); - nir_foreach_instr_safe(instr->block, cur_instr) { + nir_foreach_instr_safe(cur_instr, instr->block) { if (cur_instr == instr) break; @@ -537,7 +537,7 @@ nir_handle_add_jump(nir_block *block) static void remove_phi_src(nir_block *block, nir_block *pred) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -706,7 +706,7 @@ cleanup_cf_node(nir_cf_node *node, nir_function_impl *impl) case nir_cf_node_block: { nir_block *block = nir_cf_node_as_block(node); /* We need to walk the instructions and clean up defs/uses */ - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_jump) { nir_jump_type jump_type = nir_instr_as_jump(instr)->type; unlink_jump(block, jump_type, false); diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 6d92130b859..947ebe1ccb7 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -305,7 +305,7 @@ static bool isolate_phi_nodes_block(nir_block *block, void *dead_ctx) { nir_instr *last_phi_instr = NULL; - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { /* Phi nodes only ever come at the start of a block */ if (instr->type != nir_instr_type_phi) break; @@ -324,7 +324,7 @@ isolate_phi_nodes_block(nir_block *block, void *dead_ctx) nir_parallel_copy_instr_create(dead_ctx); nir_instr_insert_after(last_phi_instr, &block_pcopy->instr); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { /* Phi nodes only ever come at the start of a block */ if (instr->type != nir_instr_type_phi) break; @@ -370,7 +370,7 @@ isolate_phi_nodes_block(nir_block *block, void *dead_ctx) static bool coalesce_phi_nodes_block(nir_block *block, struct from_ssa_state *state) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { /* Phi nodes only ever come at the start of a block */ if (instr->type != nir_instr_type_phi) break; @@ -424,7 +424,7 @@ static bool aggressive_coalesce_block(nir_block *block, struct from_ssa_state *state) { nir_parallel_copy_instr *start_pcopy = NULL; - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { /* Phi nodes only ever come at the start of a block */ if (instr->type != nir_instr_type_phi) { if (instr->type != nir_instr_type_parallel_copy) @@ -520,7 +520,7 @@ rewrite_ssa_def(nir_ssa_def *def, void *void_state) static bool resolve_registers_block(nir_block *block, struct from_ssa_state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { state->instr = instr; nir_foreach_ssa_def(instr, rewrite_ssa_def, state); diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 14da78d8cf7..180ceccff2a 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -71,7 +71,7 @@ gather_tex_info(nir_tex_instr *instr, nir_shader *shader) static bool gather_info_block(nir_block *block, void *shader) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { switch (instr->type) { case nir_instr_type_intrinsic: gather_intrinsic_info(nir_instr_as_intrinsic(instr), shader); diff --git a/src/compiler/nir/nir_gs_count_vertices.c b/src/compiler/nir/nir_gs_count_vertices.c index 3c1bd2a59bd..9e7c4a11c12 100644 --- a/src/compiler/nir/nir_gs_count_vertices.c +++ b/src/compiler/nir/nir_gs_count_vertices.c @@ -66,7 +66,7 @@ nir_gs_count_vertices(const nir_shader *shader) set_foreach(function->impl->end_block->predecessors, entry) { nir_block *block = (nir_block *) entry->key; - nir_foreach_instr_reverse(block, instr) { + nir_foreach_instr_reverse(instr, block) { nir_intrinsic_instr *intrin = as_set_vertex_count(instr); if (!intrin) continue; diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index a639814140c..c56dc3c09c7 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -30,7 +30,7 @@ static bool inline_function_impl(nir_function_impl *impl, struct set *inlined); static bool rewrite_param_derefs_block(nir_block *block, nir_call_instr *call) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -89,7 +89,7 @@ lower_param_to_local(nir_variable *param, nir_function_impl *impl, bool write) static bool lower_params_to_locals_block(nir_block *block, nir_function_impl *impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -135,7 +135,7 @@ inline_functions_block(nir_block *block, nir_builder *b, * properly get moved to the next block when it gets split, and we * continue iterating there. */ - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_call) continue; diff --git a/src/compiler/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c index 67913ca86c0..69c6fd93b58 100644 --- a/src/compiler/nir/nir_liveness.c +++ b/src/compiler/nir/nir_liveness.c @@ -124,7 +124,7 @@ propagate_across_edge(nir_block *pred, nir_block *succ, NIR_VLA(BITSET_WORD, live, state->bitset_words); memcpy(live, succ->live_in, state->bitset_words * sizeof *live); - nir_foreach_instr(succ, instr) { + nir_foreach_instr(instr, succ) { if (instr->type != nir_instr_type_phi) break; nir_phi_instr *phi = nir_instr_as_phi(instr); @@ -133,7 +133,7 @@ propagate_across_edge(nir_block *pred, nir_block *succ, set_ssa_def_dead(&phi->dest.ssa, live); } - nir_foreach_instr(succ, instr) { + nir_foreach_instr(instr, succ) { if (instr->type != nir_instr_type_phi) break; nir_phi_instr *phi = nir_instr_as_phi(instr); @@ -165,7 +165,7 @@ nir_live_ssa_defs_impl(nir_function_impl *impl) */ state.num_ssa_defs = 1; nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) nir_foreach_ssa_def(instr, index_ssa_def, &state); } @@ -201,7 +201,7 @@ nir_live_ssa_defs_impl(nir_function_impl *impl) if (following_if) set_src_live(&following_if->condition, block->live_in); - nir_foreach_instr_reverse(block, instr) { + nir_foreach_instr_reverse(instr, block) { /* Phi nodes are handled seperately so we want to skip them. Since * we are going backwards and they are at the beginning, we can just * break as soon as we see one. diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c b/src/compiler/nir/nir_lower_alu_to_scalar.c index a5fc73495b7..ddf5eb5c1cb 100644 --- a/src/compiler/nir/nir_lower_alu_to_scalar.c +++ b/src/compiler/nir/nir_lower_alu_to_scalar.c @@ -247,7 +247,7 @@ nir_lower_alu_to_scalar_impl(nir_function_impl *impl) nir_builder_init(&builder, impl); nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_alu) lower_alu_instr_scalar(nir_instr_as_alu(instr), &builder); } diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index f00cef785fd..1e2d65b9801 100644 --- a/src/compiler/nir/nir_lower_atomics.c +++ b/src/compiler/nir/nir_lower_atomics.c @@ -140,7 +140,7 @@ nir_lower_atomics(nir_shader *shader, nir_foreach_function(shader, function) { if (function->impl) { nir_foreach_block(block, function->impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) lower_instr(nir_instr_as_intrinsic(instr), shader_program, shader); diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index 5d949de1c45..25ded166c6b 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -100,7 +100,7 @@ load_clipdist_input(nir_builder *b, nir_variable *in, nir_ssa_def **val) static nir_ssa_def * find_output_in_block(nir_block *block, unsigned drvloc) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_intrinsic) { nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); diff --git a/src/compiler/nir/nir_lower_double_ops.c b/src/compiler/nir/nir_lower_double_ops.c index 7505fa394bf..75032a6f766 100644 --- a/src/compiler/nir/nir_lower_double_ops.c +++ b/src/compiler/nir/nir_lower_double_ops.c @@ -538,7 +538,7 @@ lower_doubles_block(nir_block *block, void *ctx) { nir_lower_doubles_options options = *((nir_lower_doubles_options *) ctx); - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_lower_double_packing.c b/src/compiler/nir/nir_lower_double_packing.c index 4018d0bf216..c34c267c0f8 100644 --- a/src/compiler/nir/nir_lower_double_packing.c +++ b/src/compiler/nir/nir_lower_double_packing.c @@ -51,7 +51,7 @@ lower_double_pack_block(nir_block *block, void *ctx) { nir_builder *b = (nir_builder *) ctx; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c index e49e67adcb1..e118e04b564 100644 --- a/src/compiler/nir/nir_lower_global_vars_to_local.c +++ b/src/compiler/nir/nir_lower_global_vars_to_local.c @@ -36,7 +36,7 @@ static bool mark_global_var_uses_block(nir_block *block, nir_function_impl *impl, struct hash_table *var_func_table) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c index 406d7f0b5dc..293aeac8c03 100644 --- a/src/compiler/nir/nir_lower_gs_intrinsics.c +++ b/src/compiler/nir/nir_lower_gs_intrinsics.c @@ -133,7 +133,7 @@ rewrite_end_primitive(nir_intrinsic_instr *intrin, struct state *state) static bool rewrite_intrinsics(nir_block *block, struct state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_idiv.c b/src/compiler/nir/nir_lower_idiv.c index f5dafa72137..83e265b7d0d 100644 --- a/src/compiler/nir/nir_lower_idiv.c +++ b/src/compiler/nir/nir_lower_idiv.c @@ -124,7 +124,7 @@ convert_impl(nir_function_impl *impl) nir_builder_init(&b, impl); nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_alu) convert_instr(&b, nir_instr_as_alu(instr)); } diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c index 9045adc1c6f..5c2aac326f8 100644 --- a/src/compiler/nir/nir_lower_indirect_derefs.c +++ b/src/compiler/nir/nir_lower_indirect_derefs.c @@ -165,7 +165,7 @@ lower_indirect_block(nir_block *block, nir_builder *b, { bool progress = false; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index e0ba9347bfe..1c1ad5100a9 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -216,7 +216,7 @@ nir_lower_io_block(nir_block *block, { nir_builder *b = &state->builder; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_load_const_to_scalar.c b/src/compiler/nir/nir_lower_load_const_to_scalar.c index 06cdd5abd55..4857902f6ab 100644 --- a/src/compiler/nir/nir_lower_load_const_to_scalar.c +++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c @@ -71,7 +71,7 @@ static void nir_lower_load_const_to_scalar_impl(nir_function_impl *impl) { nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_load_const) lower_load_const_instr_scalar(nir_instr_as_load_const(instr)); } diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c index 3465d54224d..f1ad1712552 100644 --- a/src/compiler/nir/nir_lower_locals_to_regs.c +++ b/src/compiler/nir/nir_lower_locals_to_regs.c @@ -204,7 +204,7 @@ static bool lower_locals_to_regs_block(nir_block *block, struct locals_to_regs_state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_outputs_to_temporaries.c b/src/compiler/nir/nir_lower_outputs_to_temporaries.c index c189947efae..01031f20adc 100644 --- a/src/compiler/nir/nir_lower_outputs_to_temporaries.c +++ b/src/compiler/nir/nir_lower_outputs_to_temporaries.c @@ -61,7 +61,7 @@ emit_output_copies(nir_cursor cursor, struct lower_outputs_state *state) static bool emit_output_copies_block(nir_block *block, void *state) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c index f6c0d1cb64d..a1a679bfcc2 100644 --- a/src/compiler/nir/nir_lower_phis_to_scalar.c +++ b/src/compiler/nir/nir_lower_phis_to_scalar.c @@ -168,7 +168,7 @@ lower_phis_to_scalar_block(nir_block *block, { /* Find the last phi node in the block */ nir_phi_instr *last_phi = NULL; - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -178,7 +178,7 @@ lower_phis_to_scalar_block(nir_block *block, /* We have to handle the phi nodes in their own pass due to the way * we're modifying the linked list of instructions. */ - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_phi) break; diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/nir/nir_lower_samplers.c index 9bff20b3a83..43a97236c1b 100644 --- a/src/compiler/nir/nir_lower_samplers.c +++ b/src/compiler/nir/nir_lower_samplers.c @@ -160,7 +160,7 @@ lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_progr nir_builder_init(&b, impl); nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_tex) lower_sampler(nir_instr_as_tex(instr), shader_program, stage, &b); } diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index ba8b4032f6b..0eee89590ec 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -33,7 +33,7 @@ convert_block(nir_block *block, nir_builder *b) { bool progress = false; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index ac2f92c32f2..2ab5d1c065a 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -321,7 +321,7 @@ nir_lower_tex_block(nir_block *block, void *void_state) const nir_lower_tex_options *options = state->options; nir_builder *b = &state->b; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_tex) continue; diff --git a/src/compiler/nir/nir_lower_to_source_mods.c b/src/compiler/nir/nir_lower_to_source_mods.c index b641908eb45..6fe8465675d 100644 --- a/src/compiler/nir/nir_lower_to_source_mods.c +++ b/src/compiler/nir/nir_lower_to_source_mods.c @@ -36,7 +36,7 @@ static bool nir_lower_to_source_mods_block(nir_block *block) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_lower_two_sided_color.c b/src/compiler/nir/nir_lower_two_sided_color.c index 04b058c15b7..ba3a4484f0f 100644 --- a/src/compiler/nir/nir_lower_two_sided_color.c +++ b/src/compiler/nir/nir_lower_two_sided_color.c @@ -138,7 +138,7 @@ nir_lower_two_sided_color_block(nir_block *block, void *void_state) lower_2side_state *state = void_state; nir_builder *b = &state->b; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c index d0d6452d803..3fe1c839783 100644 --- a/src/compiler/nir/nir_lower_var_copies.c +++ b/src/compiler/nir/nir_lower_var_copies.c @@ -160,7 +160,7 @@ lower_var_copies_impl(nir_function_impl *impl) void *mem_ctx = ralloc_parent(impl); nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 66e0edbc371..00ed56ec7bb 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -407,7 +407,7 @@ static bool register_variable_uses_block(nir_block *block, struct lower_variables_state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -484,7 +484,7 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state) nir_builder b; nir_builder_init(&b, state->impl); - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c index 0ba374937e8..002ebf3ba2a 100644 --- a/src/compiler/nir/nir_lower_vec_to_movs.c +++ b/src/compiler/nir/nir_lower_vec_to_movs.c @@ -215,7 +215,7 @@ lower_vec_to_movs_block(nir_block *block, nir_function_impl *impl) bool progress = false; nir_shader *shader = impl->function->shader; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_move_vec_src_uses_to_dest.c b/src/compiler/nir/nir_move_vec_src_uses_to_dest.c index a437fe88d07..8edf0913611 100644 --- a/src/compiler/nir/nir_move_vec_src_uses_to_dest.c +++ b/src/compiler/nir/nir_move_vec_src_uses_to_dest.c @@ -64,7 +64,7 @@ ssa_def_dominates_instr(nir_ssa_def *def, nir_instr *instr) static bool move_vec_src_uses_to_dest_block(nir_block *block) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_alu) continue; diff --git a/src/compiler/nir/nir_normalize_cubemap_coords.c b/src/compiler/nir/nir_normalize_cubemap_coords.c index ab17467fbb1..002b9cf13d9 100644 --- a/src/compiler/nir/nir_normalize_cubemap_coords.c +++ b/src/compiler/nir/nir_normalize_cubemap_coords.c @@ -38,7 +38,7 @@ normalize_cubemap_coords_block(nir_block *block, nir_builder *b) { bool progress = false; - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_tex) continue; diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index a3adaecdd96..b10bb234fd3 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -177,7 +177,7 @@ constant_fold_block(nir_block *block, void *mem_ctx) { bool progress = false; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { switch (instr->type) { case nir_instr_type_alu: progress |= constant_fold_alu_instr(nir_instr_as_alu(instr), mem_ctx); diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c index 99aebae6867..6e880778152 100644 --- a/src/compiler/nir/nir_opt_copy_propagate.c +++ b/src/compiler/nir/nir_opt_copy_propagate.c @@ -246,7 +246,7 @@ nir_copy_prop_impl(nir_function_impl *impl) bool progress = false; nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (copy_prop_instr(instr)) progress = true; } diff --git a/src/compiler/nir/nir_opt_cse.c b/src/compiler/nir/nir_opt_cse.c index 364fb023dce..109b62906ed 100644 --- a/src/compiler/nir/nir_opt_cse.c +++ b/src/compiler/nir/nir_opt_cse.c @@ -43,7 +43,7 @@ cse_block(nir_block *block, struct set *instr_set) { bool progress = false; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (nir_instr_set_add_or_rewrite(instr_set, instr)) { progress = true; nir_instr_remove(instr); @@ -55,7 +55,7 @@ cse_block(nir_block *block, struct set *instr_set) progress |= cse_block(child, instr_set); } - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) nir_instr_set_remove(instr_set, instr); return progress; diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c index d94f4be28e0..f7dd7be950d 100644 --- a/src/compiler/nir/nir_opt_dce.c +++ b/src/compiler/nir/nir_opt_dce.c @@ -115,7 +115,7 @@ init_instr(nir_instr *instr, struct exec_list *worklist) static bool init_block(nir_block *block, struct exec_list *worklist) { - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) init_instr(instr, worklist); nir_if *following_if = nir_block_get_following_if(block); @@ -148,7 +148,7 @@ nir_opt_dce_impl(nir_function_impl *impl) bool progress = false; nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (!instr->pass_flags) { nir_instr_remove(instr); progress = true; diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index a8506b7d36a..ca73e50061b 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -91,7 +91,7 @@ opt_constant_if(nir_if *if_stmt, bool condition) nir_cf_node_as_block(condition ? nir_if_last_then_node(if_stmt) : nir_if_last_else_node(if_stmt)); - nir_foreach_instr_safe(after, instr) { + nir_foreach_instr_safe(instr, after) { if (instr->type != nir_instr_type_phi) break; @@ -138,7 +138,7 @@ static bool cf_node_has_side_effects(nir_cf_node *node) { nir_foreach_block_in_cf_node(block, node) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_call) return true; @@ -207,7 +207,7 @@ loop_is_dead(nir_loop *loop) nir_metadata_dominance); for (nir_block *cur = after->imm_dom; cur != before; cur = cur->imm_dom) { - nir_foreach_instr(cur, instr) { + nir_foreach_instr(instr, cur) { if (!nir_foreach_ssa_def(instr, def_not_live_out, after)) return false; } diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index 33278d8b1fc..d79235d1719 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -107,7 +107,7 @@ gcm_build_block_info(struct exec_list *cf_list, struct gcm_state *state, static bool gcm_pin_instructions_block(nir_block *block, struct gcm_state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { switch (instr->type) { case nir_instr_type_alu: switch (nir_instr_as_alu(instr)->op) { diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index d783f7b6195..b31cc35ba71 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -50,7 +50,7 @@ static bool block_check_for_allowed_instrs(nir_block *block) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { switch (instr->type) { case nir_instr_type_intrinsic: { nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); @@ -171,19 +171,19 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx) * block before. We have already guaranteed that this is safe by * calling block_check_for_allowed_instrs() */ - nir_foreach_instr_safe(then_block, instr) { + nir_foreach_instr_safe(instr, then_block) { exec_node_remove(&instr->node); instr->block = prev_block; exec_list_push_tail(&prev_block->instr_list, &instr->node); } - nir_foreach_instr_safe(else_block, instr) { + nir_foreach_instr_safe(instr, else_block) { exec_node_remove(&instr->node); instr->block = prev_block; exec_list_push_tail(&prev_block->instr_list, &instr->node); } - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_phi) break; diff --git a/src/compiler/nir/nir_opt_remove_phis.c b/src/compiler/nir/nir_opt_remove_phis.c index 0625297507b..5234c0f667a 100644 --- a/src/compiler/nir/nir_opt_remove_phis.c +++ b/src/compiler/nir/nir_opt_remove_phis.c @@ -47,7 +47,7 @@ remove_phis_block(nir_block *block) { bool progress = false; - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_phi) break; diff --git a/src/compiler/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c index 87c23b3c63f..f4c41c19c06 100644 --- a/src/compiler/nir/nir_opt_undef.c +++ b/src/compiler/nir/nir_opt_undef.c @@ -79,7 +79,7 @@ nir_opt_undef(nir_shader *shader) nir_foreach_function(shader, function) { if (function->impl) { nir_foreach_block(block, function->impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_alu) if (opt_undef_alu(nir_instr_as_alu(instr))) progress = true; diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 229539d44ee..76effa99e8c 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -908,7 +908,7 @@ print_block(nir_block *block, print_state *state, unsigned tabs) free(preds); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { print_instr(instr, state, tabs); fprintf(fp, "\n"); } diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index c48fa40c07f..1f3561d8a14 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -71,7 +71,7 @@ add_var_use_shader(nir_shader *shader, struct set *live) nir_foreach_function(shader, function) { if (function->impl) { nir_foreach_block(block, function->impl) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { switch(instr->type) { case nir_instr_type_intrinsic: add_var_use_intrinsic(nir_instr_as_intrinsic(instr), live); diff --git a/src/compiler/nir/nir_repair_ssa.c b/src/compiler/nir/nir_repair_ssa.c index ac0bce1fb4d..7dd4065e427 100644 --- a/src/compiler/nir/nir_repair_ssa.c +++ b/src/compiler/nir/nir_repair_ssa.c @@ -114,7 +114,7 @@ nir_repair_ssa_impl(nir_function_impl *impl) nir_metadata_dominance); nir_foreach_block(block, impl) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { nir_foreach_ssa_def(instr, repair_ssa_def, &state); } } diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c index da82e7cf6a2..8ac65bf0008 100644 --- a/src/compiler/nir/nir_split_var_copies.c +++ b/src/compiler/nir/nir_split_var_copies.c @@ -208,7 +208,7 @@ split_var_copy_instr(nir_intrinsic_instr *old_copy, static bool split_var_copies_block(nir_block *block, struct split_var_copies_state *state) { - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c index b22f0f56569..0f1debce3ad 100644 --- a/src/compiler/nir/nir_sweep.c +++ b/src/compiler/nir/nir_sweep.c @@ -63,7 +63,7 @@ sweep_block(nir_shader *nir, nir_block *block) { ralloc_steal(nir, block); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { ralloc_steal(nir, instr); nir_foreach_src(instr, sweep_src_indirect, nir); diff --git a/src/compiler/nir/nir_to_ssa.c b/src/compiler/nir/nir_to_ssa.c index 1a772fff2d5..766849192ff 100644 --- a/src/compiler/nir/nir_to_ssa.c +++ b/src/compiler/nir/nir_to_ssa.c @@ -381,7 +381,7 @@ rewrite_instr_forward(nir_instr *instr, rewrite_state *state) static void rewrite_phi_sources(nir_block *block, nir_block *pred, rewrite_state *state) { - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type != nir_instr_type_phi) break; @@ -434,7 +434,7 @@ rewrite_block(nir_block *block, rewrite_state *state) * what we want because those instructions (vector gather, conditional * select) will already be in SSA form. */ - nir_foreach_instr_safe(block, instr) { + nir_foreach_instr_safe(instr, block) { rewrite_instr_forward(instr, state); } @@ -455,7 +455,7 @@ rewrite_block(nir_block *block, rewrite_state *state) for (unsigned i = 0; i < block->num_dom_children; i++) rewrite_block(block->dom_children[i], state); - nir_foreach_instr_reverse(block, instr) { + nir_foreach_instr_reverse(instr, block) { rewrite_instr_backwards(instr, state); } } diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index c7cef6a8095..10a78323550 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -606,7 +606,7 @@ validate_phi_src(nir_phi_instr *instr, nir_block *pred, validate_state *state) static void validate_phi_srcs(nir_block *block, nir_block *succ, validate_state *state) { - nir_foreach_instr(succ, instr) { + nir_foreach_instr(instr, succ) { if (instr->type != nir_instr_type_phi) break; @@ -624,7 +624,7 @@ validate_block(nir_block *block, validate_state *state) state->block = block; exec_list_validate(&block->instr_list); - nir_foreach_instr(block, instr) { + nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_phi) { assert(instr == nir_block_first_instr(block) || nir_instr_prev(instr)->type == nir_instr_type_phi); @@ -1017,7 +1017,7 @@ validate_function_impl(nir_function_impl *impl, validate_state *state) } nir_foreach_block(block, impl) { - nir_foreach_instr(block, instr) + nir_foreach_instr(instr, block) nir_foreach_ssa_def(instr, postvalidate_ssa_def, state); } } |