summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-27 22:50:14 -0800
committerJason Ekstrand <[email protected]>2015-12-27 22:50:14 -0800
commit3489f66056c3bacfb3ade806c0eea8f85951eb41 (patch)
tree8526f4ba4802a6eeaac9c1b2e50a0df1ef72f7ca /src/glsl
parentc60456dfaa6decc6f1884dbd40adad61937e3f69 (diff)
nir: Add a cursor helper for getting a cursor after any phi nodes
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 815c22c5e8b..904e444487a 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1872,6 +1872,22 @@ nir_after_cf_node(nir_cf_node *node)
}
static inline nir_cursor
+nir_after_cf_node_and_phis(nir_cf_node *node)
+{
+ if (node->type == nir_cf_node_block)
+ return nir_after_block(nir_cf_node_as_block(node));
+
+ nir_block *block = nir_cf_node_as_block(nir_cf_node_next(node));
+ assert(block->cf_node.type == nir_cf_node_block);
+
+ nir_foreach_instr(block, instr) {
+ if (instr->type != nir_instr_type_phi)
+ return nir_before_instr(instr);
+ }
+ return nir_after_block(block);
+}
+
+static inline nir_cursor
nir_before_cf_list(struct exec_list *cf_list)
{
nir_cf_node *first_node = exec_node_data(nir_cf_node,