From 3fd1f5bb6af4616f72f6e7920c2fc4b334277416 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 5 Aug 2003 22:11:13 +0000 Subject: [PATCH] Use a new local data structure instead of the MachineInstr::regsUsed set git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7621 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | 15 +++++++-------- lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp | 15 +++++++-------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index e06e8c1d612..791421babf3 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -1059,7 +1059,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType, // of copying it to memory and back. But we have to mark the // register as used by this instruction, so it does not get used // as a scratch reg. by another operand or anyone else. - MInst->insertUsedReg(scratchReg); + ScratchRegsUsed.insert(std::make_pair(MInst, scratchReg)); MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType); MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType); } @@ -1175,13 +1175,12 @@ void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC, int RegType, markRegisterUsed(MI->getImplicitOp(i).getAllocatedRegNum(), RC, RegType,MRI); - // The getRegsUsed() method returns the set of scratch registers that are used - // to save values across the instruction (e.g., for saving state register - // values). - const std::set ®sUsed = MI->getRegsUsed(); - for (std::set::iterator I = regsUsed.begin(), - E = regsUsed.end(); I != E; ++I) - markRegisterUsed(*I, RC, RegType, MRI); + // Add all of the scratch registers that are used to save values across the + // instruction (e.g., for saving state register values). + std::pair + IR = ScratchRegsUsed.equal_range(MI); + for (ScratchRegsUsedTy::iterator I = IR.first; I != IR.second; ++I) + markRegisterUsed(I->second, RC, RegType, MRI); // If there are implicit references, mark their allocated regs as well // diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp index e06e8c1d612..791421babf3 100644 --- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp +++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp @@ -1059,7 +1059,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType, // of copying it to memory and back. But we have to mark the // register as used by this instruction, so it does not get used // as a scratch reg. by another operand or anyone else. - MInst->insertUsedReg(scratchReg); + ScratchRegsUsed.insert(std::make_pair(MInst, scratchReg)); MRI.cpReg2RegMI(MIBef, RegU, scratchReg, RegType); MRI.cpReg2RegMI(MIAft, scratchReg, RegU, RegType); } @@ -1175,13 +1175,12 @@ void PhyRegAlloc::setRelRegsUsedByThisInst(RegClass *RC, int RegType, markRegisterUsed(MI->getImplicitOp(i).getAllocatedRegNum(), RC, RegType,MRI); - // The getRegsUsed() method returns the set of scratch registers that are used - // to save values across the instruction (e.g., for saving state register - // values). - const std::set ®sUsed = MI->getRegsUsed(); - for (std::set::iterator I = regsUsed.begin(), - E = regsUsed.end(); I != E; ++I) - markRegisterUsed(*I, RC, RegType, MRI); + // Add all of the scratch registers that are used to save values across the + // instruction (e.g., for saving state register values). + std::pair + IR = ScratchRegsUsed.equal_range(MI); + for (ScratchRegsUsedTy::iterator I = IR.first; I != IR.second; ++I) + markRegisterUsed(I->second, RC, RegType, MRI); // If there are implicit references, mark their allocated regs as well // -- 2.34.1