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

Alkis Evlogimenos alkis at niobe.cs.uiuc.edu
Tue Mar 16 18:50:01 PST 2004


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.69 -> 1.70

---
Log message:

Make the set of fixed (preallocated) intervals be a fixed superset of
unhandled + handled. So unhandled is now including all fixed intervals
and fixed intervals never changes when processing a function.


---
Diffs of the changes:  (+10 -29)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.69 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.70
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.69	Mon Mar  1 17:18:15 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Tue Mar 16 18:48:59 2004
@@ -135,9 +135,9 @@
 void RA::releaseMemory()
 {
     unhandled_.clear();
+    fixed_.clear();
     active_.clear();
     inactive_.clear();
-    fixed_.clear();
     handled_.clear();
 }
 
@@ -171,25 +171,10 @@
     DEBUG(printIntervals("active", active_.begin(), active_.end()));
     DEBUG(printIntervals("inactive", inactive_.begin(), inactive_.end()));
 
-    while (!unhandled_.empty() || !fixed_.empty()) {
+    while (!unhandled_.empty()) {
         // pick the interval with the earliest start point
-        IntervalPtrs::value_type cur;
-        if (fixed_.empty()) {
-            cur = unhandled_.front();
-            unhandled_.pop_front();
-        }
-        else if (unhandled_.empty()) {
-            cur = fixed_.front();
-            fixed_.pop_front();
-        }
-        else if (unhandled_.front()->start() < fixed_.front()->start()) {
-            cur = unhandled_.front();
-            unhandled_.pop_front();
-        }
-        else {
-            cur = fixed_.front();
-            fixed_.pop_front();
-        }
+        IntervalPtrs::value_type cur = unhandled_.front();
+        unhandled_.pop_front();
 
         DEBUG(std::cerr << "\n*** CURRENT ***: " << *cur << '\n');
 
@@ -234,10 +219,9 @@
 
     for (LiveIntervals::Intervals::iterator i = li.begin(), e = li.end();
          i != e; ++i) {
+        unhandled_.push_back(&*i);
         if (MRegisterInfo::isPhysicalRegister(i->reg))
             fixed_.push_back(&*i);
-        else
-            unhandled_.push_back(&*i);
     }
 }
 
@@ -444,7 +428,7 @@
 
     DEBUG(std::cerr << "\t\trolling back to: " << earliestStart << '\n');
     // scan handled in reverse order and undo each one, restoring the
-    // state of unhandled and fixed
+    // state of unhandled
     while (!handled_.empty()) {
         IntervalPtrs::value_type i = handled_.back();
         // if this interval starts before t we are done
@@ -456,8 +440,8 @@
         if ((it = find(active_.begin(), active_.end(), i)) != active_.end()) {
             active_.erase(it);
             if (MRegisterInfo::isPhysicalRegister(i->reg)) {
-                fixed_.push_front(i);
                 prt_->delRegUse(i->reg);
+                unhandled_.push_front(i);
             }
             else {
                 prt_->delRegUse(vrm_->getPhys(i->reg));
@@ -479,7 +463,7 @@
         else if ((it = find(inactive_.begin(), inactive_.end(), i)) != inactive_.end()) {
             inactive_.erase(it);
             if (MRegisterInfo::isPhysicalRegister(i->reg))
-                fixed_.push_front(i);
+                unhandled_.push_front(i);
             else {
                 vrm_->clearVirt(i->reg);
                 if (i->spilled()) {
@@ -496,12 +480,9 @@
             }
         }
         else {
-            if (MRegisterInfo::isPhysicalRegister(i->reg))
-                fixed_.push_front(i);
-            else {
+            if (MRegisterInfo::isVirtualRegister(i->reg))
                 vrm_->clearVirt(i->reg);
-                unhandled_.push_front(i);
-            }
+            unhandled_.push_front(i);
         }
     }
 





More information about the llvm-commits mailing list