diff options
author | David Greene <greened@obbligato.org> | 2009-11-20 21:13:27 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-11-20 21:13:27 +0000 |
commit | a96fc2f3ad3b31ffb605c0ace86fcd53260fb903 (patch) | |
tree | 732bf80c0c823d8f13141bc033a842663b56a609 /lib/CodeGen/RegAllocLinearScan.cpp | |
parent | 1f37b5b3afe9eb8f4c05391b13af7b58b021ae36 (diff) |
Cleanups.
Make things a little more efficient as suggested by Evan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLinearScan.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocLinearScan.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 708ecbe84a..4ff512932f 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -87,6 +87,7 @@ namespace { // 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 @@ namespace { 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(); } } |