summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-07-08 16:49:26 +0000
committerJim Grosbach <grosbach@apple.com>2010-07-08 16:49:26 +0000
commited903d746d96d071305b8182680595ba281b3f12 (patch)
treef0c6e5950bc015164ae4160b037050af13a89ddb /lib/CodeGen/PrologEpilogInserter.cpp
parent0bc25f40402f48ba42fc45403f635b20d90fabb3 (diff)
downloadllvm-ed903d746d96d071305b8182680595ba281b3f12.tar.gz
llvm-ed903d746d96d071305b8182680595ba281b3f12.tar.bz2
llvm-ed903d746d96d071305b8182680595ba281b3f12.tar.xz
Clean up scavengeRegister() a bit to prefer available regs, which allows
the simplification of frame index register scavenging to not have to check for available registers directly and instead just let scavengeRegister() handle it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index d1112d3c14..3843b25370 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -885,21 +885,7 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) {
// Scavenge a new scratch register
CurrentVirtReg = Reg;
const TargetRegisterClass *RC = Fn.getRegInfo().getRegClass(Reg);
- const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
- BitVector Candidates(TRI->getNumRegs());
- RS->getRegsAvailable(RC, Candidates);
-
- // If there are any registers available, use the one that's
- // unused for the longest after this instruction. That increases
- // the ability to reuse the value.
- if (Candidates.any()) {
- MachineBasicBlock::iterator UMI;
- CurrentScratchReg = RS->findSurvivorReg(I, Candidates, 25, UMI);
- } else {
- // No register is "free". Scavenge a register.
- CurrentScratchReg = RS->scavengeRegister(RC, I, SPAdj);
- }
-
+ CurrentScratchReg = RS->scavengeRegister(RC, I, SPAdj);
PrevValue = Value;
}
// replace this reference to the virtual register with the