From f378fa94b2e13d76fbc16e1cbc03d80dd9053d64 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 3 Jul 2018 19:18:28 -0700 Subject: [PATCH] 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 Reviewed-by: Eric Anholt --- src/compiler/nir/nir_opt_dce.c | 3 +-- src/compiler/nir/nir_worklist.h | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c index c9b338862e6..70532be33d7 100644 --- a/src/compiler/nir/nir_opt_dce.c +++ b/src/compiler/nir/nir_opt_dce.c @@ -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); diff --git a/src/compiler/nir/nir_worklist.h b/src/compiler/nir/nir_worklist.h index 3fb391fceff..05aa757eb79 100644 --- a/src/compiler/nir/nir_worklist.h +++ b/src/compiler/nir/nir_worklist.h @@ -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" */ -- 2.30.2