We were already doing this internally for iterating over a function
implementation, so just expose it directly.

Signed-off-by: Connor Abbott <cwabbo...@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 4234593..bf4865d 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -2028,6 +2028,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 0837a9b..6efbfbd 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1581,6 +1581,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.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to