diff options
author | Chris Lattner <sabre@nondot.org> | 2004-11-18 04:13:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-11-18 04:13:02 +0000 |
commit | 49ff5f047716f61766a55ef1224181a8b8b3244d (patch) | |
tree | f24a1030e5e27bc197284e7f18fe9982fc7dffa4 /llvm/lib/CodeGen/RegAllocLinearScan.cpp | |
parent | 7598c316e50602d2612a27f5003412b4b3c71c3b (diff) | |
download | bcm5719-llvm-49ff5f047716f61766a55ef1224181a8b8b3244d.tar.gz bcm5719-llvm-49ff5f047716f61766a55ef1224181a8b8b3244d.zip |
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.
llvm-svn: 17937
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocLinearScan.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/llvm/lib/CodeGen/RegAllocLinearScan.cpp index 651e25a5607..0cb30430a37 100644 --- a/llvm/lib/CodeGen/RegAllocLinearScan.cpp +++ b/llvm/lib/CodeGen/RegAllocLinearScan.cpp @@ -292,6 +292,7 @@ void RA::processActiveIntervals(unsigned CurPoint) 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 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur) 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 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur) // 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 |