aco: rename ops_fixed_to_def to tied_defs

This is less words.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34700>
This commit is contained in:
Rhys Perry 2025-04-17 16:59:53 +01:00 committed by Marge Bot
parent 275a39b3c6
commit c04ef28c56
5 changed files with 15 additions and 13 deletions

View file

@ -1423,7 +1423,7 @@ should_form_clause(const Instruction* a, const Instruction* b)
}
aco::small_vec<uint32_t, 2>
get_ops_fixed_to_def(Instruction* instr)
get_tied_defs(Instruction* instr)
{
aco::small_vec<uint32_t, 2> ops;
if (instr->opcode == aco_opcode::v_interp_p2_f32 || instr->opcode == aco_opcode::v_mac_f32 ||

View file

@ -2328,7 +2328,8 @@ void _aco_err(Program* program, const char* file, unsigned line, const char* fmt
#define aco_err(program, ...) _aco_err(program, __FILE__, __LINE__, __VA_ARGS__)
aco::small_vec<uint32_t, 2> get_ops_fixed_to_def(Instruction* instr);
/* Returns the indices of operands to which definitions are tied to. */
aco::small_vec<uint32_t, 2> get_tied_defs(Instruction* instr);
/* utilities for dealing with register demand */
RegisterDemand get_live_changes(Instruction* instr);

View file

@ -245,10 +245,11 @@ process_live_temps_per_block(live_ctx& ctx, Block* block)
}
/* Check if a definition clobbers some operand */
auto fixed_ops = get_ops_fixed_to_def(insn);
for (auto op_idx : fixed_ops) {
assert(std::none_of(fixed_ops.begin(), fixed_ops.end(),
[&](uint32_t i) {
auto tied_defs = get_tied_defs(insn);
for (auto op_idx : tied_defs) {
assert(std::none_of(tied_defs.begin(), tied_defs.end(),
[&](uint32_t i)
{
return i != op_idx && insn->operands[i].getTemp() ==
insn->operands[op_idx].getTemp();
}));

View file

@ -2147,8 +2147,8 @@ operand_can_use_reg(amd_gfx_level gfx_level, aco_ptr<Instruction>& instr, unsign
FALLTHROUGH;
case Format::SOP2:
case Format::SOP1: {
auto fixed_ops = get_ops_fixed_to_def(instr.get());
return std::all_of(fixed_ops.begin(), fixed_ops.end(),
auto tied_defs = get_tied_defs(instr.get());
return std::all_of(tied_defs.begin(), tied_defs.end(),
[idx](auto op_idx) { return op_idx != idx; }) ||
is_sgpr_writable_without_side_effects(gfx_level, reg);
}
@ -2858,7 +2858,7 @@ get_affinities(ra_ctx& ctx)
ctx.assignments[instr->operands[0].tempId()].m0 = true;
}
auto ops_fixed_to_defs = get_ops_fixed_to_def(instr.get());
auto tied_defs = get_tied_defs(instr.get());
for (unsigned i = 0; i < instr->definitions.size(); i++) {
const Definition& def = instr->definitions[i];
if (!def.isTemp())
@ -2872,8 +2872,8 @@ get_affinities(ra_ctx& ctx)
Operand op;
if (instr->opcode == aco_opcode::p_parallelcopy) {
op = instr->operands[i];
} else if (i < ops_fixed_to_defs.size()) {
op = instr->operands[ops_fixed_to_defs[i]];
} else if (i < tied_defs.size()) {
op = instr->operands[tied_defs[i]];
} else if (vop3_can_use_vop2acc(ctx, instr.get())) {
op = instr->operands[2];
} else if (i == 0 && sop2_can_use_sopk(ctx, instr.get())) {
@ -3299,7 +3299,7 @@ register_allocation(Program* program, ra_test_policy policy)
* location because that's used by a live-through operand.
*/
unsigned fixed_def_idx = 0;
for (auto op_idx : get_ops_fixed_to_def(instr.get())) {
for (auto op_idx : get_tied_defs(instr.get())) {
instr->definitions[fixed_def_idx++].setPrecolored(instr->operands[op_idx].physReg());
instr->operands[op_idx].setPrecolored(instr->operands[op_idx].physReg());
}

View file

@ -1474,7 +1474,7 @@ validate_ra(Program* program)
}
unsigned fixed_def_idx = 0;
for (auto op_idx : get_ops_fixed_to_def(instr.get())) {
for (auto op_idx : get_tied_defs(instr.get())) {
if (instr->definitions[fixed_def_idx++].physReg() !=
instr->operands[op_idx].physReg()) {
err |= ra_fail(program, loc, Location(),