[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLocal.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 4 23:15:01 PDT 2003


Changes in directory llvm/lib/CodeGen:

RegAllocLocal.cpp updated: 1.22 -> 1.23

---
Log message:

Fix bugs handling ESP in alloca references


---
Diffs of the changes:

Index: llvm/lib/CodeGen/RegAllocLocal.cpp
diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.22 llvm/lib/CodeGen/RegAllocLocal.cpp:1.23
--- llvm/lib/CodeGen/RegAllocLocal.cpp:1.22	Mon Aug  4 19:49:09 2003
+++ llvm/lib/CodeGen/RegAllocLocal.cpp	Mon Aug  4 23:13:58 2003
@@ -232,7 +232,8 @@
 ///
 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 @@
 
   // 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)





More information about the llvm-commits mailing list