diff options
author | Connor Abbott <[email protected]> | 2015-07-21 19:54:31 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-08-24 13:31:42 -0700 |
commit | 58a360c6b8aead1fec34aea298654ab544e7c8e8 (patch) | |
tree | c9f9e9fdb502afc8176afe0468165797dd2e1907 | |
parent | 6e47a34b29459dcf977a8c1223805cb0a275a8c8 (diff) |
nir/cf: add split_block_before_instr()
Signed-off-by: Connor Abbott <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/glsl/nir/nir_control_flow.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index 9ae113f3959..fcdabc75a82 100644 --- a/src/glsl/nir/nir_control_flow.c +++ b/src/glsl/nir/nir_control_flow.c @@ -376,6 +376,24 @@ split_block_end(nir_block *block) return new_block; } +static nir_block * +split_block_before_instr(nir_instr *instr) +{ + assert(instr->type != nir_instr_type_phi); + nir_block *new_block = split_block_beginning(instr->block); + + nir_foreach_instr_safe(instr->block, cur_instr) { + if (cur_instr == instr) + break; + + exec_node_remove(&cur_instr->node); + cur_instr->block = new_block; + exec_list_push_tail(&new_block->instr_list, &cur_instr->node); + } + + return new_block; +} + /** * Inserts a non-basic block between two basic blocks and links them together. */ |