nir/worklist: Rework the foreach macro

This makes the arguments match the (thing, container) pattern used in
other nir_foreach macros and also renames it to make that a bit more
clear.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Jason Ekstrand 2018-07-03 19:18:28 -07:00
parent 360714bfa5
commit f378fa94b2
2 changed files with 3 additions and 4 deletions

View file

@ -129,8 +129,7 @@ nir_opt_dce_impl(nir_function_impl *impl)
init_block(block, worklist);
}
nir_instr *instr = NULL;
nir_instr_worklist_foreach(worklist, instr)
nir_foreach_instr_in_worklist(instr, worklist)
nir_foreach_src(instr, mark_live_cb, worklist);
nir_instr_worklist_destroy(worklist);

View file

@ -154,8 +154,8 @@ nir_instr_worklist_pop_head(nir_instr_worklist *wl)
return *vec_instr;
}
#define nir_instr_worklist_foreach(wl, instr) \
while ((instr = nir_instr_worklist_pop_head(wl)))
#define nir_foreach_instr_in_worklist(instr, wl) \
for (nir_instr *instr; (instr = nir_instr_worklist_pop_head(wl));)
#ifdef __cplusplus
} /* extern "C" */