aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-17 02:49:18 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-17 02:49:18 +0000
commit4b6bbe885d851b1cfba2be9b5efc6365a2b7828a (patch)
tree454eb7e2f1d534541110bf18792c577eecc69f48 /lib/CodeGen/RegAllocFast.cpp
parent844db9cc6f1a9458b60b8debeef3132f555dcd8f (diff)
downloadexternal_llvm-4b6bbe885d851b1cfba2be9b5efc6365a2b7828a.zip
external_llvm-4b6bbe885d851b1cfba2be9b5efc6365a2b7828a.tar.gz
external_llvm-4b6bbe885d851b1cfba2be9b5efc6365a2b7828a.tar.bz2
Now that we don't keep live registers across calls, there is not reason to go
through the very long list of call-clobbered registers. We just assume all registers are clobbered. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--lib/CodeGen/RegAllocFast.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp
index 060ee77..484b365 100644
--- a/lib/CodeGen/RegAllocFast.cpp
+++ b/lib/CodeGen/RegAllocFast.cpp
@@ -736,9 +736,20 @@ void RAFast::AllocateBasicBlock() {
UsedInInstr.set(Alias);
}
+ unsigned DefOpEnd = MI->getNumOperands();
+ if (TID.isCall()) {
+ // Spill all virtregs before a call. This serves two purposes: 1. If an
+ // exception is thrown, the landing pad is going to expect to find registers
+ // in their spill slots, and 2. we don't have to wade through all the
+ // <imp-def> operands on the call instruction.
+ DefOpEnd = VirtOpEnd;
+ DEBUG(dbgs() << " Spilling remaining registers before call.\n");
+ spillAll(MI);
+ }
+
// Third scan.
// Allocate defs and collect dead defs.
- for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ for (unsigned i = 0; i != DefOpEnd; ++i) {
MachineOperand &MO = MI->getOperand(i);
if (!MO.isReg() || !MO.isDef() || !MO.getReg()) continue;
unsigned Reg = MO.getReg();
@@ -758,12 +769,6 @@ void RAFast::AllocateBasicBlock() {
setPhysReg(MO, PhysReg);
}
- // Spill all dirty virtregs before a call, in case of an exception.
- if (TID.isCall()) {
- DEBUG(dbgs() << " Spilling remaining registers before call.\n");
- spillAll(MI);
- }
-
// Process virtreg deads.
for (unsigned i = 0, e = VirtKills.size(); i != e; ++i)
killVirtReg(VirtKills[i]);