aco: Add get_temp_reg_changes helper
Similar to get_live_changes, but considers live temporary registers as well. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29730>
This commit is contained in:
@@ -2318,6 +2318,7 @@ int get_op_fixed_to_def(Instruction* instr);
|
||||
/* utilities for dealing with register demand */
|
||||
RegisterDemand get_live_changes(Instruction* instr);
|
||||
RegisterDemand get_temp_registers(Instruction* instr);
|
||||
RegisterDemand get_temp_reg_changes(Instruction* instr);
|
||||
|
||||
/* adjust num_waves for workgroup size and LDS limits */
|
||||
uint16_t max_suitable_waves(Program* program, uint16_t waves);
|
||||
|
||||
@@ -55,6 +55,23 @@ get_temp_registers(Instruction* instr)
|
||||
return demand_after;
|
||||
}
|
||||
|
||||
RegisterDemand get_temp_reg_changes(Instruction* instr)
|
||||
{
|
||||
RegisterDemand available_def_space;
|
||||
|
||||
for (Definition def : instr->definitions) {
|
||||
if (def.isTemp())
|
||||
available_def_space += def.getTemp();
|
||||
}
|
||||
|
||||
for (Operand op : instr->operands) {
|
||||
if (op.isFirstKillBeforeDef() || op.isCopyKill())
|
||||
available_def_space -= op.getTemp();
|
||||
}
|
||||
|
||||
return available_def_space;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct live_ctx {
|
||||
|
||||
Reference in New Issue
Block a user