summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocLocal.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-05 04:13:58 +0000
committerChris Lattner <sabre@nondot.org>2003-08-05 04:13:58 +0000
commit92a199dca73405514a91ed79c1893ac6b5ed8a20 (patch)
treeb27134c956a83928a4af4a6ed62a8894af8403fd /llvm/lib/CodeGen/RegAllocLocal.cpp
parent9c9b4c54fa72205e9ec3be59ee6533201e040736 (diff)
downloadbcm5719-llvm-92a199dca73405514a91ed79c1893ac6b5ed8a20.tar.gz
bcm5719-llvm-92a199dca73405514a91ed79c1893ac6b5ed8a20.zip
Fix bugs handling ESP in alloca references
llvm-svn: 7591
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocLocal.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp
index bf1670229ae..1b84b30f57f 100644
--- a/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/llvm/lib/CodeGen/RegAllocLocal.cpp
@@ -232,7 +232,8 @@ void RA::removePhysReg(unsigned PhysReg) {
///
void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
unsigned VirtReg, unsigned PhysReg) {
- assert((VirtReg || DisableKill) && "Spilling a physical register is illegal!"
+ if (!VirtReg && DisableKill) return;
+ assert(VirtReg && "Spilling a physical register is illegal!"
" Must not have appropriate kill for the register or use exists beyond"
" the intended one.");
DEBUG(std::cerr << " Spilling register " << RegInfo->getName(PhysReg);
@@ -606,8 +607,10 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
// Spill all physical registers holding virtual registers now.
while (!PhysRegsUsed.empty())
- spillVirtReg(MBB, I, PhysRegsUsed.begin()->second,
- PhysRegsUsed.begin()->first);
+ if (unsigned VirtReg = PhysRegsUsed.begin()->second)
+ spillVirtReg(MBB, I, VirtReg, PhysRegsUsed.begin()->first);
+ else
+ removePhysReg(PhysRegsUsed.begin()->first);
for (std::map<unsigned, unsigned>::iterator I = Virt2PhysRegMap.begin(),
E = Virt2PhysRegMap.end(); I != E; ++I)
OpenPOWER on IntegriCloud