nir: Switch the arguments to nir_foreach_function
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 27 Apr 2016 03:26:42 +0000 (20:26 -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_function(\([^,]*\),\s*\([^,]*\))/nir_foreach_function(\2, \1)/

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
61 files changed:
src/compiler/nir/nir.h
src/compiler/nir/nir_algebraic.py
src/compiler/nir/nir_clone.c
src/compiler/nir/nir_dominance.c
src/compiler/nir/nir_from_ssa.c
src/compiler/nir/nir_gs_count_vertices.c
src/compiler/nir/nir_inline_functions.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_returns.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_metadata.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_remove_dead_variables.c
src/compiler/nir/nir_repair_ssa.c
src/compiler/nir/nir_split_var_copies.c
src/compiler/nir/nir_to_ssa.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 a76718d85de4dc7d9ce01f2c4813865172b14d9e..da502bf05c08542d97ea28cabd6edbf3173d3587 100644 (file)
@@ -1820,7 +1820,7 @@ nir_shader_get_entrypoint(nir_shader *shader)
    return func;
 }
 
-#define nir_foreach_function(shader, func) \
+#define nir_foreach_function(func, shader) \
    foreach_list_typed(nir_function, func, node, &(shader)->functions)
 
 nir_shader *nir_shader_create(void *mem_ctx,
index e61f5d2184e6f3a7b374664245d1ff63447c0d6b..285f8534846c1fd7074b5d992a12d0266826c2fb 100644 (file)
@@ -584,7 +584,7 @@ ${pass_name}(nir_shader *shader)
    condition_flags[${index}] = ${condition};
    % endfor
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= ${pass_name}_impl(function->impl, condition_flags);
    }
index 18272235564fd0adf9be623b86743f576ea267da..0e397b038212fbf5325ecc199d562adfa2010d72 100644 (file)
@@ -701,7 +701,7 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
     * functions of other functions and we don't know what order the functions
     * will have in the list.
     */
-   nir_foreach_function(s, fxn) {
+   nir_foreach_function(fxn, s) {
       nir_function *nfxn = remap_global(&state, fxn);
       nfxn->impl = clone_function_impl(&state, fxn->impl);
       nfxn->impl->function = nfxn;
index 8803be31d887e2ce08596f34d953171b62f8df56..1781cdcc6f4bb81a2d79d78ffeafb3f979290745 100644 (file)
@@ -198,7 +198,7 @@ nir_calc_dominance_impl(nir_function_impl *impl)
 void
 nir_calc_dominance(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_calc_dominance_impl(function->impl);
    }
@@ -258,7 +258,7 @@ nir_dump_dom_tree_impl(nir_function_impl *impl, FILE *fp)
 void
 nir_dump_dom_tree(nir_shader *shader, FILE *fp)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_dump_dom_tree_impl(function->impl, fp);
    }
@@ -281,7 +281,7 @@ nir_dump_dom_frontier_impl(nir_function_impl *impl, FILE *fp)
 void
 nir_dump_dom_frontier(nir_shader *shader, FILE *fp)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_dump_dom_frontier_impl(function->impl, fp);
    }
@@ -305,7 +305,7 @@ nir_dump_cfg_impl(nir_function_impl *impl, FILE *fp)
 void
 nir_dump_cfg(nir_shader *shader, FILE *fp)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_dump_cfg_impl(function->impl, fp);
    }
index 067e66fe86a00228d5da87f0fec19e14fb160a1a..15e89a3e45f646cbaee8b567cd6a570b4a6bad5c 100644 (file)
@@ -805,7 +805,7 @@ nir_convert_from_ssa_impl(nir_function_impl *impl, bool phi_webs_only)
 void
 nir_convert_from_ssa(nir_shader *shader, bool phi_webs_only)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_convert_from_ssa_impl(function->impl, phi_webs_only);
    }
index 9e7c4a11c12d5992222bf63409f9136d3e15ee53..7342e4473df9a53bfa121c7e588d7ed1f84944dc 100644 (file)
@@ -55,7 +55,7 @@ nir_gs_count_vertices(const nir_shader *shader)
 {
    int count = -1;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!function->impl)
          continue;
 
index c56dc3c09c7176f7e31ae4932a057d250fd8ebc4..4641e8cc20e96a43c0e07087b53343b2b74fa4c1 100644 (file)
@@ -252,7 +252,7 @@ nir_inline_functions(nir_shader *shader)
                                           _mesa_key_pointer_equal);
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = inline_function_impl(function->impl, inlined) || progress;
    }
index ddf5eb5c1cbf0b3ac8fb22d7558ada427f50012e..b49179123735326a99010ad32df13bb9478a94d6 100644 (file)
@@ -257,7 +257,7 @@ nir_lower_alu_to_scalar_impl(nir_function_impl *impl)
 void
 nir_lower_alu_to_scalar(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_alu_to_scalar_impl(function->impl);
    }
index 1e2d65b98017dd9b841fd729a47f1b8f8f7bc920..04e1febc179072d199b23ca9c41c31875cbcf35f 100644 (file)
@@ -137,7 +137,7 @@ void
 nir_lower_atomics(nir_shader *shader,
                   const struct gl_shader_program *shader_program)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block(block, function->impl) {
             nir_foreach_instr_safe(instr, block) {
index 25ded166c6b881f0d3691a53f17152706d5736c5..80db653a4286cb4176ea7f15e04e201939d04734 100644 (file)
@@ -124,7 +124,7 @@ static nir_ssa_def *
 find_output(nir_shader *shader, unsigned drvloc)
 {
    nir_ssa_def *def = NULL;
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block_reverse(block, function->impl) {
             nir_ssa_def *new_def = find_output_in_block(block, drvloc);
@@ -250,7 +250,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables)
       out[1] =
          create_clipdist_var(shader, ++maxloc, true, VARYING_SLOT_CLIP_DIST1);
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!strcmp(function->name, "main"))
          lower_clip_vs(function->impl, ucp_enables, cv, out);
    }
@@ -324,7 +324,7 @@ nir_lower_clip_fs(nir_shader *shader, unsigned ucp_enables)
          create_clipdist_var(shader, ++maxloc, false,
                              VARYING_SLOT_CLIP_DIST1);
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!strcmp(function->name, "main"))
          lower_clip_fs(function->impl, ucp_enables, in);
    }
index 75032a6f766da0442163b4de5fe4fa09bd57b6d1..e5cf094bad0916b42f1a1732e56e83cdca5d45db 100644 (file)
@@ -557,7 +557,7 @@ lower_doubles_impl(nir_function_impl *impl, nir_lower_doubles_options options)
 void
 nir_lower_doubles(nir_shader *shader, nir_lower_doubles_options options)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          lower_doubles_impl(function->impl, options);
    }
index c34c267c0f88a00a2c95ca213000781587d63cfa..22092a2693ff803746d239717252b84366b874cd 100644 (file)
@@ -87,7 +87,7 @@ lower_double_pack_impl(nir_function_impl *impl)
 void
 nir_lower_double_pack(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          lower_double_pack_impl(function->impl);
    }
index e118e04b5647312d0f0b1eeca07c41c227dec030..c8fdfde8cb17976e3a461ea5df835dd4f4fd2c9e 100644 (file)
@@ -76,7 +76,7 @@ nir_lower_global_vars_to_local(nir_shader *shader)
       _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                               _mesa_key_pointer_equal);
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block(block, function->impl)
             mark_global_var_uses_block(block, function->impl, var_func_table);
index 293aeac8c032ec2f5138553d50110b290e69290e..9bbaf836843101d55e92a0e84f8d624794297782 100644 (file)
@@ -198,7 +198,7 @@ nir_lower_gs_intrinsics(nir_shader *shader)
    exec_list_push_tail(&shader->globals, &var->node);
    state.vertex_count_var = var;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_builder b;
          nir_builder_init(&b, function->impl);
index 83e265b7d0d7abb7c47ef09970b7719ffe8803d5..f2e7cdeb33d4ef1f10b326cc68db94997df5c609 100644 (file)
@@ -137,7 +137,7 @@ convert_impl(nir_function_impl *impl)
 void
 nir_lower_idiv(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          convert_impl(function->impl);
    }
index 5c2aac326f86088f419a2b6ecce8e196a1a068a1..694a6e0f3d734ffce45cebaa156cc106872ff466 100644 (file)
@@ -227,7 +227,7 @@ nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = lower_indirects_impl(function->impl, modes) || progress;
    }
index 1c1ad5100a9cfb15fa287dba4bd2c4f61a461469..d0f3dc72884b7d8820dbc445d054aeb813828bad 100644 (file)
@@ -414,7 +414,7 @@ void
 nir_lower_io(nir_shader *shader, nir_variable_mode modes,
              int (*type_size)(const struct glsl_type *))
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_io_impl(function->impl, modes, type_size);
    }
index 4857902f6ab54687e0ce831b635b2c759e35b005..bd518f920d6dc568c6cc57dc1a277f28216f8aa3 100644 (file)
@@ -81,7 +81,7 @@ nir_lower_load_const_to_scalar_impl(nir_function_impl *impl)
 void
 nir_lower_load_const_to_scalar(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_load_const_to_scalar_impl(function->impl);
    }
index f1ad171255286cc26c3b6956a438e087871bddf4..7c52c161ccb810e2499307161678248fd8751938 100644 (file)
@@ -390,7 +390,7 @@ nir_lower_locals_to_regs(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = nir_lower_locals_to_regs_impl(function->impl) || progress;
    }
index 01031f20adc4181a908e046fc04bbff82dfaa867..d5a0737cf6ad50db529c6fea45f59f62fd9b515d 100644 (file)
@@ -108,7 +108,7 @@ nir_lower_outputs_to_temporaries(nir_shader *shader, nir_function *entrypoint)
       exec_list_push_tail(&shader->outputs, &output->node);
    }
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl == NULL)
          continue;
 
index 0e27e6dd7f4b0a96e7faeb62fac8900799b77858..9fd00cc784aad8233d6d9b931331ef9fdb51600f 100644 (file)
@@ -291,7 +291,7 @@ lower_phis_to_scalar_impl(nir_function_impl *impl)
 void
 nir_lower_phis_to_scalar(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          lower_phis_to_scalar_impl(function->impl);
    }
index 91bb2f7dfeb1c043d9fbc81f722a7dff35c118d6..8dbea6e7179609450ee1d667825cce603a2d98c1 100644 (file)
@@ -237,7 +237,7 @@ nir_lower_returns(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = nir_lower_returns_impl(function->impl) || progress;
    }
index 43a97236c1b15a6a93edb52b17eb8a9992a0688f..0de9eb88dfcfce697433604b9361266e34384d46 100644 (file)
@@ -171,7 +171,7 @@ void
 nir_lower_samplers(nir_shader *shader,
                    const struct gl_shader_program *shader_program)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          lower_impl(function->impl, shader_program, shader->stage);
    }
index 0eee89590ec7505456fbcbf02803ada61ee8c0f5..8310e3831f4a98b19c41b091e71ed4ca1ca6cac9 100644 (file)
@@ -149,7 +149,7 @@ nir_lower_system_values(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = convert_impl(function->impl) || progress;
    }
index 2ab5d1c065a5a4070f53e811268aca6da0734834..d75e455136b82f7ceccb9306289b2bd8fa68eb07 100644 (file)
@@ -392,7 +392,7 @@ nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
    state.options = options;
    state.progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_tex_impl(function->impl, &state);
    }
index 6fe8465675d277e3c845d13560ad686a69f68adc..b5f165002d154956d76ce777912a2a87e8ad8da2 100644 (file)
@@ -184,7 +184,7 @@ nir_lower_to_source_mods_block(nir_block *block)
 void
 nir_lower_to_source_mods(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block(block, function->impl) {
             nir_lower_to_source_mods_block(block);
index ba3a4484f0f532e0eab2a2db9e71ef76c9b5f4f0..ea432c1bb59cba1810b52c1601297bdec2f479ba 100644 (file)
@@ -204,7 +204,7 @@ nir_lower_two_sided_color(nir_shader *shader)
    if (setup_inputs(&state) != 0)
       return;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_two_sided_color_impl(function->impl, &state);
    }
index 3fe1c83978373d7ecd612d89fdfab4cc12a9e50a..707d5af03ee79a27406d262d473b98d547dd23a1 100644 (file)
@@ -182,7 +182,7 @@ lower_var_copies_impl(nir_function_impl *impl)
 void
 nir_lower_var_copies(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          lower_var_copies_impl(function->impl);
    }
index 00ed56ec7bbab3f91c54012aeeb08113d80a0404..eae40755998004cccc6cd3c28e9f094b218a81f1 100644 (file)
@@ -752,7 +752,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
 void
 nir_lower_vars_to_ssa(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_lower_vars_to_ssa_impl(function->impl);
    }
index 002ebf3ba2a3325a73b4efeb30ffb98aa0910f68..90619c9fa3a484d8480fa7b8a7020b68613f9ede 100644 (file)
@@ -300,7 +300,7 @@ nir_lower_vec_to_movs(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = nir_lower_vec_to_movs_impl(function->impl) || progress;
    }
index 61aae73221eb2bf79d4422fa23abe0127c9d2a75..9e1cff5a67fcb214fb65614d5e4fecb8548e598d 100644 (file)
@@ -63,7 +63,7 @@ nir_metadata_preserve(nir_function_impl *impl, nir_metadata preserved)
 void
 nir_metadata_set_validation_flag(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          function->impl->valid_metadata |= nir_metadata_not_properly_reset;
       }
@@ -80,7 +80,7 @@ nir_metadata_set_validation_flag(nir_shader *shader)
 void
 nir_metadata_check_validation_flag(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          assert(!(function->impl->valid_metadata &
                   nir_metadata_not_properly_reset));
index 8edf09136114ce9b24fe55725a5dc10827d96518..30752a2e7163bd2d9e021744783affd3ae13c1a1 100644 (file)
@@ -193,7 +193,7 @@ nir_move_vec_src_uses_to_dest_impl(nir_shader *shader, nir_function_impl *impl)
 void
 nir_move_vec_src_uses_to_dest(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_move_vec_src_uses_to_dest_impl(shader, function->impl);
    }
index 002b9cf13d9111c5ebb575480137742748001d90..cb25e311d769277042f40c8cc4c46174e60a061c 100644 (file)
@@ -107,7 +107,7 @@ nir_normalize_cubemap_coords(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = normalize_cubemap_coords_impl(function->impl) || progress;
    }
index b10bb234fd33ceeea45baf3e3d511e01d2427f35..8f040619bfaeeb5cc99de326e9ba8c29152a214e 100644 (file)
@@ -220,7 +220,7 @@ nir_opt_constant_folding(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= nir_opt_constant_folding_impl(function->impl);
    }
index 6e8807781521b85791baf787e31bcae01909dd60..adca7fa6eff2be54a400f7b5052e1301bb5b4fd6 100644 (file)
@@ -269,7 +269,7 @@ nir_copy_prop(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl && nir_copy_prop_impl(function->impl))
          progress = true;
    }
index 109b62906ed9a10d1d6c284f8aad937d483588ed..71953b81bf77715c39915324bcf8d13933444f61 100644 (file)
@@ -83,7 +83,7 @@ nir_opt_cse(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= nir_opt_cse_impl(function->impl);
    }
index f7dd7be950de652dfd2dbaec5c1524b102b7a62e..0aeb08a320db9e95fe2f9adeada4edd248ac2a2c 100644 (file)
@@ -167,7 +167,7 @@ bool
 nir_opt_dce(nir_shader *shader)
 {
    bool progress = false;
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl && nir_opt_dce_impl(function->impl))
          progress = true;
    }
index 4b62e55d030b7aa5ad13e7788b9c690c17947548..2e04c179073e3357034d0ec625f5ddc2c5d492f2 100644 (file)
@@ -349,7 +349,7 @@ nir_opt_dead_cf(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function)
+   nir_foreach_function(function, shader)
       if (function->impl)
          progress |= opt_dead_cf_impl(function->impl);
 
index a87a0067230da12aee5bf1f7703eabe291104f99..119b74d58bbb81cbd7243ed54f7642fe6092490a 100644 (file)
@@ -488,7 +488,7 @@ opt_gcm_impl(nir_function_impl *impl)
 void
 nir_opt_gcm(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          opt_gcm_impl(function->impl);
    }
index 4d2b74dc7ffa5c219c42a629d19af38059721056..e06820d3e17d1f1c75c2246167186ce0085c39c4 100644 (file)
@@ -239,7 +239,7 @@ nir_opt_peephole_select(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= nir_opt_peephole_select_impl(function->impl);
    }
index 5d015c243de1040d159a91e40c54e8e3860f3da3..f1e7bb083f3698d69dd9c547ef53f167715a2e3a 100644 (file)
@@ -123,7 +123,7 @@ nir_opt_remove_phis(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function)
+   nir_foreach_function(function, shader)
       if (function->impl)
          progress = remove_phis_impl(function->impl) || progress;
 
index f4c41c19c06f221c5149d2322dba4a52ef2b6d2b..14459ff62af6b620723fa051e51225803843a351 100644 (file)
@@ -76,7 +76,7 @@ nir_opt_undef(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block(block, function->impl) {
             nir_foreach_instr_safe(instr, block) {
index 1f3561d8a148fba882cb0404f0206a3e49f50dd5..f7429eb83da3095fba741ebc4bff3d5540d50f58 100644 (file)
@@ -68,7 +68,7 @@ add_var_use_tex(nir_tex_instr *instr, struct set *live)
 static void
 add_var_use_shader(nir_shader *shader, struct set *live)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl) {
          nir_foreach_block(block, function->impl) {
             nir_foreach_instr(instr, block) {
@@ -136,7 +136,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)
       progress = remove_dead_vars(&shader->system_values, live) || progress;
 
    if (modes & nir_var_local) {
-      nir_foreach_function(shader, function) {
+      nir_foreach_function(function, shader) {
          if (function->impl) {
             if (remove_dead_vars(&function->impl->locals, live)) {
                nir_metadata_preserve(function->impl, nir_metadata_block_index |
index 7dd4065e427e3cbe8ab18ba543b4b82f51747038..7dd23979fcd952c52a0c80d2ad361ef16a5ce8a5 100644 (file)
@@ -143,7 +143,7 @@ nir_repair_ssa(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = nir_repair_ssa_impl(function->impl) || progress;
    }
index 8ac65bf0008e44b9b1adbf8daee3f96e4f3d1f6e..f9ad49a7cb3093638fdba9a633aa44c774f40c5c 100644 (file)
@@ -278,7 +278,7 @@ nir_split_var_copies(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress = split_var_copies_impl(function->impl) || progress;
    }
index 7dc283d045b3d23985848bfa2fae6ef99e93d7d2..9ffb2fdfd261b0e6c36eb68f7400db81b697eda1 100644 (file)
@@ -533,7 +533,7 @@ nir_convert_to_ssa_impl(nir_function_impl *impl)
 void
 nir_convert_to_ssa(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          nir_convert_to_ssa_impl(function->impl);
    }
index 9bac664f7a59df9d2ee29243dd60b1ae78fa7fba..6b7bb9f1dfc62414e4128bc36ac8f185daf3a2c1 100644 (file)
@@ -2157,7 +2157,7 @@ emit_instructions(struct ir3_compile *ctx)
        nir_function_impl *fxn = NULL;
 
        /* Find the main function: */
-       nir_foreach_function(ctx->s, function) {
+       nir_foreach_function(function, ctx->s) {
                compile_assert(ctx, strcmp(function->name, "main") == 0);
                compile_assert(ctx, function->impl);
                fxn = function->impl;
index f8a1a57d0facf6c80af8ab195a67df9531f7e73c..f24a58da12f323853fd8c615e4c105d91af887bd 100644 (file)
@@ -328,7 +328,7 @@ ir3_nir_lower_if_else(nir_shader *shader)
 {
        bool progress = false;
 
-       nir_foreach_function(shader, function) {
+       nir_foreach_function(function, shader) {
                if (function->impl)
                        progress |= lower_if_else_impl(function->impl);
        }
index 05bac1e311f39fe7839007d386cda87ffa7f9dda..c61612213e7c6a06772f614b6dbe83d509220b09 100644 (file)
@@ -712,7 +712,7 @@ vc4_nir_lower_blend_block(nir_block *block, void *state)
 void
 vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c)
 {
-        nir_foreach_function(s, function) {
+        nir_foreach_function(function, s) {
                 if (function->impl) {
                         nir_foreach_block_call(function->impl,
                                           vc4_nir_lower_blend_block, c);
index 6f8e162fdd32e2eedb3b148d7a3fdd35c01d24e2..3598268cd98c48dd61e7864154e1f736c5d681d6 100644 (file)
@@ -457,7 +457,7 @@ vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl)
 void
 vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c)
 {
-        nir_foreach_function(s, function) {
+        nir_foreach_function(function, s) {
                 if (function->impl)
                         vc4_nir_lower_io_impl(c, function->impl);
         }
index 8069ca95f3fe43b9759a19da39373df993104fe2..958a06af8dc4281eb6882e63bd43ef3b6433a48d 100644 (file)
@@ -164,7 +164,7 @@ vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl)
 void
 vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c)
 {
-        nir_foreach_function(s, function) {
+        nir_foreach_function(function, s) {
                 if (function->impl)
                         vc4_nir_lower_txf_ms_impl(c, function->impl);
         }
index 58e78b8ed762fd912494dc57a75431dd6b92734c..b1c8b009ffcd322f9b70ab89ff71ae7e1c8bda99 100644 (file)
@@ -1759,7 +1759,7 @@ nir_to_qir(struct vc4_compile *c)
         ntq_setup_registers(c, &c->s->registers);
 
         /* Find the main function and emit the body. */
-        nir_foreach_function(c->s, function) {
+        nir_foreach_function(function, c->s) {
                 assert(strcmp(function->name, "main") == 0);
                 assert(function->impl);
                 ntq_emit_impl(c, function->impl);
@@ -1791,7 +1791,7 @@ static int
 count_nir_instrs(nir_shader *nir)
 {
         int count = 0;
-        nir_foreach_function(nir, function) {
+        nir_foreach_function(function, nir) {
                 if (!function->impl)
                         continue;
                 nir_foreach_block_call(function->impl, count_nir_instrs_in_block, &count);
index 545dd3f3b1314c3ba7c7685072c0c985239fd7c7..6a2895392066c0e5babf2afc5ef25dbe1e909646 100644 (file)
@@ -137,7 +137,7 @@ anv_nir_apply_dynamic_offsets(struct anv_pipeline *pipeline,
    if (!layout || !layout->stage[shader->stage].has_dynamic_offsets)
       return;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!function->impl)
          continue;
 
index e1fec77adb05553fe3fb250bb145ed31a94ce6e6..91f4322f83a61a75a450262fac3d601828622d41 100644 (file)
@@ -267,7 +267,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
       state.set[s].image_offsets = rzalloc_array(mem_ctx, uint8_t, count);
    }
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!function->impl)
          continue;
 
@@ -327,7 +327,7 @@ anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
       }
    }
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!function->impl)
          continue;
 
index ea39dc36f4cdacf54121453780a2e45dcab9ab4f..64c155372ff0f035ffbcfff1252c5e71c42dc3d7 100644 (file)
@@ -26,7 +26,7 @@
 void
 anv_nir_lower_push_constants(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (!function->impl)
          continue;
 
index 365d21000dce73e9f3a61caa648645317e46f7a8..360e2c97d745506725e13e45f53264c2adf73eb9 100644 (file)
@@ -42,7 +42,7 @@ fs_visitor::emit_nir_code()
    nir_emit_system_values();
 
    /* get the main function and emit it */
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       assert(strcmp(function->name, "main") == 0);
       assert(function->impl);
       nir_emit_impl(function->impl);
@@ -344,7 +344,7 @@ fs_visitor::nir_emit_system_values()
       nir_system_values[i] = fs_reg();
    }
 
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       assert(strcmp(function->name, "main") == 0);
       assert(function->impl);
       nir_foreach_block(block, function->impl) {
index 7ee2a8f79a82dbcbfe4d015ead3b0fc0a6122b59..5475276d9cf9e3cfb0d5fa5e5ebbd535cf431902 100644 (file)
@@ -84,7 +84,7 @@ add_const_offset_to_base_block(nir_block *block, nir_builder *b,
 static void
 add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode)
 {
-   nir_foreach_function(nir, f) {
+   nir_foreach_function(f, nir) {
       if (f->impl) {
          nir_builder b;
          nir_builder_init(&b, f->impl);
@@ -222,7 +222,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
        */
       GLbitfield64 inputs_read = nir->info.inputs_read;
 
-      nir_foreach_function(nir, function) {
+      nir_foreach_function(function, nir) {
          if (function->impl) {
             nir_foreach_block(block, function->impl) {
                remap_vs_attrs(block, inputs_read);
@@ -249,7 +249,7 @@ brw_nir_lower_vue_inputs(nir_shader *nir, bool is_scalar,
 
       add_const_offset_to_base(nir, nir_var_shader_in);
 
-      nir_foreach_function(nir, function) {
+      nir_foreach_function(function, nir) {
          if (function->impl) {
             nir_foreach_block(block, function->impl) {
                remap_inputs_with_vue_map(block, vue_map);
@@ -273,7 +273,7 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map)
 
    add_const_offset_to_base(nir, nir_var_shader_in);
 
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       if (function->impl) {
          nir_builder b;
          nir_builder_init(&b, function->impl);
@@ -320,7 +320,7 @@ brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map)
 
    add_const_offset_to_base(nir, nir_var_shader_out);
 
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       if (function->impl) {
          nir_builder b;
          nir_builder_init(&b, function->impl);
@@ -501,7 +501,7 @@ brw_postprocess_nir(nir_shader *nir,
 
    if (unlikely(debug_enabled)) {
       /* Re-index SSA defs so we print more sensible numbers. */
-      nir_foreach_function(nir, function) {
+      nir_foreach_function(function, nir) {
          if (function->impl)
             nir_index_ssa_defs(function->impl);
       }
index 16eaacd0bec3a803d893ced7eb31e8b1c78259b2..4ad26e21103af40e0dee2d5459d629b376bc5e19 100644 (file)
@@ -262,7 +262,7 @@ analyze_boolean_resolves_impl(nir_function_impl *impl)
 void
 brw_nir_analyze_boolean_resolves(nir_shader *shader)
 {
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          analyze_boolean_resolves_impl(function->impl);
    }
index 93beab4d60163bbabfe28205c25e1fde66c242b6..0bb766d702d9bdb58851883b747c55e56e3d77e8 100644 (file)
@@ -155,7 +155,7 @@ brw_nir_apply_attribute_workarounds(nir_shader *shader,
       .wa_flags = attrib_wa_flags,
    };
 
-   nir_foreach_function(shader, func) {
+   nir_foreach_function(func, shader) {
       if (!func->impl)
          continue;
 
index acc9e80ee16080cca8d8e97100c1dc5516a35bf2..e7df80db4919b4be9445d69f2adb0afd80d98799 100644 (file)
@@ -303,7 +303,7 @@ brw_nir_opt_peephole_ffma(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= brw_nir_opt_peephole_ffma_impl(function->impl);
    }
index c988942ff3d10e6a2bb884db4de2f50662f95851..c7dc23b365bb0c23891ae2d48e4995f92fc31c43 100644 (file)
@@ -41,7 +41,7 @@ vec4_visitor::emit_nir_code()
    nir_setup_system_values();
 
    /* get the main function and emit it */
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       assert(strcmp(function->name, "main") == 0);
       assert(function->impl);
       nir_emit_impl(function->impl);
@@ -119,7 +119,7 @@ vec4_visitor::nir_setup_system_values()
       nir_system_values[i] = dst_reg();
    }
 
-   nir_foreach_function(nir, function) {
+   nir_foreach_function(function, nir) {
       assert(strcmp(function->name, "main") == 0);
       assert(function->impl);
       nir_foreach_block(block, function->impl) {