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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Dec 13 05:59:01 PST 2003


Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.8 -> 1.9

---
Log message:

When reserving a preallocated register spill the aliases of this
register too.


---
Diffs of the changes:  (+16 -0)

Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.8 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.9
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.8	Fri Dec 12 23:50:19 2003
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Sat Dec 13 05:58:10 2003
@@ -628,6 +628,22 @@
         assignVirt2StackSlot(virtReg);
     }
     p2vMap_[physReg] = physReg; // this denotes a reserved physical register
+
+    // if it also aliases any other registers with values spill them too
+    for (const unsigned* as = mri_->getAliasSet(physReg); *as; ++as) {
+        unsigned virtReg = p2vMap_[*as];
+        if (virtReg != 0 && virtReg != *as) {
+            // remove interval from active
+            for (IntervalPtrs::iterator i = active_.begin(), e = active_.end();
+                 i != e; ++i) {
+                if ((*i)->reg == virtReg) {
+                    active_.erase(i);
+                    break;
+                }
+            }
+            assignVirt2StackSlot(virtReg);
+        }
+    }
 }
 
 void RA::clearReservedPhysReg(unsigned physReg)





More information about the llvm-commits mailing list