From 9464d8c49813aba77285e7465b96e92a91ed327c Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 26 Apr 2016 20:26:42 -0700 Subject: [PATCH] nir: Switch the arguments to nir_foreach_function 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 --- src/compiler/nir/nir.h | 2 +- src/compiler/nir/nir_algebraic.py | 2 +- src/compiler/nir/nir_clone.c | 2 +- src/compiler/nir/nir_dominance.c | 8 ++++---- src/compiler/nir/nir_from_ssa.c | 2 +- src/compiler/nir/nir_gs_count_vertices.c | 2 +- src/compiler/nir/nir_inline_functions.c | 2 +- src/compiler/nir/nir_lower_alu_to_scalar.c | 2 +- src/compiler/nir/nir_lower_atomics.c | 2 +- src/compiler/nir/nir_lower_clip.c | 6 +++--- src/compiler/nir/nir_lower_double_ops.c | 2 +- src/compiler/nir/nir_lower_double_packing.c | 2 +- src/compiler/nir/nir_lower_global_vars_to_local.c | 2 +- src/compiler/nir/nir_lower_gs_intrinsics.c | 2 +- src/compiler/nir/nir_lower_idiv.c | 2 +- src/compiler/nir/nir_lower_indirect_derefs.c | 2 +- src/compiler/nir/nir_lower_io.c | 2 +- src/compiler/nir/nir_lower_load_const_to_scalar.c | 2 +- src/compiler/nir/nir_lower_locals_to_regs.c | 2 +- src/compiler/nir/nir_lower_outputs_to_temporaries.c | 2 +- src/compiler/nir/nir_lower_phis_to_scalar.c | 2 +- src/compiler/nir/nir_lower_returns.c | 2 +- src/compiler/nir/nir_lower_samplers.c | 2 +- src/compiler/nir/nir_lower_system_values.c | 2 +- src/compiler/nir/nir_lower_tex.c | 2 +- src/compiler/nir/nir_lower_to_source_mods.c | 2 +- src/compiler/nir/nir_lower_two_sided_color.c | 2 +- src/compiler/nir/nir_lower_var_copies.c | 2 +- src/compiler/nir/nir_lower_vars_to_ssa.c | 2 +- src/compiler/nir/nir_lower_vec_to_movs.c | 2 +- src/compiler/nir/nir_metadata.c | 4 ++-- src/compiler/nir/nir_move_vec_src_uses_to_dest.c | 2 +- src/compiler/nir/nir_normalize_cubemap_coords.c | 2 +- src/compiler/nir/nir_opt_constant_folding.c | 2 +- src/compiler/nir/nir_opt_copy_propagate.c | 2 +- src/compiler/nir/nir_opt_cse.c | 2 +- src/compiler/nir/nir_opt_dce.c | 2 +- src/compiler/nir/nir_opt_dead_cf.c | 2 +- src/compiler/nir/nir_opt_gcm.c | 2 +- src/compiler/nir/nir_opt_peephole_select.c | 2 +- src/compiler/nir/nir_opt_remove_phis.c | 2 +- src/compiler/nir/nir_opt_undef.c | 2 +- src/compiler/nir/nir_remove_dead_variables.c | 4 ++-- src/compiler/nir/nir_repair_ssa.c | 2 +- src/compiler/nir/nir_split_var_copies.c | 2 +- src/compiler/nir/nir_to_ssa.c | 2 +- src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 2 +- .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c | 2 +- src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 2 +- src/gallium/drivers/vc4/vc4_nir_lower_io.c | 2 +- src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c | 2 +- src/gallium/drivers/vc4/vc4_program.c | 4 ++-- src/intel/vulkan/anv_nir_apply_dynamic_offsets.c | 2 +- src/intel/vulkan/anv_nir_apply_pipeline_layout.c | 4 ++-- src/intel/vulkan/anv_nir_lower_push_constants.c | 2 +- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 4 ++-- src/mesa/drivers/dri/i965/brw_nir.c | 12 ++++++------ .../dri/i965/brw_nir_analyze_boolean_resolves.c | 2 +- .../drivers/dri/i965/brw_nir_attribute_workarounds.c | 2 +- .../drivers/dri/i965/brw_nir_opt_peephole_ffma.c | 2 +- src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 4 ++-- 61 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index a76718d85de..da502bf05c0 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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, diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index e61f5d2184e..285f8534846 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -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); } diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 18272235564..0e397b03821 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -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; diff --git a/src/compiler/nir/nir_dominance.c b/src/compiler/nir/nir_dominance.c index 8803be31d88..1781cdcc6f4 100644 --- a/src/compiler/nir/nir_dominance.c +++ b/src/compiler/nir/nir_dominance.c @@ -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); } diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 067e66fe86a..15e89a3e45f 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -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); } diff --git a/src/compiler/nir/nir_gs_count_vertices.c b/src/compiler/nir/nir_gs_count_vertices.c index 9e7c4a11c12..7342e4473df 100644 --- a/src/compiler/nir/nir_gs_count_vertices.c +++ b/src/compiler/nir/nir_gs_count_vertices.c @@ -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; diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index c56dc3c09c7..4641e8cc20e 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -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; } diff --git a/src/compiler/nir/nir_lower_alu_to_scalar.c b/src/compiler/nir/nir_lower_alu_to_scalar.c index ddf5eb5c1cb..b4917912373 100644 --- a/src/compiler/nir/nir_lower_alu_to_scalar.c +++ b/src/compiler/nir/nir_lower_alu_to_scalar.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index 1e2d65b9801..04e1febc179 100644 --- a/src/compiler/nir/nir_lower_atomics.c +++ b/src/compiler/nir/nir_lower_atomics.c @@ -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) { diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index 25ded166c6b..80db653a428 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_double_ops.c b/src/compiler/nir/nir_lower_double_ops.c index 75032a6f766..e5cf094bad0 100644 --- a/src/compiler/nir/nir_lower_double_ops.c +++ b/src/compiler/nir/nir_lower_double_ops.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_double_packing.c b/src/compiler/nir/nir_lower_double_packing.c index c34c267c0f8..22092a2693f 100644 --- a/src/compiler/nir/nir_lower_double_packing.c +++ b/src/compiler/nir/nir_lower_double_packing.c @@ -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); } 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 e118e04b564..c8fdfde8cb1 100644 --- a/src/compiler/nir/nir_lower_global_vars_to_local.c +++ b/src/compiler/nir/nir_lower_global_vars_to_local.c @@ -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); diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c index 293aeac8c03..9bbaf836843 100644 --- a/src/compiler/nir/nir_lower_gs_intrinsics.c +++ b/src/compiler/nir/nir_lower_gs_intrinsics.c @@ -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); diff --git a/src/compiler/nir/nir_lower_idiv.c b/src/compiler/nir/nir_lower_idiv.c index 83e265b7d0d..f2e7cdeb33d 100644 --- a/src/compiler/nir/nir_lower_idiv.c +++ b/src/compiler/nir/nir_lower_idiv.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c index 5c2aac326f8..694a6e0f3d7 100644 --- a/src/compiler/nir/nir_lower_indirect_derefs.c +++ b/src/compiler/nir/nir_lower_indirect_derefs.c @@ -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; } diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 1c1ad5100a9..d0f3dc72884 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -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); } 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 4857902f6ab..bd518f920d6 100644 --- a/src/compiler/nir/nir_lower_load_const_to_scalar.c +++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c index f1ad1712552..7c52c161ccb 100644 --- a/src/compiler/nir/nir_lower_locals_to_regs.c +++ b/src/compiler/nir/nir_lower_locals_to_regs.c @@ -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; } diff --git a/src/compiler/nir/nir_lower_outputs_to_temporaries.c b/src/compiler/nir/nir_lower_outputs_to_temporaries.c index 01031f20adc..d5a0737cf6a 100644 --- a/src/compiler/nir/nir_lower_outputs_to_temporaries.c +++ b/src/compiler/nir/nir_lower_outputs_to_temporaries.c @@ -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; diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c index 0e27e6dd7f4..9fd00cc784a 100644 --- a/src/compiler/nir/nir_lower_phis_to_scalar.c +++ b/src/compiler/nir/nir_lower_phis_to_scalar.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index 91bb2f7dfeb..8dbea6e7179 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -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; } diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/nir/nir_lower_samplers.c index 43a97236c1b..0de9eb88dfc 100644 --- a/src/compiler/nir/nir_lower_samplers.c +++ b/src/compiler/nir/nir_lower_samplers.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index 0eee89590ec..8310e3831f4 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -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; } diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 2ab5d1c065a..d75e455136b 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_to_source_mods.c b/src/compiler/nir/nir_lower_to_source_mods.c index 6fe8465675d..b5f165002d1 100644 --- a/src/compiler/nir/nir_lower_to_source_mods.c +++ b/src/compiler/nir/nir_lower_to_source_mods.c @@ -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); diff --git a/src/compiler/nir/nir_lower_two_sided_color.c b/src/compiler/nir/nir_lower_two_sided_color.c index ba3a4484f0f..ea432c1bb59 100644 --- a/src/compiler/nir/nir_lower_two_sided_color.c +++ b/src/compiler/nir/nir_lower_two_sided_color.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c index 3fe1c839783..707d5af03ee 100644 --- a/src/compiler/nir/nir_lower_var_copies.c +++ b/src/compiler/nir/nir_lower_var_copies.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 00ed56ec7bb..eae40755998 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -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); } diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c index 002ebf3ba2a..90619c9fa3a 100644 --- a/src/compiler/nir/nir_lower_vec_to_movs.c +++ b/src/compiler/nir/nir_lower_vec_to_movs.c @@ -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; } diff --git a/src/compiler/nir/nir_metadata.c b/src/compiler/nir/nir_metadata.c index 61aae73221e..9e1cff5a67f 100644 --- a/src/compiler/nir/nir_metadata.c +++ b/src/compiler/nir/nir_metadata.c @@ -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)); 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 8edf0913611..30752a2e716 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 @@ -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); } diff --git a/src/compiler/nir/nir_normalize_cubemap_coords.c b/src/compiler/nir/nir_normalize_cubemap_coords.c index 002b9cf13d9..cb25e311d76 100644 --- a/src/compiler/nir/nir_normalize_cubemap_coords.c +++ b/src/compiler/nir/nir_normalize_cubemap_coords.c @@ -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; } diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c index b10bb234fd3..8f040619bfa 100644 --- a/src/compiler/nir/nir_opt_constant_folding.c +++ b/src/compiler/nir/nir_opt_constant_folding.c @@ -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); } diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c index 6e880778152..adca7fa6eff 100644 --- a/src/compiler/nir/nir_opt_copy_propagate.c +++ b/src/compiler/nir/nir_opt_copy_propagate.c @@ -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; } diff --git a/src/compiler/nir/nir_opt_cse.c b/src/compiler/nir/nir_opt_cse.c index 109b62906ed..71953b81bf7 100644 --- a/src/compiler/nir/nir_opt_cse.c +++ b/src/compiler/nir/nir_opt_cse.c @@ -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); } diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c index f7dd7be950d..0aeb08a320d 100644 --- a/src/compiler/nir/nir_opt_dce.c +++ b/src/compiler/nir/nir_opt_dce.c @@ -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; } diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index 4b62e55d030..2e04c179073 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -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); diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index a87a0067230..119b74d58bb 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -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); } diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index 4d2b74dc7ff..e06820d3e17 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -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); } diff --git a/src/compiler/nir/nir_opt_remove_phis.c b/src/compiler/nir/nir_opt_remove_phis.c index 5d015c243de..f1e7bb083f3 100644 --- a/src/compiler/nir/nir_opt_remove_phis.c +++ b/src/compiler/nir/nir_opt_remove_phis.c @@ -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; diff --git a/src/compiler/nir/nir_opt_undef.c b/src/compiler/nir/nir_opt_undef.c index f4c41c19c06..14459ff62af 100644 --- a/src/compiler/nir/nir_opt_undef.c +++ b/src/compiler/nir/nir_opt_undef.c @@ -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) { diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index 1f3561d8a14..f7429eb83da 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -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 | diff --git a/src/compiler/nir/nir_repair_ssa.c b/src/compiler/nir/nir_repair_ssa.c index 7dd4065e427..7dd23979fcd 100644 --- a/src/compiler/nir/nir_repair_ssa.c +++ b/src/compiler/nir/nir_repair_ssa.c @@ -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; } diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c index 8ac65bf0008..f9ad49a7cb3 100644 --- a/src/compiler/nir/nir_split_var_copies.c +++ b/src/compiler/nir/nir_split_var_copies.c @@ -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; } diff --git a/src/compiler/nir/nir_to_ssa.c b/src/compiler/nir/nir_to_ssa.c index 7dc283d045b..9ffb2fdfd26 100644 --- a/src/compiler/nir/nir_to_ssa.c +++ b/src/compiler/nir/nir_to_ssa.c @@ -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); } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 9bac664f7a5..6b7bb9f1dfc 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -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; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c index f8a1a57d0fa..f24a58da12f 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c @@ -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); } diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index 05bac1e311f..c61612213e7 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -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); diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index 6f8e162fdd3..3598268cd98 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -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); } diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c index 8069ca95f3f..958a06af8dc 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c @@ -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); } diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 58e78b8ed76..b1c8b009ffc 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -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); diff --git a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c index 545dd3f3b13..6a289539206 100644 --- a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c +++ b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c @@ -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; diff --git a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c index e1fec77adb0..91f4322f83a 100644 --- a/src/intel/vulkan/anv_nir_apply_pipeline_layout.c +++ b/src/intel/vulkan/anv_nir_apply_pipeline_layout.c @@ -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; diff --git a/src/intel/vulkan/anv_nir_lower_push_constants.c b/src/intel/vulkan/anv_nir_lower_push_constants.c index ea39dc36f4c..64c155372ff 100644 --- a/src/intel/vulkan/anv_nir_lower_push_constants.c +++ b/src/intel/vulkan/anv_nir_lower_push_constants.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 365d21000dc..360e2c97d74 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -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) { diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 7ee2a8f79a8..5475276d9cf 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -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); } diff --git a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c index 16eaacd0bec..4ad26e21103 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c +++ b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c @@ -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); } diff --git a/src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c b/src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c index 93beab4d601..0bb766d702d 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c +++ b/src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c index acc9e80ee16..e7df80db491 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c +++ b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c @@ -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); } diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index c988942ff3d..c7dc23b365b 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -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) { -- 2.30.2