This computes liveness of SSA values, not nir_variables.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
nir_metadata_none = 0x0,
nir_metadata_block_index = 0x1,
nir_metadata_dominance = 0x2,
- nir_metadata_live_variables = 0x4,
+ nir_metadata_live_ssa_defs = 0x4,
} nir_metadata;
typedef struct {
bool nir_normalize_cubemap_coords(nir_shader *shader);
-void nir_live_variables_impl(nir_function_impl *impl);
+void nir_live_ssa_defs_impl(nir_function_impl *impl);
bool nir_ssa_defs_interfere(nir_ssa_def *a, nir_ssa_def *b);
void nir_convert_to_ssa_impl(nir_function_impl *impl);
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
- nir_metadata_require(impl, nir_metadata_live_variables |
+ nir_metadata_require(impl, nir_metadata_live_ssa_defs |
nir_metadata_dominance);
nir_foreach_block(impl, coalesce_phi_nodes_block, &state);
* block but not in the live-in of the block containing the phi node.
*/
-struct live_variables_state {
+struct live_ssa_defs_state {
unsigned num_ssa_defs;
unsigned bitset_words;
static bool
index_ssa_def(nir_ssa_def *def, void *void_state)
{
- struct live_variables_state *state = void_state;
+ struct live_ssa_defs_state *state = void_state;
if (def->parent_instr->type == nir_instr_type_ssa_undef)
def->live_index = 0;
static bool
init_liveness_block(nir_block *block, void *void_state)
{
- struct live_variables_state *state = void_state;
+ struct live_ssa_defs_state *state = void_state;
block->live_in = reralloc(block, block->live_in, BITSET_WORD,
state->bitset_words);
*/
static bool
propagate_across_edge(nir_block *pred, nir_block *succ,
- struct live_variables_state *state)
+ struct live_ssa_defs_state *state)
{
NIR_VLA(BITSET_WORD, live, state->bitset_words);
memcpy(live, succ->live_in, state->bitset_words * sizeof *live);
}
void
-nir_live_variables_impl(nir_function_impl *impl)
+nir_live_ssa_defs_impl(nir_function_impl *impl)
{
- struct live_variables_state state;
+ struct live_ssa_defs_state state;
/* We start at 1 because we reserve the index value of 0 for ssa_undef
* instructions. Those are never live, so their liveness information
exec_list_push_tail(&impl->locals, &var->node);
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance |
- nir_metadata_live_variables);
+ nir_metadata_live_ssa_defs);
progress = true;
}
}
nir_index_blocks(impl);
if (NEEDS_UPDATE(nir_metadata_dominance))
nir_calc_dominance_impl(impl);
- if (NEEDS_UPDATE(nir_metadata_live_variables))
- nir_live_variables_impl(impl);
+ if (NEEDS_UPDATE(nir_metadata_live_ssa_defs))
+ nir_live_ssa_defs_impl(impl);
#undef NEEDS_UPDATE
return false;
nir_function_impl *impl = nir_cf_node_get_function(&loop->cf_node);
- nir_metadata_require(impl, nir_metadata_live_variables |
+ nir_metadata_require(impl, nir_metadata_live_ssa_defs |
nir_metadata_dominance);
for (nir_block *cur = after->imm_dom; cur != before; cur = cur->imm_dom) {
if (remove_dead_vars(&overload->impl->locals, live)) {
nir_metadata_preserve(overload->impl, nir_metadata_block_index |
nir_metadata_dominance |
- nir_metadata_live_variables);
+ nir_metadata_live_ssa_defs);
progress = true;
}
}