From 499656eb9781c77febdd47f2e34f7fdf4a12a24a Mon Sep 17 00:00:00 2001 From: William Chen Date: Thu, 29 Apr 2021 16:49:40 -0700 Subject: [PATCH] fix color RA where local spill spillIdx should have just one idx for def/use --- .../maple_be/src/cg/aarch64/aarch64_color_ra.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mapleall/maple_be/src/cg/aarch64/aarch64_color_ra.cpp b/src/mapleall/maple_be/src/cg/aarch64/aarch64_color_ra.cpp index a873e0c38b..7ce769e40a 100644 --- a/src/mapleall/maple_be/src/cg/aarch64/aarch64_color_ra.cpp +++ b/src/mapleall/maple_be/src/cg/aarch64/aarch64_color_ra.cpp @@ -3013,8 +3013,7 @@ void GraphColorRegAllocator::FinalizeRegisters() { FinalizeRegisterInfo *fInfo = memPool->New(alloc); uint64 usedRegMask = FinalizeRegisterPreprocess(*fInfo, *insn); - uint32 defSpillIdx = 0; - uint32 useSpillIdx = 0; + uint32 spillIdx = 0; MemOperand *memOpnd = nullptr; if (fInfo->GetBaseOperand()) { memOpnd = static_cast( @@ -3022,8 +3021,7 @@ void GraphColorRegAllocator::FinalizeRegisters() { insn->SetOperand(fInfo->GetMemOperandIdx(), *memOpnd); Operand *base = memOpnd->GetBaseRegister(); ASSERT(base != nullptr, "nullptr check"); - /* if base register is both defReg and useReg, defSpillIdx should also be increased. But it doesn't exist yet */ - RegOperand *phyOpnd = GetReplaceOpnd(*insn, *base, useSpillIdx, usedRegMask, false); + RegOperand *phyOpnd = GetReplaceOpnd(*insn, *base, spillIdx, usedRegMask, false); if (phyOpnd != nullptr) { memOpnd->SetBaseRegister(*phyOpnd); } @@ -3031,7 +3029,7 @@ void GraphColorRegAllocator::FinalizeRegisters() { if (fInfo->GetOffsetOperand()) { ASSERT(memOpnd != nullptr, "mem operand cannot be null"); Operand *offset = memOpnd->GetIndexRegister(); - RegOperand *phyOpnd = GetReplaceOpnd(*insn, *offset, useSpillIdx, usedRegMask, false); + RegOperand *phyOpnd = GetReplaceOpnd(*insn, *offset, spillIdx, usedRegMask, false); if (phyOpnd != nullptr) { memOpnd->SetIndexRegister(*phyOpnd); } @@ -3039,18 +3037,14 @@ void GraphColorRegAllocator::FinalizeRegisters() { for (size_t i = 0; i < fInfo->GetDefOperandsSize(); ++i) { const Operand *opnd = fInfo->GetDefOperandsElem(i); RegOperand *phyOpnd = nullptr; - if (insn->IsSpecialIntrinsic()) { - phyOpnd = GetReplaceOpnd(*insn, *opnd, useSpillIdx, usedRegMask, true); - } else { - phyOpnd = GetReplaceOpnd(*insn, *opnd, defSpillIdx, usedRegMask, true); - } + phyOpnd = GetReplaceOpnd(*insn, *opnd, spillIdx, usedRegMask, true); if (phyOpnd != nullptr) { insn->SetOperand(fInfo->GetDefIdxElem(i), *phyOpnd); } } for (size_t i = 0; i < fInfo->GetUseOperandsSize(); ++i) { const Operand *opnd = fInfo->GetUseOperandsElem(i); - RegOperand *phyOpnd = GetReplaceOpnd(*insn, *opnd, useSpillIdx, usedRegMask, false); + RegOperand *phyOpnd = GetReplaceOpnd(*insn, *opnd, spillIdx, usedRegMask, false); if (phyOpnd != nullptr) { insn->SetOperand(fInfo->GetUseIdxElem(i), *phyOpnd); } -- Gitee