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

Evan Cheng evan.cheng at apple.com
Fri Feb 16 01:05:20 PST 2007



Changes in directory llvm/lib/CodeGen:

RegAllocLinearScan.cpp updated: 1.136 -> 1.137
---
Log message:

Add live-ins to every BB.

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

 RegAllocLinearScan.cpp |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)


Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.136 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.137
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.136	Tue Dec 19 16:41:21 2006
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp	Fri Feb 16 03:05:02 2007
@@ -291,6 +291,26 @@
     i = IntervalPtrs::reverse_iterator(inactive_.erase(i.base()-1));
   }
 
+  // A brute force way of adding live-ins to every BB.
+  for (MachineFunction::iterator MBB = mf_->begin(), E = mf_->end();
+       MBB != E; ++MBB) {
+    unsigned StartIdx = li_->getMBBStartIdx(MBB->getNumber());
+    for (IntervalPtrs::iterator i = fixed_.begin(), e = fixed_.end();
+         i != e; ++i)
+      if (i->first->liveAt(StartIdx))
+        MBB->addLiveIn(i->first->reg);
+
+    for (unsigned i = 0, e = handled_.size(); i != e; ++i) { 
+      LiveInterval *HI = handled_[i];
+      if (HI->liveAt(StartIdx)) {
+        unsigned Reg = HI->reg;
+        if (MRegisterInfo::isVirtualRegister(Reg))
+          Reg = vrm_->getPhys(Reg);
+        MBB->addLiveIn(Reg);
+      }
+    }
+  }
+
   DOUT << *vrm_;
 }
 






More information about the llvm-commits mailing list