[llvm-commits] [llvm] r89489 - /llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
David Greene
greened at obbligato.org
Fri Nov 20 13:13:27 PST 2009
Author: greened
Date: Fri Nov 20 15:13:27 2009
New Revision: 89489
URL: http://llvm.org/viewvc/llvm-project?rev=89489&view=rev
Log:
Cleanups.
Make things a little more efficient as suggested by Evan.
Modified:
llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=89489&r1=89488&r2=89489&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Nov 20 15:13:27 2009
@@ -87,6 +87,7 @@
// Initialize the queue to record recently-used registers.
if (NumRecentlyUsedRegs > 0)
RecentRegs.resize(NumRecentlyUsedRegs, 0);
+ RecentNext = RecentRegs.begin();
}
typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr;
@@ -154,14 +155,16 @@
std::auto_ptr<Spiller> spiller_;
// The queue of recently-used registers.
- SmallVector<unsigned, 3> RecentRegs;
+ SmallVector<unsigned, 4> RecentRegs;
+ SmallVector<unsigned, 4>::iterator RecentNext;
// Record that we just picked this register.
void recordRecentlyUsed(unsigned reg) {
assert(reg != 0 && "Recently used register is NOREG!");
if (!RecentRegs.empty()) {
- std::copy(RecentRegs.begin() + 1, RecentRegs.end(), RecentRegs.begin());
- RecentRegs.back() = reg;
+ *RecentNext++ = reg;
+ if (RecentNext == RecentRegs.end())
+ RecentNext = RecentRegs.begin();
}
}
More information about the llvm-commits
mailing list