nir: Switch the arguments to nir_foreach_parallel_copy_entry

This matches the "foreach x in container" pattern found in many other
programming languages.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Jason Ekstrand
2016-04-26 20:21:27 -07:00
parent 8564916d01
commit e63766fb4b
4 changed files with 7 additions and 7 deletions

View File

@@ -981,7 +981,7 @@ static bool
visit_parallel_copy_dest(nir_parallel_copy_instr *instr, visit_parallel_copy_dest(nir_parallel_copy_instr *instr,
nir_foreach_dest_cb cb, void *state) nir_foreach_dest_cb cb, void *state)
{ {
nir_foreach_parallel_copy_entry(instr, entry) { nir_foreach_parallel_copy_entry(entry, instr) {
if (!cb(&entry->dest, state)) if (!cb(&entry->dest, state))
return false; return false;
} }
@@ -1174,7 +1174,7 @@ static bool
visit_parallel_copy_src(nir_parallel_copy_instr *instr, visit_parallel_copy_src(nir_parallel_copy_instr *instr,
nir_foreach_src_cb cb, void *state) nir_foreach_src_cb cb, void *state)
{ {
nir_foreach_parallel_copy_entry(instr, entry) { nir_foreach_parallel_copy_entry(entry, instr) {
if (!visit_src(&entry->src, cb, state)) if (!visit_src(&entry->src, cb, state))
return false; return false;
} }

View File

@@ -1323,7 +1323,7 @@ typedef struct {
nir_dest dest; nir_dest dest;
} nir_parallel_copy_entry; } nir_parallel_copy_entry;
#define nir_foreach_parallel_copy_entry(pcopy, entry) \ #define nir_foreach_parallel_copy_entry(entry, pcopy) \
foreach_list_typed(nir_parallel_copy_entry, entry, node, &(pcopy)->entries) foreach_list_typed(nir_parallel_copy_entry, entry, node, &(pcopy)->entries)
typedef struct { typedef struct {

View File

@@ -395,7 +395,7 @@ static void
aggressive_coalesce_parallel_copy(nir_parallel_copy_instr *pcopy, aggressive_coalesce_parallel_copy(nir_parallel_copy_instr *pcopy,
struct from_ssa_state *state) struct from_ssa_state *state)
{ {
nir_foreach_parallel_copy_entry(pcopy, entry) { nir_foreach_parallel_copy_entry(entry, pcopy) {
if (!entry->src.is_ssa) if (!entry->src.is_ssa)
continue; continue;
@@ -582,7 +582,7 @@ resolve_parallel_copy(nir_parallel_copy_instr *pcopy,
struct from_ssa_state *state) struct from_ssa_state *state)
{ {
unsigned num_copies = 0; unsigned num_copies = 0;
nir_foreach_parallel_copy_entry(pcopy, entry) { nir_foreach_parallel_copy_entry(entry, pcopy) {
/* Sources may be SSA */ /* Sources may be SSA */
if (!entry->src.is_ssa && entry->src.reg.reg == entry->dest.reg.reg) if (!entry->src.is_ssa && entry->src.reg.reg == entry->dest.reg.reg)
continue; continue;
@@ -615,7 +615,7 @@ resolve_parallel_copy(nir_parallel_copy_instr *pcopy,
* - Predicessors are recorded from sources and destinations * - Predicessors are recorded from sources and destinations
*/ */
int num_vals = 0; int num_vals = 0;
nir_foreach_parallel_copy_entry(pcopy, entry) { nir_foreach_parallel_copy_entry(entry, pcopy) {
/* Sources may be SSA */ /* Sources may be SSA */
if (!entry->src.is_ssa && entry->src.reg.reg == entry->dest.reg.reg) if (!entry->src.is_ssa && entry->src.reg.reg == entry->dest.reg.reg)
continue; continue;

View File

@@ -806,7 +806,7 @@ static void
print_parallel_copy_instr(nir_parallel_copy_instr *instr, print_state *state) print_parallel_copy_instr(nir_parallel_copy_instr *instr, print_state *state)
{ {
FILE *fp = state->fp; FILE *fp = state->fp;
nir_foreach_parallel_copy_entry(instr, entry) { nir_foreach_parallel_copy_entry(entry, instr) {
if (&entry->node != exec_list_get_head(&instr->entries)) if (&entry->node != exec_list_get_head(&instr->entries))
fprintf(fp, "; "); fprintf(fp, "; ");