diff options
author | Jason Ekstrand <[email protected]> | 2015-12-27 22:50:14 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-03-24 15:20:44 -0700 |
commit | 8d61d7252433a0470b441c70085391d3dd4c04bb (patch) | |
tree | 7e8e84ed5e31e6cb8d990b805ebcac2a73661768 /src/compiler/nir/nir.h | |
parent | 18b01667493bd61c9c3eafd0848322b23da20efd (diff) |
nir: Add a cursor helper for getting a cursor after any phi nodes
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 718d281d7de..51d2e79f570 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1935,6 +1935,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, |