Mesa (master): nir: Switch the arguments to nir_foreach_def
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Thu Apr 28 22:52:56 UTC 2016
Module: Mesa
Branch: master
Commit: 70f89dd75ee7487d0143fa871bb20cbd29f54da0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=70f89dd75ee7487d0143fa871bb20cbd29f54da0
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Tue Apr 26 20:34:01 2016 -0700
nir: Switch the arguments to nir_foreach_def
This matches the "foreach x in container" pattern found in many other
programming languages. Generated by the following regular expression:
s/nir_foreach_def(\([^,]*\),\s*\([^,]*\))/nir_foreach_def(\2, \1)/
Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir.h | 4 ++--
src/compiler/nir/nir_opt_global_to_local.c | 2 +-
src/compiler/nir/nir_to_ssa.c | 2 +-
src/compiler/nir/nir_validate.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 215b25a..f5f4144 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -546,10 +546,10 @@ nir_dest_init(void)
#define NIR_DEST_INIT nir_dest_init()
-#define nir_foreach_def(reg, dest) \
+#define nir_foreach_def(dest, reg) \
list_for_each_entry(nir_dest, dest, &(reg)->defs, reg.def_link)
-#define nir_foreach_def_safe(reg, dest) \
+#define nir_foreach_def_safe(dest, reg) \
list_for_each_entry_safe(nir_dest, dest, &(reg)->defs, reg.def_link)
static inline nir_src
diff --git a/src/compiler/nir/nir_opt_global_to_local.c b/src/compiler/nir/nir_opt_global_to_local.c
index 3555c7b..64d689e 100644
--- a/src/compiler/nir/nir_opt_global_to_local.c
+++ b/src/compiler/nir/nir_opt_global_to_local.c
@@ -34,7 +34,7 @@ global_to_local(nir_register *reg)
assert(reg->is_global);
- nir_foreach_def(reg, def_dest) {
+ nir_foreach_def(def_dest, reg) {
nir_instr *instr = def_dest->reg.parent_instr;
nir_function_impl *instr_impl =
nir_cf_node_get_function(&instr->block->cf_node);
diff --git a/src/compiler/nir/nir_to_ssa.c b/src/compiler/nir/nir_to_ssa.c
index 9ffb2fd..6accdd2 100644
--- a/src/compiler/nir/nir_to_ssa.c
+++ b/src/compiler/nir/nir_to_ssa.c
@@ -88,7 +88,7 @@ insert_phi_nodes(nir_function_impl *impl)
w_start = w_end = 0;
iter_count++;
- nir_foreach_def(reg, dest) {
+ nir_foreach_def(dest, reg) {
nir_instr *def = dest->reg.parent_instr;
if (work[def->block->index] < iter_count)
W[w_end++] = def->block;
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index 53cdbc4..84334d4 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -882,7 +882,7 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state)
abort();
}
- nir_foreach_def(reg, src) {
+ nir_foreach_def(src, reg) {
struct set_entry *entry = _mesa_set_search(reg_state->defs, src);
assert(entry);
_mesa_set_remove(reg_state->defs, entry);
More information about the mesa-commit
mailing list