summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2015-05-08 14:40:58 -0400
committerKenneth Graunke <kenneth@whitecape.org>2015-09-01 00:58:17 -0700
commit019eea1c4fadaa86ce88ab81ac2f14613381738b (patch)
tree42fcb27563328311e57dd3e4b29d58034d93bbc5 /src/glsl
parent89dc0626bd71343312049bdca291704cb2f7fffe (diff)
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 <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir.c7
-rw-r--r--src/glsl/nir/nir.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index acb251afe8..3f4bec4625 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1293,6 +1293,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 6853b0e914..e73b7fbc4e 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.