nir: add a helper for iterating over blocks in a cf node
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 8 May 2015 18:40:58 +0000 (14:40 -0400)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 1 Sep 2015 07:58:17 +0000 (00:58 -0700)
We were already doing this internally for iterating over a function
implementation, so just expose it directly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir.c
src/glsl/nir/nir.h

index acb251afe8bb3c6195efa0d73cca3d9acfa913de..3f4bec4625d40836f15de5ae53e5355d46b92669 100644 (file)
@@ -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)
 {
index 6853b0e9145d98ad88e313d39309ab77d89fae18..e73b7fbc4e1eca523b75abc9f37b43b172cccb4f 100644 (file)
@@ -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.