mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 05:40:13 +01:00
nir/from_ssa: Use nir_foreach_def() instead of nir_foreach_dest()
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658>
This commit is contained in:
parent
581ee2ccb4
commit
95a3c1325d
1 changed files with 12 additions and 8 deletions
|
|
@ -569,15 +569,19 @@ nir_rewrite_uses_to_load_reg(nir_builder *b, nir_def *old,
|
|||
}
|
||||
|
||||
static bool
|
||||
dest_replace_ssa_with_reg(nir_dest *dest, nir_function_impl *impl)
|
||||
def_replace_with_reg(nir_def *def, nir_function_impl *impl)
|
||||
{
|
||||
/* These are handled elsewhere */
|
||||
assert(def->parent_instr->type != nir_instr_type_ssa_undef &&
|
||||
def->parent_instr->type != nir_instr_type_load_const);
|
||||
|
||||
nir_builder b = nir_builder_create(impl);
|
||||
|
||||
nir_def *reg = decl_reg_for_ssa_def(&b, &dest->ssa);
|
||||
nir_rewrite_uses_to_load_reg(&b, &dest->ssa, reg);
|
||||
nir_def *reg = decl_reg_for_ssa_def(&b, def);
|
||||
nir_rewrite_uses_to_load_reg(&b, def, reg);
|
||||
|
||||
b.cursor = nir_after_instr(dest->ssa.parent_instr);
|
||||
nir_store_reg(&b, &dest->ssa, reg);
|
||||
b.cursor = nir_after_instr(def->parent_instr);
|
||||
nir_store_reg(&b, def, reg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1177,10 +1181,10 @@ struct ssa_def_to_reg_state {
|
|||
};
|
||||
|
||||
static bool
|
||||
dest_replace_ssa_with_reg_state(nir_dest *dest, void *void_state)
|
||||
def_replace_with_reg_state(nir_def *def, void *void_state)
|
||||
{
|
||||
struct ssa_def_to_reg_state *state = void_state;
|
||||
state->progress |= dest_replace_ssa_with_reg(dest, state->impl);
|
||||
state->progress |= def_replace_with_reg(def, state->impl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1262,7 +1266,7 @@ nir_lower_ssa_defs_to_regs_block(nir_block *block)
|
|||
* don't have a reason to convert it to a register.
|
||||
*/
|
||||
} else {
|
||||
nir_foreach_dest(instr, dest_replace_ssa_with_reg_state, &state);
|
||||
nir_foreach_def(instr, def_replace_with_reg_state, &state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue