aco: change signature of get_live_changes() and get_temp_registers()

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30182>
This commit is contained in:
Daniel Schürmann
2024-07-05 11:54:16 +02:00
committed by Marge Bot
parent d494c2a741
commit 5a39cbdef6
3 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -2225,8 +2225,8 @@ void _aco_err(Program* program, const char* file, unsigned line, const char* fmt
int get_op_fixed_to_def(Instruction* instr);
/* utilities for dealing with register demand */
RegisterDemand get_live_changes(aco_ptr<Instruction>& instr);
RegisterDemand get_temp_registers(aco_ptr<Instruction>& instr);
RegisterDemand get_live_changes(Instruction* instr);
RegisterDemand get_temp_registers(Instruction* instr);
/* number of sgprs that need to be allocated but might notbe addressable as s0-s105 */
uint16_t get_extra_sgprs(Program* program);
+3 -3
View File
@@ -10,7 +10,7 @@
namespace aco {
RegisterDemand
get_live_changes(aco_ptr<Instruction>& instr)
get_live_changes(Instruction* instr)
{
RegisterDemand changes;
for (const Definition& def : instr->definitions) {
@@ -40,7 +40,7 @@ get_additional_operand_demand(Instruction* instr)
}
RegisterDemand
get_temp_registers(aco_ptr<Instruction>& instr)
get_temp_registers(Instruction* instr)
{
RegisterDemand demand_before;
RegisterDemand demand_after;
@@ -60,7 +60,7 @@ get_temp_registers(aco_ptr<Instruction>& instr)
}
}
demand_before += get_additional_operand_demand(instr.get());
demand_before += get_additional_operand_demand(instr);
demand_after.update(demand_before);
return demand_after;
}
+7 -6
View File
@@ -228,13 +228,13 @@ MoveState::downwards_move(DownwardsCursor& cursor, bool add_to_clause)
}
/* Check the new demand of the instructions being moved over */
const RegisterDemand candidate_diff = get_live_changes(instr);
const RegisterDemand candidate_diff = get_live_changes(instr.get());
if (RegisterDemand(register_pressure - candidate_diff).exceeds(max_registers))
return move_fail_pressure;
/* New demand for the moved instruction */
const RegisterDemand temp = get_temp_registers(instr);
const RegisterDemand temp2 = get_temp_registers(block->instructions[dest_insert_idx - 1]);
const RegisterDemand temp = get_temp_registers(instr.get());
const RegisterDemand temp2 = get_temp_registers(block->instructions[dest_insert_idx - 1].get());
const RegisterDemand new_demand =
block->instructions[dest_insert_idx - 1]->register_demand - temp2 + temp;
if (new_demand.exceeds(max_registers))
@@ -356,11 +356,12 @@ MoveState::upwards_move(UpwardsCursor& cursor)
/* check if register pressure is low enough: the diff is negative if register pressure is
* decreased */
const RegisterDemand candidate_diff = get_live_changes(instr);
const RegisterDemand temp = get_temp_registers(instr);
const RegisterDemand candidate_diff = get_live_changes(instr.get());
const RegisterDemand temp = get_temp_registers(instr.get());
if (RegisterDemand(cursor.total_demand + candidate_diff).exceeds(max_registers))
return move_fail_pressure;
const RegisterDemand temp2 = get_temp_registers(block->instructions[cursor.insert_idx - 1]);
const RegisterDemand temp2 =
get_temp_registers(block->instructions[cursor.insert_idx - 1].get());
const RegisterDemand new_demand =
block->instructions[cursor.insert_idx - 1]->register_demand - temp2 + candidate_diff + temp;
if (new_demand.exceeds(max_registers))