diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-17 02:49:18 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-17 02:49:18 +0000 |
| commit | 1069a096916cef8a7c25c8eff2a91f59cc6ff2e8 (patch) | |
| tree | d5b54e20130eee5c60a2827a40affbe6ab4c061e /llvm/lib/CodeGen | |
| parent | 397068de0625ec841077edb24552c0de5472efde (diff) | |
| download | bcm5719-llvm-1069a096916cef8a7c25c8eff2a91f59cc6ff2e8.tar.gz bcm5719-llvm-1069a096916cef8a7c25c8eff2a91f59cc6ff2e8.zip | |
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.
llvm-svn: 103930
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocFast.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 060ee770abe..484b36580a0 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/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]); |

