From: Jakob Stoklund Olesen Date: Wed, 23 Feb 2011 00:56:56 +0000 (+0000) Subject: Keep track of how many times a live range has been dequeued, and prioritize new ranges. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d2a50734234a80893ad71da90d9f32032c47e000;p=oota-llvm.git Keep track of how many times a live range has been dequeued, and prioritize new ranges. When a large live range is evicted, it will usually be split when it comes around again. By deferring evicted live ranges, the splitting happens at a time when the interference pattern is more realistic. This prevents repeated splitting and evictions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126282 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index 59d4fc6180e..03886195404 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -74,6 +74,7 @@ class RAGreedy : public MachineFunctionPass, public RegAllocBase { std::auto_ptr SpillerInstance; std::auto_ptr SA; std::priority_queue > Queue; + IndexedMap 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)); }