[Mesa-dev] [PATCH 4/6] nir: Switch the arguments to nir_foreach_function
Jason Ekstrand
jason at jlekstrand.net
Wed Apr 27 03:41:48 UTC 2016
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)/
---
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_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 +-
src/gallium/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 ++++++------
src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c | 2 +-
src/mesa/drivers/dri/i965/brw_nir_attribute_workarounds.c | 2 +-
src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c | 2 +-
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 4 ++--
60 files changed, 76 insertions(+), 76 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 0e3c84b..1585465 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1818,7 +1818,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 9d91b20..f7157ae 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -291,7 +291,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 1827223..0e397b0 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 8803be3..1781cdc 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 067e66f..15e89a3 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 9e7c4a1..7342e44 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 c56dc3c..4641e8c 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 ddf5eb5..b491791 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 1e2d65b..04e1feb 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 25ded16..80db653 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_packing.c b/src/compiler/nir/nir_lower_double_packing.c
index e3ebd3c..046e213 100644
--- a/src/compiler/nir/nir_lower_double_packing.c
+++ b/src/compiler/nir/nir_lower_double_packing.c
@@ -82,7 +82,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 e118e04..c8fdfde 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 293aeac..9bbaf83 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 83e265b..f2e7cde 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 5c2aac3..694a6e0 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 1c1ad51..d0f3dc7 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 4857902..bd518f9 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 f1ad171..7c52c16 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 1078fbc..21bc15b 100644
--- a/src/compiler/nir/nir_lower_outputs_to_temporaries.c
+++ b/src/compiler/nir/nir_lower_outputs_to_temporaries.c
@@ -93,7 +93,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 0e27e6d..9fd00cc 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 91bb2f7..8dbea6e 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 43a9723..0de9eb8 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 12a8524..5f367ab 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 fe67803..c854959 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -389,7 +389,7 @@ nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_lower_tex_impl(function->impl, options);
}
diff --git a/src/compiler/nir/nir_lower_to_source_mods.c b/src/compiler/nir/nir_lower_to_source_mods.c
index 6fe8465..b5f1650 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 723a97c..5d8779e 100644
--- a/src/compiler/nir/nir_lower_two_sided_color.c
+++ b/src/compiler/nir/nir_lower_two_sided_color.c
@@ -206,7 +206,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 3fe1c83..707d5af 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 00ed56e..eae4075 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 002ebf3..90619c9 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 61aae73..9e1cff5 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 8edf091..30752a2 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 002b9cf..cb25e31 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 b10bb23..8f04061 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 6e88077..adca7fa 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 109b629..71953b8 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 f7dd7be..0aeb08a 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 4b62e55..2e04c17 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 a87a006..119b74d 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 4d2b74d..e06820d 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 5d015c2..f1e7bb0 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 f4c41c1..14459ff 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 1f3561d..f7429eb 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 7dd4065..7dd2397 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 8ac65bf..f9ad49a 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 7dc283d..9ffb2fd 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 9bac664..6b7bb9f 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 8bd70e2..788d1dd 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
@@ -319,7 +319,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 7dea043..8cad4b7 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
@@ -710,7 +710,7 @@ vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c)
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(block, function->impl) {
vc4_nir_lower_blend_block(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 f709cb1..261c00d 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -447,7 +447,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 b1c370e..1085243 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
@@ -154,7 +154,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 96ed2af..a12b79f 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);
@@ -1781,7 +1781,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(block, function->impl) {
diff --git a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c
index 3252a5e..1421d27 100644
--- a/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c
+++ b/src/intel/vulkan/anv_nir_apply_dynamic_offsets.c
@@ -136,7 +136,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 e1fec77..91f4322 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 ea39dc3..64c1553 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 beadb28..13effb4 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 7ee2a8f..5475276 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 16eaacd..4ad26e2 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 93beab4..0bb766d 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 acc9e80..e7df80d 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 c988942..c7dc23b 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.5.0.400.gff86faf
More information about the mesa-dev
mailing list