Add an experimental -early-live-intervals option.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 3 Aug 2012 22:12:54 +0000 (22:12 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 3 Aug 2012 22:12:54 +0000 (22:12 +0000)
This option runs LiveIntervals before TwoAddressInstructionPass which
will eventually learn to exploit and update the analysis.

Eventually, LiveIntervals will run before PHIElimination, and we can get
rid of LiveVariables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161270 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/Passes.h
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/Passes.cpp

index 0cddff8d9dacf9389d91200e796cb31655b1ad53..07b3b45873ae71469adc5f90c6acecdf4c5e2577 100644 (file)
@@ -315,6 +315,10 @@ namespace llvm {
   ///  This pass is still in development
   extern char &StrongPHIEliminationID;
 
+  /// LiveIntervals - This analysis keeps track of the live ranges of virtual
+  /// and physical registers.
+  extern char &LiveIntervalsID;
+
   /// LiveStacks pass. An analysis keeping track of the liveness of stack slots.
   extern char &LiveStacksID;
 
index b488e8f077e6d7fbc8dfa6b0d65d415d27c11f2f..d0f8ae1af30555a88fd21272bd3e0547237c2254 100644 (file)
@@ -45,6 +45,7 @@ NewLiveIntervals("new-live-intervals", cl::Hidden,
                  cl::desc("Use new algorithm forcomputing live intervals"));
 
 char LiveIntervals::ID = 0;
+char &llvm::LiveIntervalsID = LiveIntervals::ID;
 INITIALIZE_PASS_BEGIN(LiveIntervals, "liveintervals",
                 "Live Interval Analysis", false, false)
 INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
index 69d6d00091adb225b45be12d5f56e6c7e73fd558..cfa3eecf02ef14a527074a4fd3ba9d8b9ebc6db7 100644 (file)
@@ -88,6 +88,10 @@ PrintMachineInstrs("print-machineinstrs", cl::ValueOptional,
                    cl::desc("Print machine instrs"),
                    cl::value_desc("pass-name"), cl::init("option-unspecified"));
 
+// Experimental option to run live inteerval analysis early.
+static cl::opt<bool> EarlyLiveIntervals("early-live-intervals", cl::Hidden,
+    cl::desc("Run live interval analysis earlier in the pipeline"));
+
 /// Allow standard passes to be disabled by command line options. This supports
 /// simple binary flags that either suppress the pass or do nothing.
 /// i.e. -disable-mypass=false has no effect.
@@ -648,6 +652,11 @@ void TargetPassConfig::addOptimizedRegAlloc(FunctionPass *RegAllocPass) {
     addPass(&MachineLoopInfoID);
     addPass(&PHIEliminationID);
   }
+
+  // Eventually, we want to run LiveIntervals before PHI elimination.
+  if (EarlyLiveIntervals)
+    addPass(&LiveIntervalsID);
+
   addPass(&TwoAddressInstructionPassID);
 
   if (EnableStrongPHIElim)