[llvm-commits] [llvm] r126282 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Feb 22 16:56:56 PST 2011


Author: stoklund
Date: Tue Feb 22 18:56:56 2011
New Revision: 126282

URL: http://llvm.org/viewvc/llvm-project?rev=126282&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=126282&r1=126281&r2=126282&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb 22 18:56:56 2011
@@ -74,6 +74,7 @@
   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::releaseMemory() {
   SpillerInstance.reset(0);
+  Generation.clear();
   RegAllocBase::releaseMemory();
 }
 
@@ -202,6 +204,11 @@
   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));
 }
 





More information about the llvm-commits mailing list