aco/live_var_analysis: inline block->register_demand updates

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29962>
This commit is contained in:
Daniel Schürmann 2024-06-26 12:07:12 +02:00 committed by Marge Bot
parent 2f4fb9eecf
commit 6729e81d15
2 changed files with 5 additions and 13 deletions

View file

@ -95,7 +95,7 @@ void
process_live_temps_per_block(live_ctx& ctx, Block* block)
{
RegisterDemand new_demand;
block->register_demand = RegisterDemand();
IDSet live = ctx.program->live.live_out[block->index];
/* initialize register demand */
@ -163,6 +163,7 @@ process_live_temps_per_block(live_ctx& ctx, Block* block)
RegisterDemand before_instr = new_demand + get_additional_operand_demand(insn);
insn->register_demand.update(before_instr);
block->register_demand.update(insn->register_demand);
}
/* handle phi definitions */
@ -250,6 +251,8 @@ process_live_temps_per_block(live_ctx& ctx, Block* block)
block->live_in_demand = new_demand;
block->live_in_demand.sgpr += 2; /* Add 2 SGPRs for potential long-jumps. */
block->register_demand.update(block->live_in_demand);
ctx.program->max_reg_demand.update(block->register_demand);
assert(!block->linear_preds.empty() || (new_demand == RegisterDemand() && live.empty()));
}
@ -432,17 +435,6 @@ live_var_analysis(Program* program)
process_live_temps_per_block(ctx, &program->blocks[ctx.worklist--]);
}
/* update block's register demand */
for (Block& block : program->blocks) {
if (program->progress < CompilationProgress::after_ra) {
block.register_demand = RegisterDemand();
for (const aco_ptr<Instruction>& instr : block.instructions)
block.register_demand.update(instr->register_demand);
}
program->max_reg_demand.update(block.register_demand);
}
/* calculate the program's register demand and number of waves */
if (program->progress < CompilationProgress::after_ra)
update_vgpr_sgpr_demand(program, program->max_reg_demand);

View file

@ -1221,7 +1221,7 @@ schedule_block(sched_ctx& ctx, Program* program, Block* block)
}
/* resummarize the block's register demand */
block->register_demand = RegisterDemand();
block->register_demand = block->live_in_demand;
for (const aco_ptr<Instruction>& instr : block->instructions)
block->register_demand.update(instr->register_demand);
}