summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2015-02-21 01:47:59 -0500
committerConnor Abbott <cwabbott0@gmail.com>2015-02-21 01:47:59 -0500
commitcab39f11ce66a8c178008ca4a3d7ca6a72c56ab3 (patch)
tree92a694253fae4c2b137354b5e0494145fa6c39ba
parent8081dbc359f5665cac2ebcea6e3119beb7a1a1a7 (diff)
nir/live_variables: use nir_foreach_ssa_src()
-rw-r--r--src/glsl/nir/nir_live_variables.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/glsl/nir/nir_live_variables.c b/src/glsl/nir/nir_live_variables.c
index 7402dc0877..6053aa2a88 100644
--- a/src/glsl/nir/nir_live_variables.c
+++ b/src/glsl/nir/nir_live_variables.c
@@ -92,17 +92,14 @@ init_liveness_block(nir_block *block, void *void_state)
}
static bool
-set_src_live(nir_src *src, void *void_live)
+set_src_live(nir_ssa_def **src, void *void_live)
{
BITSET_WORD *live = void_live;
- if (!src->is_ssa)
- return true;
-
- if (src->ssa->live_index == 0)
+ if ((*src)->live_index == 0)
return true; /* undefined variables are never live */
- BITSET_SET(live, src->ssa->live_index);
+ BITSET_SET(live, (*src)->live_index);
return true;
}
@@ -149,7 +146,7 @@ propagate_across_edge(nir_block *pred, nir_block *succ,
nir_foreach_phi_src(phi, src) {
if (src->pred == pred) {
- set_src_live(&src->src, live);
+ set_src_live(&src->src.ssa, live);
break;
}
}
@@ -201,8 +198,8 @@ nir_live_variables_impl(nir_function_impl *impl)
state.bitset_words * sizeof(BITSET_WORD));
nir_if *following_if = nir_block_get_following_if(block);
- if (following_if)
- set_src_live(&following_if->condition, block->live_in);
+ if (following_if && following_if->condition.is_ssa)
+ set_src_live(&following_if->condition.ssa, block->live_in);
nir_foreach_instr_reverse(block, instr) {
/* Phi nodes are handled seperately so we want to skip them. Since
@@ -213,7 +210,7 @@ nir_live_variables_impl(nir_function_impl *impl)
break;
nir_foreach_ssa_def(instr, set_ssa_def_dead, block->live_in);
- nir_foreach_src(instr, set_src_live, block->live_in);
+ nir_foreach_ssa_src(instr, set_src_live, block->live_in);
}
/* Walk over all of the predecessors of the current block updating
@@ -233,9 +230,9 @@ nir_live_variables_impl(nir_function_impl *impl)
}
static bool
-src_does_not_use_def(nir_src *src, void *def)
+src_does_not_use_def(nir_ssa_def **src, void *def)
{
- return !src->is_ssa || src->ssa != (nir_ssa_def *)def;
+ return *src != (nir_ssa_def *)def;
}
static bool
@@ -245,7 +242,7 @@ search_for_use_after_instr(nir_instr *start, nir_ssa_def *def)
struct exec_node *node = start->node.next;
while (!exec_node_is_tail_sentinel(node)) {
nir_instr *instr = exec_node_data(nir_instr, node, node);
- if (!nir_foreach_src(instr, src_does_not_use_def, def))
+ if (!nir_foreach_ssa_src(instr, src_does_not_use_def, def))
return true;
node = node->next;
}