nir: Switch the arguments to nir_foreach_instr
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 27 Apr 2016 01:34:19 +0000 (18:34 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Apr 2016 22:54:48 +0000 (15:54 -0700)
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 <ian.d.romanick@intel.com>
65 files changed:
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_algebraic.py
src/compiler/nir/nir_clone.c
src/compiler/nir/nir_control_flow.c
src/compiler/nir/nir_from_ssa.c
src/compiler/nir/nir_gather_info.c
src/compiler/nir/nir_gs_count_vertices.c
src/compiler/nir/nir_inline_functions.c
src/compiler/nir/nir_liveness.c
src/compiler/nir/nir_lower_alu_to_scalar.c
src/compiler/nir/nir_lower_atomics.c
src/compiler/nir/nir_lower_clip.c
src/compiler/nir/nir_lower_double_ops.c
src/compiler/nir/nir_lower_double_packing.c
src/compiler/nir/nir_lower_global_vars_to_local.c
src/compiler/nir/nir_lower_gs_intrinsics.c
src/compiler/nir/nir_lower_idiv.c
src/compiler/nir/nir_lower_indirect_derefs.c
src/compiler/nir/nir_lower_io.c
src/compiler/nir/nir_lower_load_const_to_scalar.c
src/compiler/nir/nir_lower_locals_to_regs.c
src/compiler/nir/nir_lower_outputs_to_temporaries.c
src/compiler/nir/nir_lower_phis_to_scalar.c
src/compiler/nir/nir_lower_samplers.c
src/compiler/nir/nir_lower_system_values.c
src/compiler/nir/nir_lower_tex.c
src/compiler/nir/nir_lower_to_source_mods.c
src/compiler/nir/nir_lower_two_sided_color.c
src/compiler/nir/nir_lower_var_copies.c
src/compiler/nir/nir_lower_vars_to_ssa.c
src/compiler/nir/nir_lower_vec_to_movs.c
src/compiler/nir/nir_move_vec_src_uses_to_dest.c
src/compiler/nir/nir_normalize_cubemap_coords.c
src/compiler/nir/nir_opt_constant_folding.c
src/compiler/nir/nir_opt_copy_propagate.c
src/compiler/nir/nir_opt_cse.c
src/compiler/nir/nir_opt_dce.c
src/compiler/nir/nir_opt_dead_cf.c
src/compiler/nir/nir_opt_gcm.c
src/compiler/nir/nir_opt_peephole_select.c
src/compiler/nir/nir_opt_remove_phis.c
src/compiler/nir/nir_opt_undef.c
src/compiler/nir/nir_print.c
src/compiler/nir/nir_remove_dead_variables.c
src/compiler/nir/nir_repair_ssa.c
src/compiler/nir/nir_split_var_copies.c
src/compiler/nir/nir_sweep.c
src/compiler/nir/nir_to_ssa.c
src/compiler/nir/nir_validate.c
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
src/gallium/drivers/vc4/vc4_nir_lower_blend.c
src/gallium/drivers/vc4/vc4_nir_lower_io.c
src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
src/gallium/drivers/vc4/vc4_program.c
src/intel/vulkan/anv_nir_apply_dynamic_offsets.c
src/intel/vulkan/anv_nir_apply_pipeline_layout.c
src/intel/vulkan/anv_nir_lower_push_constants.c
src/mesa/drivers/dri/i965/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/brw_nir.c
src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c
src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp

index bf8ddedc5b8e1af1bb33a7e93034f8a600b98c0e..37a15cf5bc5bdbbb175fc0739c40a95fbf640c0b 100644 (file)
@@ -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++;
    }
 
index e8899640d23e5735f8920306617567ec857f0e2b..604eb4e11fef2345b4ad8963beae624b91e106c5 100644 (file)
@@ -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);
    }
index 4388c5f21f9569fe139546195d83b3666f3d849b..e61f5d2184e6f3a7b374664245d1ff63447c0d6b 100644 (file)
@@ -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;
 
index e231387c889d1f4f19eabe860ea1545864014ebb..18272235564fd0adf9be623b86743f576ea267da 100644 (file)
@@ -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
index ea5741288ce944ee3b9bdb029a494face71c64fa..64d9a86cde79c30988c1ae988bedd25914f309aa 100644 (file)
@@ -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);
index 6d92130b8599699a4d2217ab393782964f5f013a..947ebe1ccb74060ca8fc2a0030b431f510f289ce 100644 (file)
@@ -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);
 
index 14da78d8cf7e29077d37f9c6c5d5a243d93edc9b..180ceccff2a6863a66a6e2bca60b548cc85808aa 100644 (file)
@@ -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);
index 3c1bd2a59bd97d4e8947292ce204abf00313be28..9e7c4a11c12d5992222bf63409f9136d3e15ee53 100644 (file)
@@ -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;
index a639814140caf81722209986ef6a60734bc8dd72..c56dc3c09c7176f7e31ae4932a057d250fd8ebc4 100644 (file)
@@ -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;
 
index 67913ca86c03e3276227b971f49e3b9171338074..69c6fd93b5857663291c4a21259bd81b167eb760 100644 (file)
@@ -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.
index a5fc73495b7a43ba9b5a2a4c891db2f691b6589a..ddf5eb5c1cbf0b3ac8fb22d7558ada427f50012e 100644 (file)
@@ -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);
       }
index f00cef785fd605a9424738aba71fbc752d00454b..1e2d65b98017dd9b841fd729a47f1b8f8f7bc920 100644 (file)
@@ -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);
index 5d949de1c454851de8a8da63a36c7307a14df69c..25ded166c6b881f0d3691a53f17152706d5736c5 100644 (file)
@@ -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);
index 7505fa394bf983b7ffb5a71bfa47bf76f79e8aeb..75032a6f766da0442163b4de5fe4fa09bd57b6d1 100644 (file)
@@ -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;
 
index 4018d0bf216fa49c26f6d4de342a51abf003e34e..c34c267c0f88a00a2c95ca213000781587d63cfa 100644 (file)
@@ -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;
 
index e49e67adcb1de69d828811cbc99bf6295200caa3..e118e04b5647312d0f0b1eeca07c41c227dec030 100644 (file)
@@ -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;
 
index 406d7f0b5dcc579e85fe5070a768fad59cac8e59..293aeac8c032ec2f5138553d50110b290e69290e 100644 (file)
@@ -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;
 
index f5dafa7213793f70c7a96231476b1967dc11ca8d..83e265b7d0d7abb7c47ef09970b7719ffe8803d5 100644 (file)
@@ -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));
       }
index 9045adc1c6f7762968fbe08f0657cfa44c55f194..5c2aac326f86088f419a2b6ecce8e196a1a068a1 100644 (file)
@@ -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;
 
index e0ba9347bfe3b6abed4a06896cf5638b92fc257f..1c1ad5100a9cfb15fa287dba4bd2c4f61a461469 100644 (file)
@@ -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;
 
index 06cdd5abd55c106740e40d215546c74114b90fdf..4857902f6ab54687e0ce831b635b2c759e35b005 100644 (file)
@@ -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));
       }
index 3465d54224d7683c0d1da5ff8525fafc287fde51..f1ad171255286cc26c3b6956a438e087871bddf4 100644 (file)
@@ -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;
 
index c189947efae31eb07029a1be97cc1cca06532e74..01031f20adc4181a908e046fc04bbff82dfaa867 100644 (file)
@@ -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;
 
index f6c0d1cb64da0b4ae7d69a64b5999fb13a8098e9..a1a679bfcc2f07f74de2d5cad01312f73914a286 100644 (file)
@@ -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;
 
index 9bff20b3a83dacb6082c8e95144c1e2d4b10707e..43a97236c1b15a6a93edb52b17eb8a9992a0688f 100644 (file)
@@ -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);
       }
index ba8b4032f6bb590a937c80087a17c65a531200b8..0eee89590ec7505456fbcbf02803ada61ee8c0f5 100644 (file)
@@ -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;
 
index ac2f92c32f2887c6c78eb303a969b2db5d9c841d..2ab5d1c065a5a4070f53e811268aca6da0734834 100644 (file)
@@ -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;
 
index b641908eb457b4a1ee927b969fd91aa8e0ab21cc..6fe8465675d277e3c845d13560ad686a69f68adc 100644 (file)
@@ -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;
 
index 04b058c15b7068b925df655a88494b108db9f49c..ba3a4484f0f532e0eab2a2db9e71ef76c9b5f4f0 100644 (file)
@@ -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;
 
index d0d6452d803572c3e56b4559fb014497863b559b..3fe1c83978373d7ecd612d89fdfab4cc12a9e50a 100644 (file)
@@ -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;
 
index 66e0edbc371f74bbbfbda7ba4526cc0c27506898..00ed56ec7bbab3f91c54012aeeb08113d80a0404 100644 (file)
@@ -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;
 
index 0ba374937e8cd7a19cb19936b0860ead790617a9..002ebf3ba2a3325a73b4efeb30ffb98aa0910f68 100644 (file)
@@ -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;
 
index a437fe88d07ea55220d758c459880bbb42cfd6f0..8edf09136114ce9b24fe55725a5dc10827d96518 100644 (file)
@@ -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;
 
index ab17467fbb13dd9a4f10e07138aad151b6f81bec..002b9cf13d9111c5ebb575480137742748001d90 100644 (file)
@@ -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;
 
index a3adaecdd96051f97e0f3cbf20be6451ee710cab..b10bb234fd33ceeea45baf3e3d511e01d2427f35 100644 (file)
@@ -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);
index 99aebae686712ee7215b69a4761ba37c598f264b..6e8807781521b85791baf787e31bcae01909dd60 100644 (file)
@@ -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;
       }
index 364fb023dce70bd0fe67b5306205158dcf82f68a..109b62906ed9a10d1d6c284f8aad937d483588ed 100644 (file)
@@ -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;
index d94f4be28e0df49403c7dc2c1d2eb51ff2911871..f7dd7be950de652dfd2dbaec5c1524b102b7a62e 100644 (file)
@@ -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;
index a8506b7d36ab8eb233cdba2f24bdf60376d7daa3..ca73e50061b8fc9b477a58e9502613e5a7499eeb 100644 (file)
@@ -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;
       }
index 33278d8b1fcca89ee4094231d9204adb6667ed40..d79235d171970f448e4d05d5f4408b34bebe2374 100644 (file)
@@ -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) {
index d783f7b6195b2d1d3990522ac8afa1639e9f1eeb..b31cc35ba71f04303525ba7c2ff11e9df6abdcb3 100644 (file)
@@ -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;
 
index 0625297507bd586d182819850531768d28879e61..5234c0f667ad9154be5451e561c3bb6e7a1b2176 100644 (file)
@@ -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;
 
index 87c23b3c63f7b9f34f9fa644f15791482c2c78e9..f4c41c19c06f221c5149d2322dba4a52ef2b6d2b 100644 (file)
@@ -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;
index 229539d44eec810482e8879f969557f463c46833..76effa99e8c56ffa0339d77fb5b88f5e5c48741a 100644 (file)
@@ -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");
    }
index c48fa40c07fee94394b013af9c16c7ff75061c09..1f3561d8a148fba882cb0404f0206a3e49f50dd5 100644 (file)
@@ -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);
index ac0bce1fb4df74f624e0c897c204178ca2f91562..7dd4065e427e3cbe8ab18ba543b4b82f51747038 100644 (file)
@@ -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);
       }
    }
index da82e7cf6a203f7e3fff1e655d5dc50d37c390ec..8ac65bf0008e44b9b1adbf8daee3f96e4f3d1f6e 100644 (file)
@@ -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;
 
index b22f0f5656937fec6bd057776fd1c5e347f70608..0f1debce3ada66edfe4aed1c18be1ab33e5447a6 100644 (file)
@@ -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);
index 1a772fff2d5ad94b6ce06156f29cb290552339ef..766849192ffe0b6374c5c4159c88404febfa0e2b 100644 (file)
@@ -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);
    }
 }
index c7cef6a8095eac187e9544b4e675f91eb80c3091..10a78323550969e84e86501785c2fa03111a0efd 100644 (file)
@@ -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);
    }
 }
index abdb1c27c91666b859986242bd552f4eca927008..9bac664f7a59df9d2ee29243dd60b1ae78fa7fba 100644 (file)
@@ -1811,7 +1811,7 @@ emit_block(struct ir3_compile *ctx, nir_block *nblock)
        _mesa_hash_table_destroy(ctx->addr_ht, NULL);
        ctx->addr_ht = NULL;
 
-       nir_foreach_instr(nblock, instr) {
+       nir_foreach_instr(instr, nblock) {
                emit_instr(ctx, instr);
                if (ctx->error)
                        return;
index 8f7ea1c9083fd36910a8f736e31b8ad7f9366899..395b59b667ceb7eb579a000cfa7b695443c29785 100644 (file)
@@ -96,7 +96,7 @@ valid_dest(nir_block *block, nir_dest *dest)
 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 *intr = nir_instr_as_intrinsic(instr);
@@ -165,7 +165,7 @@ static void
 flatten_block(nir_builder *bld, nir_block *if_block, nir_block *prev_block,
                nir_ssa_def *condition, bool invert)
 {
-       nir_foreach_instr_safe(if_block, instr) {
+       nir_foreach_instr_safe(instr, if_block) {
                if (instr->type == nir_instr_type_intrinsic) {
                        nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
                        if ((intr->intrinsic == nir_intrinsic_discard) ||
@@ -270,7 +270,7 @@ lower_if_else_block(nir_block *block, void *void_state)
        flatten_block(&state->b, else_block, prev_block,
                        if_stmt->condition.ssa, true);
 
-       nir_foreach_instr_safe(block, instr) {
+       nir_foreach_instr_safe(instr, block) {
                if (instr->type != nir_instr_type_phi)
                        break;
 
index 99cbf30863aa74bcc4ff7fc0e148e824db1f5e83..05bac1e311f39fe7839007d386cda87ffa7f9dda 100644 (file)
@@ -678,7 +678,7 @@ vc4_nir_lower_blend_block(nir_block *block, void *state)
 {
         struct vc4_compile *c = state;
 
-        nir_foreach_instr_safe(block, instr) {
+        nir_foreach_instr_safe(instr, block) {
                 if (instr->type != nir_instr_type_intrinsic)
                         continue;
                 nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
index f1e5478126e28025c1e7d2605a19e21c37a06f73..6f8e162fdd32e2eedb3b148d7a3fdd35c01d24e2 100644 (file)
@@ -437,7 +437,7 @@ vc4_nir_lower_io_block(nir_block *block, void *arg)
         nir_builder b;
         nir_builder_init(&b, impl);
 
-        nir_foreach_instr_safe(block, instr)
+        nir_foreach_instr_safe(instr, block)
                 vc4_nir_lower_io_instr(c, &b, instr);
 
         return true;
index 0e7b2d5e25e270ce581e809d46746f1855a91832..8069ca95f3fe43b9759a19da39373df993104fe2 100644 (file)
@@ -139,7 +139,7 @@ vc4_nir_lower_txf_ms_block(nir_block *block, void *arg)
         nir_builder b;
         nir_builder_init(&b, impl);
 
-        nir_foreach_instr_safe(block, instr) {
+        nir_foreach_instr_safe(instr, block) {
                 if (instr->type == nir_instr_type_tex) {
                         vc4_nir_lower_txf_ms_instr(c, &b,
                                                    nir_instr_as_tex(instr));
index 4f6023334cf0ba4941089635d7abbda842b29a21..58e78b8ed762fd912494dc57a75431dd6b92734c 100644 (file)
@@ -1694,7 +1694,7 @@ ntq_emit_instr(struct vc4_compile *c, nir_instr *instr)
 static void
 ntq_emit_block(struct vc4_compile *c, nir_block *block)
 {
-        nir_foreach_instr(block, instr) {
+        nir_foreach_instr(instr, block) {
                 ntq_emit_instr(c, instr);
         }
 }
@@ -1781,7 +1781,7 @@ static bool
 count_nir_instrs_in_block(nir_block *block, void *state)
 {
         int *count = (int *) state;
-        nir_foreach_instr(block, instr) {
+        nir_foreach_instr(instr, block) {
                 *count = *count + 1;
         }
         return true;
index 996eba1c4acfd6f79582d01bdc78b421cf4155d2..545dd3f3b1314c3ba7c7685072c0c985239fd7c7 100644 (file)
@@ -31,7 +31,7 @@ apply_dynamic_offsets_block(nir_block *block, nir_builder *b,
 {
    struct anv_descriptor_set_layout *set_layout;
 
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
index dc3f989fcd03c407d46c830972e8927f8885eda3..e1fec77adb05553fe3fb250bb145ed31a94ce6e6 100644 (file)
@@ -54,7 +54,7 @@ static void
 get_used_bindings_block(nir_block *block,
                         struct apply_pipeline_layout_state *state)
 {
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       switch (instr->type) {
       case nir_instr_type_intrinsic: {
          nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
@@ -212,7 +212,7 @@ static void
 apply_pipeline_layout_block(nir_block *block,
                             struct apply_pipeline_layout_state *state)
 {
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       switch (instr->type) {
       case nir_instr_type_intrinsic: {
          nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
index 2d841009c6f6e70f0f917c2c4e06680a52dfc036..ea39dc36f4cdacf54121453780a2e45dcab9ab4f 100644 (file)
@@ -31,7 +31,7 @@ anv_nir_lower_push_constants(nir_shader *shader)
          continue;
 
       nir_foreach_block(block, function->impl) {
-         nir_foreach_instr(block, instr) {
+         nir_foreach_instr(instr, block) {
             if (instr->type != nir_instr_type_intrinsic)
                continue;
 
index fcc8ee6e8f238cda23013427928ceb78887e0d88..365d21000dce73e9f3a61caa648645317e46f7a8 100644 (file)
@@ -185,7 +185,7 @@ emit_system_values_block(nir_block *block, fs_visitor *v)
 {
    fs_reg *reg;
 
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
@@ -432,7 +432,7 @@ fs_visitor::nir_emit_loop(nir_loop *loop)
 void
 fs_visitor::nir_emit_block(nir_block *block)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       nir_emit_instr(instr);
    }
 }
index 3dd5f0785cf57ae908bdd2b0c0a7d126f0908498..7ee2a8f79a82dbcbfe4d015ead3b0fc0a6122b59 100644 (file)
@@ -59,7 +59,7 @@ static bool
 add_const_offset_to_base_block(nir_block *block, nir_builder *b,
                                nir_variable_mode mode)
 {
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
@@ -98,7 +98,7 @@ add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode)
 static bool
 remap_vs_attrs(nir_block *block, GLbitfield64 inputs_read)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
@@ -122,7 +122,7 @@ remap_vs_attrs(nir_block *block, GLbitfield64 inputs_read)
 static bool
 remap_inputs_with_vue_map(nir_block *block, const struct brw_vue_map *vue_map)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
@@ -142,7 +142,7 @@ static bool
 remap_patch_urb_offsets(nir_block *block, nir_builder *b,
                         const struct brw_vue_map *vue_map)
 {
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
index e09329fc0d460a8986b845c3db3f7ed93eec809d..16eaacd0bec3a803d893ced7eb31e8b1c78259b2 100644 (file)
@@ -86,7 +86,7 @@ src_mark_needs_resolve(nir_src *src, void *void_state)
 static bool
 analyze_boolean_resolves_block(nir_block *block)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       switch (instr->type) {
       case nir_instr_type_alu: {
          /* For ALU instructions, the resolve status is handled in a
index c21e16d65081bcd8ee939eaf0d6a633df6109303..93beab4d60163bbabfe28205c25e1fde66c242b6 100644 (file)
@@ -43,7 +43,7 @@ apply_attr_wa_block(nir_block *block, struct attr_wa_state *state)
 {
    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;
 
index b571bb9b8d3b82bb5e153039f3ac9000a24af0d2..acc9e80ee16080cca8d8e97100c1dc5516a35bf2 100644 (file)
@@ -171,7 +171,7 @@ brw_nir_opt_peephole_ffma_block(nir_block *block, void *mem_ctx)
 {
    bool progress = false;
 
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       if (instr->type != nir_instr_type_alu)
          continue;
 
index 2694905cb7e4340fa99db4033f5c356cd6efcf41..c988942ff3d10e6a2bb884db4de2f50662f95851 100644 (file)
@@ -100,7 +100,7 @@ vec4_visitor::nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr)
 static bool
 setup_system_values_block(nir_block *block, vec4_visitor *v)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       if (instr->type != nir_instr_type_intrinsic)
          continue;
 
@@ -213,7 +213,7 @@ vec4_visitor::nir_emit_loop(nir_loop *loop)
 void
 vec4_visitor::nir_emit_block(nir_block *block)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       nir_emit_instr(instr);
    }
 }