nir: Delete the per-instr SSA liveness impl.

It was introduced for nir-to-tgsi, and I found that it was the wrong
approach.  There's a reason nobody else does RA this way.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14404>
This commit is contained in:
Emma Anholt 2022-01-03 16:41:07 -08:00 committed by Marge Bot
parent 74c02d99b2
commit 20469009c7
2 changed files with 0 additions and 91 deletions

View File

@ -3569,26 +3569,6 @@ nir_shader_get_entrypoint(nir_shader *shader)
return func->impl;
}
typedef struct nir_liveness_bounds {
uint32_t start;
uint32_t end;
} nir_liveness_bounds;
typedef struct nir_instr_liveness {
/**
* nir_instr->index for the start and end of a single live interval for SSA
* defs. ssa values last used by a nir_if condition will have an interval
* ending at the first instruction after the last one before the if
* condition.
*
* Indexed by def->index (impl->ssa_alloc elements).
*/
struct nir_liveness_bounds *defs;
} nir_instr_liveness;
nir_instr_liveness *
nir_live_ssa_defs_per_instr(nir_function_impl *impl);
nir_shader *nir_shader_create(void *mem_ctx,
gl_shader_stage stage,
const nir_shader_compiler_options *options,

View File

@ -342,74 +342,3 @@ nir_ssa_defs_interfere(nir_ssa_def *a, nir_ssa_def *b)
return nir_ssa_def_is_live_at(b, a->parent_instr);
}
}
/* Takes an SSA def's defs and uses and expands the live interval to cover
* that range. Control flow effects are handled separately.
*/
static bool def_cb(nir_ssa_def *def, void *state)
{
nir_instr_liveness *liveness = state;
nir_instr *instr = def->parent_instr;
int index = def->index;
liveness->defs[index].start = MIN2(liveness->defs[index].start, instr->index);
nir_foreach_use(src, def) {
liveness->defs[index].end = MAX2(liveness->defs[index].end,
src->parent_instr->index);
}
return true;
}
nir_instr_liveness *
nir_live_ssa_defs_per_instr(nir_function_impl *impl)
{
/* We'll use block-level live_ssa_defs to expand our per-instr ranges for
* control flow.
*/
nir_metadata_require(impl,
nir_metadata_block_index |
nir_metadata_instr_index |
nir_metadata_live_ssa_defs);
/* Make our struct. */
nir_instr_liveness *liveness = ralloc(NULL, nir_instr_liveness);
liveness->defs = rzalloc_array(liveness, nir_liveness_bounds,
impl->ssa_alloc);
/* Set our starts so we can use MIN2() as we accumulate bounds. */
for (int i = 0; i < impl->ssa_alloc; i++)
liveness->defs->start = ~0;
nir_foreach_block(block, impl) {
unsigned index;
BITSET_FOREACH_SET(index, block->live_in, impl->ssa_alloc) {
liveness->defs[index].start = MIN2(liveness->defs[index].start,
block->start_ip);
}
nir_foreach_instr(instr, block) {
nir_foreach_ssa_def(instr, def_cb, liveness);
};
/* track an if src's use. We need to make sure that our value is live
* across the if reference, where we don't have an instr->index
* representing the use. Mark it as live through the end of the block.
*/
nir_if *nif = nir_block_get_following_if(block);
if (nif) {
if (nif->condition.is_ssa) {
liveness->defs[nif->condition.ssa->index].end = MAX2(
liveness->defs[nif->condition.ssa->index].end, block->end_ip);
}
}
BITSET_FOREACH_SET(index, block->live_out, impl->ssa_alloc) {
liveness->defs[index].end = MAX2(liveness->defs[index].end,
block->end_ip);
}
}
return liveness;
}