summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-05-28 20:54:50 +0000
committerOwen Anderson <resistor@mac.com>2008-05-28 20:54:50 +0000
commit4f8e1ad32a3f4bb93d658e07dd5ef65e088ffe3e (patch)
treefa9ace4e98854cd2f588904b534a993667dc2cbb /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parentae2c57fbbef31fd9a9a6631e79f43569035df4fb (diff)
downloadbcm5719-llvm-4f8e1ad32a3f4bb93d658e07dd5ef65e088ffe3e.tar.gz
bcm5719-llvm-4f8e1ad32a3f4bb93d658e07dd5ef65e088ffe3e.zip
Factor the numbering computation into a separate method, and add the slightest attempt at some renumbering logic, which is currently unused.
llvm-svn: 51652
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 2558b09ad60..d49dfd058c5 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -75,17 +75,14 @@ void LiveIntervals::releaseMemory() {
delete ClonedMIs[i];
}
-/// runOnMachineFunction - Register allocate the whole function
-///
-bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
- mf_ = &fn;
- mri_ = &mf_->getRegInfo();
- tm_ = &fn.getTarget();
- tri_ = tm_->getRegisterInfo();
- tii_ = tm_->getInstrInfo();
- lv_ = &getAnalysis<LiveVariables>();
- allocatableRegs_ = tri_->getAllocatableSet(fn);
-
+void LiveIntervals::computeNumbering() {
+ Index2MiMap OldI2MI = i2miMap_;
+
+ Idx2MBBMap.clear();
+ MBB2IdxMap.clear();
+ mi2iMap_.clear();
+ i2miMap_.clear();
+
// Number MachineInstrs and MachineBasicBlocks.
// Initialize MBB indexes to a sentinal.
MBB2IdxMap.resize(mf_->getNumBlockIDs(), std::make_pair(~0U,~0U));
@@ -110,7 +107,28 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
}
std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
+
+ if (!OldI2MI.empty())
+ for (iterator I = begin(), E = end(); I != E; ++I)
+ for (LiveInterval::iterator LI = I->second.begin(), LE = I->second.end();
+ LI != LE; ++LI) {
+ LI->start = mi2iMap_[OldI2MI[LI->start]];
+ LI->end = mi2iMap_[OldI2MI[LI->end]];
+ }
+}
+
+/// runOnMachineFunction - Register allocate the whole function
+///
+bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
+ mf_ = &fn;
+ mri_ = &mf_->getRegInfo();
+ tm_ = &fn.getTarget();
+ tri_ = tm_->getRegisterInfo();
+ tii_ = tm_->getInstrInfo();
+ lv_ = &getAnalysis<LiveVariables>();
+ allocatableRegs_ = tri_->getAllocatableSet(fn);
+ computeNumbering();
computeIntervals();
numIntervals += getNumIntervals();
OpenPOWER on IntegriCloud