aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/RegAllocLinearScan.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-16 09:05:02 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-16 09:05:02 +0000
commit9fc508fdc482789c8f81da99a13c63b822c1a99d (patch)
tree34053f03bca80bfcfedb60876154a796d0f35e85 /lib/CodeGen/RegAllocLinearScan.cpp
parent3481657da663423d610ef3ac7ad3f0680ef7c72d (diff)
downloadexternal_llvm-9fc508fdc482789c8f81da99a13c63b822c1a99d.zip
external_llvm-9fc508fdc482789c8f81da99a13c63b822c1a99d.tar.gz
external_llvm-9fc508fdc482789c8f81da99a13c63b822c1a99d.tar.bz2
Add live-ins to every BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 5c6512d..bd44e81 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -291,6 +291,26 @@ void RA::linearScan()
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_;
}