summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-06-04 18:08:29 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-06-04 18:08:29 +0000
commit864827afb0e9bb49f644f6d98d1ef43101a9f739 (patch)
tree99a9cf6adcad03a3bffa38eb402b167a0b419e61 /llvm/lib/CodeGen
parentd1b9311afa7ae1a775a1b12471cc078d16c78040 (diff)
downloadbcm5719-llvm-864827afb0e9bb49f644f6d98d1ef43101a9f739.tar.gz
bcm5719-llvm-864827afb0e9bb49f644f6d98d1ef43101a9f739.zip
Keep track of the call instructions whose clobber lists were skipped during fast
register allocation. Process all of the clobber lists at the end of the function, marking the registers as used in MachineRegisterInfo. This is necessary in case the calls clobber callee-saved registers (sic). llvm-svn: 105473
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocFast.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index b3b57607086..41a3545f046 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -110,6 +110,11 @@ namespace {
// Allocatable - vector of allocatable physical registers.
BitVector Allocatable;
+ // SkippedInstrs - Descriptors of instructions whose clobber list was ignored
+ // because all registers were spilled. It is still necessary to mark all the
+ // clobbered registers as used by the function.
+ SmallPtrSet<const TargetInstrDesc*, 4> SkippedInstrs;
+
// isBulkSpilling - This flag is set when LiveRegMap will be cleared
// completely after spilling all live registers. LiveRegMap entries should
// not be erased.
@@ -752,6 +757,10 @@ void RAFast::AllocateBasicBlock() {
DefOpEnd = VirtOpEnd;
DEBUG(dbgs() << " Spilling remaining registers before call.\n");
spillAll(MI);
+
+ // The imp-defs are skipped below, but we still need to mark those
+ // registers as used by the function.
+ SkippedInstrs.insert(&TID);
}
// Third scan.
@@ -837,6 +846,14 @@ bool RAFast::runOnMachineFunction(MachineFunction &Fn) {
// Make sure the set of used physregs is closed under subreg operations.
MRI->closePhysRegsUsed(*TRI);
+ // Add the clobber lists for all the instructions we skipped earlier.
+ for (SmallPtrSet<const TargetInstrDesc*, 4>::const_iterator
+ I = SkippedInstrs.begin(), E = SkippedInstrs.end(); I != E; ++I)
+ if (const unsigned *Defs = (*I)->getImplicitDefs())
+ while (*Defs)
+ MRI->setPhysRegUsed(*Defs++);
+
+ SkippedInstrs.clear();
StackSlotForVirtReg.clear();
return true;
}
OpenPOWER on IntegriCloud