aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index 59d4fc6180..0388619540 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -74,6 +74,7 @@ class RAGreedy : public MachineFunctionPass, public RegAllocBase {
std::auto_ptr<Spiller> SpillerInstance;
std::auto_ptr<SplitAnalysis> SA;
std::priority_queue<std::pair<unsigned, unsigned> > Queue;
+ IndexedMap<unsigned, VirtReg2IndexFunctor> Generation;
// splitting state.
@@ -186,6 +187,7 @@ void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const {
void RAGreedy::releaseMemory() {
SpillerInstance.reset(0);
+ Generation.clear();
RegAllocBase::releaseMemory();
}
@@ -202,6 +204,11 @@ void RAGreedy::enqueue(LiveInterval *LI) {
if (TargetRegisterInfo::isPhysicalRegister(Hint))
Size |= (1u << 30);
+ // Boost ranges that we see for the first time.
+ Generation.grow(Reg);
+ if (++Generation[Reg] == 1)
+ Size |= (1u << 31);
+
Queue.push(std::make_pair(Size, Reg));
}