aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-10-05 19:08:57 -0700
committerJason Ekstrand <[email protected]>2016-10-06 09:16:37 -0700
commit2ed17d46de045404042f13c6591895a1cf31b167 (patch)
treea3ae65b79f04ef673578382c631a045f371428e8 /src/compiler/nir/nir.c
parent7a3bcadf4e665ff80775f520715061f4e3d63823 (diff)
nir: Make nir_foo_first/last_cf_node return a block instead
One of NIR's invariants is that control flow lists always start and end with blocks. There's no good reason why we should return a cf_node from these functions since we know that it's always a block. Making it a block lets us remove a bunch of code. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.c')
-rw-r--r--src/compiler/nir/nir.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 13ba989af4b..098e1b2759e 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1646,10 +1646,10 @@ nir_block_cf_tree_next(nir_block *block)
case nir_cf_node_if: {
/* Are we at the end of the if? Go to the beginning of the else */
nir_if *if_stmt = nir_cf_node_as_if(parent);
- if (&block->cf_node == nir_if_last_then_node(if_stmt))
- return nir_cf_node_as_block(nir_if_first_else_node(if_stmt));
+ if (block == nir_if_last_then_block(if_stmt))
+ return nir_if_first_else_block(if_stmt);
- assert(&block->cf_node == nir_if_last_else_node(if_stmt));
+ assert(block == nir_if_last_else_block(if_stmt));
/* fall through */
}
@@ -1682,10 +1682,10 @@ nir_block_cf_tree_prev(nir_block *block)
case nir_cf_node_if: {
/* Are we at the beginning of the else? Go to the end of the if */
nir_if *if_stmt = nir_cf_node_as_if(parent);
- if (&block->cf_node == nir_if_first_else_node(if_stmt))
- return nir_cf_node_as_block(nir_if_last_then_node(if_stmt));
+ if (block == nir_if_first_else_block(if_stmt))
+ return nir_if_last_then_block(if_stmt);
- assert(&block->cf_node == nir_if_first_then_node(if_stmt));
+ assert(block == nir_if_first_then_block(if_stmt));
/* fall through */
}
@@ -1710,12 +1710,12 @@ nir_block *nir_cf_node_cf_tree_first(nir_cf_node *node)
case nir_cf_node_if: {
nir_if *if_stmt = nir_cf_node_as_if(node);
- return nir_cf_node_as_block(nir_if_first_then_node(if_stmt));
+ return nir_if_first_then_block(if_stmt);
}
case nir_cf_node_loop: {
nir_loop *loop = nir_cf_node_as_loop(node);
- return nir_cf_node_as_block(nir_loop_first_cf_node(loop));
+ return nir_loop_first_block(loop);
}
case nir_cf_node_block: {
@@ -1737,12 +1737,12 @@ nir_block *nir_cf_node_cf_tree_last(nir_cf_node *node)
case nir_cf_node_if: {
nir_if *if_stmt = nir_cf_node_as_if(node);
- return nir_cf_node_as_block(nir_if_last_else_node(if_stmt));
+ return nir_if_last_else_block(if_stmt);
}
case nir_cf_node_loop: {
nir_loop *loop = nir_cf_node_as_loop(node);
- return nir_cf_node_as_block(nir_loop_last_cf_node(loop));
+ return nir_loop_last_block(loop);
}
case nir_cf_node_block: {