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

Alkis Evlogimenos alkis at cs.uiuc.edu
Fri Dec 5 05:19:01 PST 2003


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.5 -> 1.6

---
Log message:

Fix bug in register spilling when a preallocated live range overlaps a
potential register assignment.


---
Diffs of the changes:  (+3 -13)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.5 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.6
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.5	Wed Dec  3 21:57:28 2003
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Fri Dec  5 05:17:55 2003
@@ -251,16 +251,6 @@
         // if this register is preallocated, look for an interval that
         // overlaps with it and assign it to a memory location
         if (i->reg < MRegisterInfo::FirstVirtualRegister) {
-            for (IntervalPtrs::iterator
-                     ai = active_.begin(), ae = active_.end(); ai != ae; ++ai) {
-                unsigned virtReg = (*ai)->reg;
-                Virt2PhysMap::const_iterator it = v2pMap_.find(virtReg);
-                if (it != v2pMap_.end() && it->second == i->reg) {
-                    active_.erase(ai);
-                    clearVirtReg(virtReg);
-                    break;
-                }
-            }
             reservePhysReg(i->reg);
             active_.push_back(&*i);
         }
@@ -607,7 +597,7 @@
 
 void RA::reservePhysReg(unsigned physReg)
 {
-    DEBUG(std::cerr << "\t\t\treserving physical physical register: "
+    DEBUG(std::cerr << "\t\t\treserving physical register: "
           << mri_->getName(physReg) << '\n');
     // if this register holds a value spill it
     unsigned virtReg = p2vMap_[physReg];
@@ -621,14 +611,14 @@
                 break;
             }
         }
-        spillVirtReg(virtReg);
+        assignVirt2StackSlot(virtReg);
     }
     p2vMap_[physReg] = physReg; // this denotes a reserved physical register
 }
 
 void RA::clearReservedPhysReg(unsigned physReg)
 {
-    DEBUG(std::cerr << "\t\t\tclearing reserved physical physical register: "
+    DEBUG(std::cerr << "\t\t\tclearing reserved physical register: "
           << mri_->getName(physReg) << '\n');
     assert(p2vMap_[physReg] == physReg &&
            "attempt to clear a non reserved physical register");





More information about the llvm-commits mailing list