nir/dce: Stop passing around nir_dest
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674>
This commit is contained in:

committed by
Marge Bot

parent
cced401b0f
commit
c69eb8dfd7
@@ -28,9 +28,9 @@
|
||||
#include "nir.h"
|
||||
|
||||
static bool
|
||||
is_dest_live(const nir_dest *dest, BITSET_WORD *defs_live)
|
||||
is_def_live(const nir_def *def, BITSET_WORD *defs_live)
|
||||
{
|
||||
return BITSET_TEST(defs_live, dest->ssa.index);
|
||||
return BITSET_TEST(defs_live, def->index);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -60,38 +60,38 @@ is_live(BITSET_WORD *defs_live, nir_instr *instr)
|
||||
return true;
|
||||
case nir_instr_type_alu: {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
return is_dest_live(&alu->dest.dest, defs_live);
|
||||
return is_def_live(&alu->dest.dest.ssa, defs_live);
|
||||
}
|
||||
case nir_instr_type_deref: {
|
||||
nir_deref_instr *deref = nir_instr_as_deref(instr);
|
||||
return is_dest_live(&deref->dest, defs_live);
|
||||
return is_def_live(&deref->dest.ssa, defs_live);
|
||||
}
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
|
||||
const nir_intrinsic_info *info = &nir_intrinsic_infos[intrin->intrinsic];
|
||||
return !(info->flags & NIR_INTRINSIC_CAN_ELIMINATE) ||
|
||||
(info->has_dest && is_dest_live(&intrin->dest, defs_live));
|
||||
(info->has_dest && is_def_live(&intrin->dest.ssa, defs_live));
|
||||
}
|
||||
case nir_instr_type_tex: {
|
||||
nir_tex_instr *tex = nir_instr_as_tex(instr);
|
||||
return is_dest_live(&tex->dest, defs_live);
|
||||
return is_def_live(&tex->dest.ssa, defs_live);
|
||||
}
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
||||
return is_dest_live(&phi->dest, defs_live);
|
||||
return is_def_live(&phi->dest.ssa, defs_live);
|
||||
}
|
||||
case nir_instr_type_load_const: {
|
||||
nir_load_const_instr *lc = nir_instr_as_load_const(instr);
|
||||
return BITSET_TEST(defs_live, lc->def.index);
|
||||
return is_def_live(&lc->def, defs_live);
|
||||
}
|
||||
case nir_instr_type_ssa_undef: {
|
||||
nir_undef_instr *undef = nir_instr_as_ssa_undef(instr);
|
||||
return BITSET_TEST(defs_live, undef->def.index);
|
||||
return is_def_live(&undef->def, defs_live);
|
||||
}
|
||||
case nir_instr_type_parallel_copy: {
|
||||
nir_parallel_copy_instr *pc = nir_instr_as_parallel_copy(instr);
|
||||
nir_foreach_parallel_copy_entry(entry, pc) {
|
||||
if (entry->dest_is_reg || is_dest_live(&entry->dest.dest, defs_live))
|
||||
if (entry->dest_is_reg || is_def_live(&entry->dest.dest.ssa, defs_live))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user