aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-01-16 16:06:59 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-01-16 16:06:59 +0000
commitf5f1689ed28025cef601034052ef9c214797e8af (patch)
treec26250ba02631517d142363431ba07b08290aa74 /lib/CodeGen/LiveIntervalAnalysis.cpp
parentcbbbdf768fa67ecc17d5532100498c44d91f244d (diff)
Use a list instead of a vector to store intervals. This will be needed
when we join intervals and one of the two will need to be removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 6826b4d649..212bc6f1eb 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -114,7 +114,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
unsigned reg = mop.getAllocatedRegNum();
Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg);
assert(r2iit != r2iMap_.end());
- intervals_[r2iit->second].weight += pow(10.0F, loopDepth);
+ r2iit->second->weight += pow(10.0F, loopDepth);
}
}
}
@@ -148,11 +148,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb,
// add new interval
intervals_.push_back(Interval(reg));
// update interval index for this register
- r2iMap_[reg] = intervals_.size() - 1;
+ r2iMap_.insert(std::make_pair(reg, --intervals_.end()));
interval = &intervals_.back();
}
else {
- interval = &intervals_[r2iit->second];
+ interval = &*r2iit->second;
}
for (MbbIndex2MbbMap::iterator
@@ -241,15 +241,14 @@ exit:
Reg2IntervalMap::iterator r2iit = r2iMap_.find(reg);
if (r2iit != r2iMap_.end()) {
- unsigned ii = r2iit->second;
- Interval& interval = intervals_[ii];
+ Interval& interval = *r2iit->second;
interval.addRange(start, end);
}
else {
intervals_.push_back(Interval(reg));
Interval& interval = intervals_.back();
// update interval index for this register
- r2iMap_[reg] = intervals_.size() - 1;
+ r2iMap_.insert(std::make_pair(reg, --intervals_.end()));
interval.addRange(start, end);
}
}
@@ -318,7 +317,7 @@ void LiveIntervals::computeIntervals()
}
}
- std::sort(intervals_.begin(), intervals_.end(), StartPointComp());
+ intervals_.sort(StartPointComp());
DEBUG(std::copy(intervals_.begin(), intervals_.end(),
std::ostream_iterator<Interval>(std::cerr, "\n")));
}