aco/ra: Don't consider precolored ops/defs in get_reg_impl

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34273>
This commit is contained in:
Natalie Vock
2025-04-05 13:04:19 +02:00
committed by Marge Bot
parent b9e506afd4
commit ee0f784858
@@ -1280,8 +1280,15 @@ get_reg_impl(ra_ctx& ctx, const RegisterFile& reg_file, std::vector<parallelcopy
/* mark and count killed operands */
unsigned killed_ops = 0;
std::bitset<256> is_killed_operand; /* per-register */
std::bitset<256> is_precolored; /* per-register */
for (unsigned j = 0; !is_phi(instr) && j < instr->operands.size(); j++) {
Operand& op = instr->operands[j];
if (op.isTemp() && op.isPrecolored() && !op.isFirstKillBeforeDef() &&
bounds.contains(op.physReg())) {
for (unsigned i = 0; i < op.size(); ++i) {
is_precolored[(op.physReg() & 0xff) + i] = true;
}
}
if (op.isTemp() && op.isFirstKillBeforeDef() && bounds.contains(op.physReg()) &&
!reg_file.test(PhysReg{op.physReg().reg()}, align(op.bytes() + op.physReg().byte(), 4))) {
assert(op.isFixed());
@@ -1293,6 +1300,14 @@ get_reg_impl(ra_ctx& ctx, const RegisterFile& reg_file, std::vector<parallelcopy
killed_ops += op.getTemp().size();
}
}
for (unsigned j = 0; !is_phi(instr) && j < instr->definitions.size(); j++) {
Definition& def = instr->definitions[j];
if (def.isTemp() && def.isPrecolored() && bounds.contains(def.physReg())) {
for (unsigned i = 0; i < def.size(); ++i) {
is_precolored[(def.physReg() & 0xff) + i] = true;
}
}
}
assert((regs_free + ctx.num_linear_vgprs) >= size);
@@ -1337,6 +1352,10 @@ get_reg_impl(ra_ctx& ctx, const RegisterFile& reg_file, std::vector<parallelcopy
}
continue;
}
if (is_precolored[j & 0xFF]) {
found = false;
break;
}
if (reg_file[j] == 0 || reg_file[j] == last_var)
continue;