From 019eea1c4fadaa86ce88ab81ac2f14613381738b Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 8 May 2015 14:40:58 -0400 Subject: [PATCH] nir: add a helper for iterating over blocks in a cf node We were already doing this internally for iterating over a function implementation, so just expose it directly. Reviewed-by: Kenneth Graunke --- src/glsl/nir/nir.c | 7 +++++++ src/glsl/nir/nir.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index acb251afe8b..3f4bec4625d 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -1292,6 +1292,13 @@ foreach_cf_node(nir_cf_node *node, nir_foreach_block_cb cb, return false; } +bool +nir_foreach_block_in_cf_node(nir_cf_node *node, nir_foreach_block_cb cb, + void *state) +{ + return foreach_cf_node(node, cb, false, state); +} + bool nir_foreach_block(nir_function_impl *impl, nir_foreach_block_cb cb, void *state) { diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 6853b0e9145..e73b7fbc4e1 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1726,6 +1726,8 @@ bool nir_foreach_block(nir_function_impl *impl, nir_foreach_block_cb cb, void *state); bool nir_foreach_block_reverse(nir_function_impl *impl, nir_foreach_block_cb cb, void *state); +bool nir_foreach_block_in_cf_node(nir_cf_node *node, nir_foreach_block_cb cb, + void *state); /* If the following CF node is an if, this function returns that if. * Otherwise, it returns NULL. -- 2.30.2