mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
nir/copy_prop_vars: rename/refactor store_to_entry helper
The name reflected this function role back when the pass also did dead write elimination. So rename it to what it does now, which is setting a value using another value; and narrow the argument list. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
6c61449251
commit
e84c841fb0
1 changed files with 20 additions and 22 deletions
|
|
@ -385,25 +385,25 @@ apply_barrier_for_modes(struct util_dynarray *copies,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
store_to_entry(struct copy_prop_var_state *state, struct copy_entry *entry,
|
value_set_from_value(struct value *value, const struct value *from,
|
||||||
const struct value *value, unsigned write_mask)
|
unsigned write_mask)
|
||||||
{
|
{
|
||||||
if (value->is_ssa) {
|
if (from->is_ssa) {
|
||||||
/* Clear src if it was being used as non-SSA. */
|
/* Clear value if it was being used as non-SSA. */
|
||||||
if (!entry->src.is_ssa)
|
if (!value->is_ssa)
|
||||||
memset(&entry->src.ssa, 0, sizeof(entry->src.ssa));
|
memset(&value->ssa, 0, sizeof(value->ssa));
|
||||||
entry->src.is_ssa = true;
|
value->is_ssa = true;
|
||||||
/* Only overwrite the written components */
|
/* Only overwrite the written components */
|
||||||
for (unsigned i = 0; i < 4; i++) {
|
for (unsigned i = 0; i < 4; i++) {
|
||||||
if (write_mask & (1 << i)) {
|
if (write_mask & (1 << i)) {
|
||||||
entry->src.ssa.def[i] = value->ssa.def[i];
|
value->ssa.def[i] = from->ssa.def[i];
|
||||||
entry->src.ssa.component[i] = value->ssa.component[i];
|
value->ssa.component[i] = from->ssa.component[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Non-ssa stores always write everything */
|
/* Non-ssa stores always write everything */
|
||||||
entry->src.is_ssa = false;
|
value->is_ssa = false;
|
||||||
entry->src.deref = value->deref;
|
value->deref = from->deref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -803,18 +803,16 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
|
||||||
* to do this, we need an exact match, not just something that
|
* to do this, we need an exact match, not just something that
|
||||||
* contains what we're looking for.
|
* contains what we're looking for.
|
||||||
*/
|
*/
|
||||||
struct copy_entry *store_entry =
|
struct copy_entry *entry =
|
||||||
lookup_entry_for_deref(copies, src, nir_derefs_equal_bit);
|
lookup_entry_for_deref(copies, src, nir_derefs_equal_bit);
|
||||||
if (!store_entry)
|
if (!entry)
|
||||||
store_entry = copy_entry_create(copies, src);
|
entry = copy_entry_create(copies, src);
|
||||||
|
|
||||||
/* Set up a store to this entry with the value of the load. This way
|
/* Update the entry with the value of the load. This way
|
||||||
* we can potentially remove subsequent loads. However, we use a
|
* we can potentially remove subsequent loads.
|
||||||
* NULL instruction so we don't try and delete the load on a
|
|
||||||
* subsequent store.
|
|
||||||
*/
|
*/
|
||||||
store_to_entry(state, store_entry, &value,
|
value_set_from_value(&entry->src, &value,
|
||||||
((1 << intrin->num_components) - 1));
|
(1 << intrin->num_components) - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -841,7 +839,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
|
||||||
unsigned wrmask = nir_intrinsic_write_mask(intrin);
|
unsigned wrmask = nir_intrinsic_write_mask(intrin);
|
||||||
struct copy_entry *entry =
|
struct copy_entry *entry =
|
||||||
get_entry_and_kill_aliases(copies, dst, wrmask);
|
get_entry_and_kill_aliases(copies, dst, wrmask);
|
||||||
store_to_entry(state, entry, &value, wrmask);
|
value_set_from_value(&entry->src, &value, wrmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -897,7 +895,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
|
||||||
|
|
||||||
struct copy_entry *dst_entry =
|
struct copy_entry *dst_entry =
|
||||||
get_entry_and_kill_aliases(copies, dst, 0xf);
|
get_entry_and_kill_aliases(copies, dst, 0xf);
|
||||||
store_to_entry(state, dst_entry, &value, 0xf);
|
value_set_from_value(&dst_entry->src, &value, 0xf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue