[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Nov 17 20:13:14 PST 2004
Changes in directory llvm/lib/CodeGen:
RegAllocLinearScan.cpp updated: 1.100 -> 1.101
---
Log message:
Start using the iterators in the fixed_ intervals to avoid having to binary
search physreg intervals every time we access it. This takes another
half second off of linscan.
---
Diffs of the changes: (+12 -5)
Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.100 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.101
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.100 Wed Nov 17 21:49:30 2004
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 17 22:13:02 2004
@@ -292,6 +292,7 @@
void RA::processInactiveIntervals(unsigned CurPoint)
{
DEBUG(std::cerr << "\tprocessing inactive intervals:\n");
+
for (unsigned i = 0, e = inactive_.size(); i != e; ++i) {
LiveInterval *Interval = inactive_[i].first;
LiveInterval::iterator IntervalPos = inactive_[i].second;
@@ -363,6 +364,8 @@
spillWeights_.assign(mri_->getNumRegs(), 0.0);
+ unsigned StartPosition = cur->beginNumber();
+
// for each interval in active update spill weights
for (IntervalPtrs::const_iterator i = active_.begin(), e = active_.end();
i != e; ++i) {
@@ -387,13 +390,17 @@
// For every interval in fixed we overlap with, mark the register as not free
// and update spill weights.
- for (IntervalPtrs::const_iterator i = fixed_.begin(),
- e = fixed_.end(); i != e; ++i)
- if (cur->overlapsFrom(*i->first, i->second)) {
- unsigned reg = i->first->reg;
+ for (unsigned i = 0, e = fixed_.size(); i != e; ++i) {
+ IntervalPtr &IP = fixed_[i];
+ LiveInterval *I = IP.first;
+ LiveInterval::iterator II = I->advanceTo(IP.second, StartPosition);
+ IP.second = II;
+ if (cur->overlapsFrom(*I, II)) {
+ unsigned reg = I->reg;
prt_->addRegUse(reg);
- updateSpillWeights(reg, i->first->weight);
+ updateSpillWeights(reg, I->weight);
}
+ }
unsigned physReg = getFreePhysReg(cur);
// restore the physical register tracker
More information about the llvm-commits
mailing list