aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_control_flow.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-08-24 09:34:05 -0500
committerJason Ekstrand <[email protected]>2018-08-27 02:15:38 -0500
commit07a227f5438e63c5ebd1c49a272253a6784a69ae (patch)
tree8aa9bd207e495f0a9ad720a17b4b25bad2310a6a /src/compiler/nir/nir_control_flow.c
parent59a8e0dbf855d390e96a88d859f0d120dfc34404 (diff)
nir: Pull block_ends_in_jump into nir.h
We had two different implementations in different files. May as well have one and put it in nir.h. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_control_flow.c')
-rw-r--r--src/compiler/nir/nir_control_flow.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c
index 1622b35a6c9..3b0a0f1a5b0 100644
--- a/src/compiler/nir/nir_control_flow.c
+++ b/src/compiler/nir/nir_control_flow.c
@@ -45,13 +45,6 @@
*/
/*@{*/
-static bool
-block_ends_in_jump(nir_block *block)
-{
- return !exec_list_is_empty(&block->instr_list) &&
- nir_block_last_instr(block)->type == nir_instr_type_jump;
-}
-
static inline void
block_add_pred(nir_block *block, nir_block *pred)
{
@@ -117,12 +110,12 @@ link_non_block_to_block(nir_cf_node *node, nir_block *block)
nir_block *last_then_block = nir_if_last_then_block(if_stmt);
nir_block *last_else_block = nir_if_last_else_block(if_stmt);
- if (!block_ends_in_jump(last_then_block)) {
+ if (!nir_block_ends_in_jump(last_then_block)) {
unlink_block_successors(last_then_block);
link_blocks(last_then_block, block, NULL);
}
- if (!block_ends_in_jump(last_else_block)) {
+ if (!nir_block_ends_in_jump(last_else_block)) {
unlink_block_successors(last_else_block);
link_blocks(last_else_block, block, NULL);
}
@@ -339,7 +332,7 @@ split_block_end(nir_block *block)
new_block->cf_node.parent = block->cf_node.parent;
exec_node_insert_after(&block->cf_node.node, &new_block->cf_node.node);
- if (block_ends_in_jump(block)) {
+ if (nir_block_ends_in_jump(block)) {
/* Figure out what successor block would've had if it didn't have a jump
* instruction, and make new_block have that successor.
*/
@@ -553,7 +546,7 @@ stitch_blocks(nir_block *before, nir_block *after)
* TODO: special case when before is empty and after isn't?
*/
- if (block_ends_in_jump(before)) {
+ if (nir_block_ends_in_jump(before)) {
assert(exec_list_is_empty(&after->instr_list));
if (after->successors[0])
remove_phi_src(after->successors[0], after);
@@ -588,7 +581,7 @@ nir_cf_node_insert(nir_cursor cursor, nir_cf_node *node)
* already been setup with the correct successors, so we need to set
* up jumps here as the block is being inserted.
*/
- if (block_ends_in_jump(block))
+ if (nir_block_ends_in_jump(block))
nir_handle_add_jump(block);
stitch_blocks(block, after);