[Mesa-dev] [PATCH 1/3] nir: Add a helper for iterating over blocks in a cf node
Thomas Helland
thomashelland90 at gmail.com
Tue Jul 28 10:52:42 PDT 2015
We were already doing this internally for iterating over a function
implementation, so just expose it directly.
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/glsl/nir/nir.c | 7 +++++++
src/glsl/nir/nir.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 78ff886..4c43c7b 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -2007,6 +2007,13 @@ foreach_cf_node(nir_cf_node *node, nir_foreach_block_cb cb,
}
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)
{
foreach_list_typed_safe(nir_cf_node, node, node, &impl->body) {
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 62cdbd4..36024b0 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1592,6 +1592,9 @@ 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.4.6
More information about the mesa-dev
mailing list