OSDN Git Service

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 acb251a..3f4bec4 100644 (file)
@@ -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) {
index 6853b0e..e73b7fb 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.