summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-07 18:27:36 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:01 -0800
commit02eef483430e48efdd30db06ea6b68fe64d62bfd (patch)
tree387088e31c06fadf84c756e40c85a0b9a6178555 /src/glsl/nir/nir.c
parentc6582e884df3e052ec372ee7f8a8838f46681913 (diff)
nir/nir: Use safe iterators when iterating over the CFG
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index d0e09ebb34e..e5346ffba49 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -1738,22 +1738,24 @@ static inline bool
foreach_if(nir_if *if_stmt, nir_foreach_block_cb cb, bool reverse, void *state)
{
if (reverse) {
- foreach_list_typed_reverse(nir_cf_node, node, node, &if_stmt->else_list) {
+ foreach_list_typed_safe_reverse(nir_cf_node, node, node,
+ &if_stmt->else_list) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
- foreach_list_typed_reverse(nir_cf_node, node, node, &if_stmt->then_list) {
+ foreach_list_typed_safe_reverse(nir_cf_node, node, node,
+ &if_stmt->then_list) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
} else {
- foreach_list_typed(nir_cf_node, node, node, &if_stmt->then_list) {
+ foreach_list_typed_safe(nir_cf_node, node, node, &if_stmt->then_list) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
- foreach_list_typed(nir_cf_node, node, node, &if_stmt->else_list) {
+ foreach_list_typed_safe(nir_cf_node, node, node, &if_stmt->else_list) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
@@ -1766,12 +1768,12 @@ static inline bool
foreach_loop(nir_loop *loop, nir_foreach_block_cb cb, bool reverse, void *state)
{
if (reverse) {
- foreach_list_typed_reverse(nir_cf_node, node, node, &loop->body) {
+ foreach_list_typed_safe_reverse(nir_cf_node, node, node, &loop->body) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
} else {
- foreach_list_typed(nir_cf_node, node, node, &loop->body) {
+ foreach_list_typed_safe(nir_cf_node, node, node, &loop->body) {
if (!foreach_cf_node(node, cb, reverse, state))
return false;
}
@@ -1804,7 +1806,7 @@ foreach_cf_node(nir_cf_node *node, nir_foreach_block_cb cb,
bool
nir_foreach_block(nir_function_impl *impl, nir_foreach_block_cb cb, void *state)
{
- foreach_list_typed(nir_cf_node, node, node, &impl->body) {
+ foreach_list_typed_safe(nir_cf_node, node, node, &impl->body) {
if (!foreach_cf_node(node, cb, false, state))
return false;
}
@@ -1819,7 +1821,7 @@ nir_foreach_block_reverse(nir_function_impl *impl, nir_foreach_block_cb cb,
if (!cb(impl->end_block, state))
return false;
- foreach_list_typed_reverse(nir_cf_node, node, node, &impl->body) {
+ foreach_list_typed_safe_reverse(nir_cf_node, node, node, &impl->body) {
if (!foreach_cf_node(node, cb, true, state))
return false;
}