[llvm-commits] [llvm] r78913 - /llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Aug 13 09:20:05 PDT 2009
Author: stoklund
Date: Thu Aug 13 11:20:04 2009
New Revision: 78913
URL: http://llvm.org/viewvc/llvm-project?rev=78913&view=rev
Log:
Track pristine registers as if they were live-in in the register scavenger.
Modified:
llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=78913&r1=78912&r2=78913&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Thu Aug 13 11:20:04 2009
@@ -69,12 +69,18 @@
// Reserved registers are always used.
RegsAvailable ^= ReservedRegs;
- // Live-in registers are in use.
- if (!MBB || MBB->livein_empty())
+ if (!MBB)
return;
+
+ // Live-in registers are in use.
for (MachineBasicBlock::const_livein_iterator I = MBB->livein_begin(),
E = MBB->livein_end(); I != E; ++I)
setUsed(*I);
+
+ // Pristine CSRs are also unavailable.
+ BitVector PR = MBB->getParent()->getFrameInfo()->getPristineRegs(MBB);
+ for (int I = PR.find_first(); I>0; I = PR.find_next(I))
+ setUsed(I);
}
void RegScavenger::enterBasicBlock(MachineBasicBlock *mbb) {
@@ -370,11 +376,10 @@
}
}
- // If we found an unused register that is defined by a later instruction,
- // there is no reason to spill it. We have probably found a callee-saved
- // register that has been saved in the prologue, but happens to be unused at
- // this point.
- if (!isAliasUsed(Reg) && UseMI != NULL)
+ // If we found an unused register there is no reason to spill it. We have
+ // probably found a callee-saved register that has been saved in the
+ // prologue, but happens to be unused at this point.
+ if (!isAliasUsed(Reg))
return Reg;
if (Dist >= MaxDist) {
@@ -391,13 +396,6 @@
// Avoid infinite regress
ScavengedReg = SReg;
- // Make sure SReg is marked as used. It could be considered available
- // if it is one of the callee saved registers, but hasn't been spilled.
- if (!isUsed(SReg)) {
- MBB->addLiveIn(SReg);
- setUsed(SReg);
- }
-
// Spill the scavenged register before I.
TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC);
MachineBasicBlock::iterator II = prior(I);
More information about the llvm-commits
mailing list