From 349908587f73ee186693af43812536f15e7c6311 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 16 Nov 2020 14:51:33 +0000 Subject: [PATCH] aco: move update_renames() out of get_reg() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is necessary for the next commit, which will pass a temporary copy of the register file to get_reg(). Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 9f727576a6a..42c7064ccb9 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1240,10 +1240,8 @@ PhysReg get_reg(ra_ctx& ctx, /* try to find space with live-range splits */ res = get_reg_impl(ctx, reg_file, parallelcopies, info, instr); - if (res.second) { - update_renames(ctx, reg_file, parallelcopies, instr, instr->opcode != aco_opcode::p_create_vector); + if (res.second) return res.first; - } /* try using more registers */ @@ -1527,6 +1525,7 @@ void get_reg_for_operand(ra_ctx& ctx, RegisterFile& register_file, /* find free reg */ PhysReg reg = get_reg(ctx, register_file, pc_op.getTemp(), parallelcopy, ctx.pseudo_dummy); + update_renames(ctx, register_file, parallelcopy, ctx.pseudo_dummy, true); Definition pc_def = Definition(PhysReg{reg}, pc_op.regClass()); parallelcopy.emplace_back(pc_op, pc_def); blocking_var = true; @@ -1535,6 +1534,7 @@ void get_reg_for_operand(ra_ctx& ctx, RegisterFile& register_file, } else { dst = get_reg(ctx, register_file, operand.getTemp(), parallelcopy, instr, operand_index); + update_renames(ctx, register_file, parallelcopy, instr, instr->opcode != aco_opcode::p_create_vector); } Operand pc_op = operand; @@ -1899,8 +1899,10 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc break; } } - if (!definition.isFixed()) + if (!definition.isFixed()) { definition.setFixed(get_reg(ctx, register_file, definition.getTemp(), parallelcopy, phi)); + update_renames(ctx, register_file, parallelcopy, phi, true); + } /* process parallelcopy */ for (std::pair pc : parallelcopy) { @@ -2195,6 +2197,7 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc } else { definition->setFixed(get_reg(ctx, register_file, tmp, parallelcopy, instr)); } + update_renames(ctx, register_file, parallelcopy, instr, instr->opcode != aco_opcode::p_create_vector); } assert(definition->isFixed() && ((definition->getTemp().type() == RegType::vgpr && definition->physReg() >= 256) || @@ -2317,6 +2320,7 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc Temp tmp = program->allocateTmp(can_sgpr ? s1 : v1); ctx.assignments.emplace_back(); PhysReg reg = get_reg(ctx, register_file, tmp, parallelcopy, instr); + update_renames(ctx, register_file, parallelcopy, instr, true); aco_ptr mov; if (can_sgpr)