nir/worklist: Rework the foreach macro
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 4 Jul 2018 02:18:28 +0000 (19:18 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 16 Jul 2018 18:02:10 +0000 (11:02 -0700)
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>
src/compiler/nir/nir_opt_dce.c
src/compiler/nir/nir_worklist.h

index c9b338862e6a2e24861e9ebf406ba7af7cff3baf..70532be33d79d86ffda0a0813e286238fc173186 100644 (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);
index 3fb391fceff08cf729e8f02c3f696dcacfc5b72c..05aa757eb7903546cfcee97e6cf5c08662637596 100644 (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" */