Rename getAnalysisToUpdate to getAnalysisIfAvailable.
authorDuncan Sands <baldrick@free.fr>
Wed, 28 Jan 2009 13:14:17 +0000 (13:14 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 28 Jan 2009 13:14:17 +0000 (13:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63198 91177308-0d34-0410-b5e6-96231b3b80d8

29 files changed:
docs/CompilerDriver.html
docs/WritingAnLLVMPass.html
include/llvm/Pass.h
include/llvm/PassAnalysisSupport.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/GCMetadata.cpp
lib/CodeGen/GCStrategy.cpp
lib/CodeGen/MachineModuleInfo.cpp
lib/CodeGen/PHIElimination.cpp
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
lib/CodeGen/UnreachableBlockElim.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/XCore/XCoreAsmPrinter.cpp
lib/Transforms/IPO/Internalize.cpp
lib/Transforms/Scalar/LoopRotation.cpp
lib/Transforms/Scalar/LoopUnroll.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
lib/Transforms/Utils/BasicBlockUtils.cpp
lib/Transforms/Utils/BreakCriticalEdges.cpp
lib/Transforms/Utils/CloneLoop.cpp
lib/Transforms/Utils/LoopSimplify.cpp
lib/VMCore/Pass.cpp
lib/VMCore/PassManager.cpp

index fc687f1667511468f6742a4f6a73184c6c19b780..6338dd247696241536e1905c3bcf90d5cf73ae60 100644 (file)
@@ -611,7 +611,7 @@ errors as its status code.</p>
 <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a><br />
 <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br />
 
-Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $
+Last modified: $Date$
 </address></div>
 </div>
 </div>
index 0f37ec276c45c91b1c68ba3c70a92ba723f4834c..04bd9266118bbb01b29c46c2610e881708f9f658 100644 (file)
@@ -78,7 +78,8 @@
      <li><a href="#AU::addRequired">The <tt>AnalysisUsage::addRequired&lt;&gt;</tt> and <tt>AnalysisUsage::addRequiredTransitive&lt;&gt;</tt> methods</a></li>
      <li><a href="#AU::addPreserved">The <tt>AnalysisUsage::addPreserved&lt;&gt;</tt> method</a></li>
      <li><a href="#AU::examples">Example implementations of <tt>getAnalysisUsage</tt></a></li>
-     <li><a href="#getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and <tt>getAnalysisToUpdate&lt;&gt;</tt> methods</a></li>
+     <li><a href="#getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and
+<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods</a></li>
      </ul></li>
   <li><a href="#analysisgroup">Implementing Analysis Groups</a>
      <ul>
@@ -1131,7 +1132,8 @@ the fact that it hacks on the CFG.
 
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection">
-  <a name="getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and <tt>getAnalysisToUpdate&lt;&gt;</tt> methods</a>
+  <a name="getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and
+<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods</a>
 </div>
 
 <div class="doc_text">
@@ -1173,12 +1175,12 @@ before returning a reference to the desired pass.</p>
 <p>
 If your pass is capable of updating analyses if they exist (e.g.,
 <tt>BreakCriticalEdges</tt>, as described above), you can use the
-<tt>getAnalysisToUpdate</tt> method, which returns a pointer to the analysis if
-it is active.  For example:</p>
+<tt>getAnalysisIfAvailable</tt> method, which returns a pointer to the analysis
+if it is active.  For example:</p>
 
 <div class="doc_code"><pre>
   ...
-  if (DominatorSet *DS = getAnalysisToUpdate&lt;DominatorSet&gt;()) {
+  if (DominatorSet *DS = getAnalysisIfAvailable&lt;DominatorSet&gt;()) {
     <i>// A DominatorSet is active.  This code will update it.</i>
   }
   ...
index dd012da93cfa6ffa679c98a2db639a5e666e786b..0527e0cdbbe4f1e5cda0ab1576a31fe97ed50cbe 100644 (file)
@@ -169,22 +169,22 @@ public:
   // or null if it is not known.
   static const PassInfo *lookupPassInfo(intptr_t TI);
 
-  /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
-  /// to get to the analysis information that might be around that needs to be
-  /// updated.  This is different than getAnalysis in that it can fail (ie the
-  /// analysis results haven't been computed), so should only be used if you
-  /// provide the capability to update an analysis that exists.  This method is
-  /// often used by transformation APIs to update analysis results for a pass
-  /// automatically as the transform is performed.
+  /// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
+  /// get analysis information that might be around, for example to update it.
+  /// This is different than getAnalysis in that it can fail (if the analysis
+  /// results haven't been computed), so should only be used if you can handle
+  /// the case when the analysis is not available.  This method is often used by
+  /// transformation APIs to update analysis results for a pass automatically as
+  /// the transform is performed.
   ///
-  template<typename AnalysisType>
-  AnalysisType *getAnalysisToUpdate() const; // Defined in PassAnalysisSupport.h
+  template<typename AnalysisType> AnalysisType *
+    getAnalysisIfAvailable() const; // Defined in PassAnalysisSupport.h
 
   /// mustPreserveAnalysisID - This method serves the same function as
-  /// getAnalysisToUpdate, but works if you just have an AnalysisID.  This
+  /// getAnalysisIfAvailable, but works if you just have an AnalysisID.  This
   /// obviously cannot give you a properly typed instance of the class if you
-  /// don't have the class name available (use getAnalysisToUpdate if you do),
-  /// but it can tell you if you need to preserve the pass at least.
+  /// don't have the class name available (use getAnalysisIfAvailable if you
+  /// do), but it can tell you if you need to preserve the pass at least.
   ///
   bool mustPreserveAnalysisID(const PassInfo *AnalysisID) const;
 
index c6ed179af61f9a3516a562cede022d84d9752f42..f8b139ecb1a5b72de12a6f2f5637b450c8df3f04 100644 (file)
@@ -143,8 +143,8 @@ public:
     AnalysisImpls.push_back(pir);
   }
 
-  // getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
-  Pass *getAnalysisToUpdate(AnalysisID ID, bool Direction) const;
+  // getAnalysisIfAvailable - Return analysis result or null if it doesn't exist
+  Pass *getAnalysisIfAvailable(AnalysisID ID, bool Direction) const;
 
   // AnalysisImpls - This keeps track of which passes implements the interfaces
   // that are required by the current pass (to implement getAnalysis()).
@@ -157,22 +157,22 @@ private:
   PMDataManager &PM;
 };
 
-/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
-/// to get to the analysis information that might be around that needs to be
-/// updated.  This is different than getAnalysis in that it can fail (ie the
-/// analysis results haven't been computed), so should only be used if you
-/// provide the capability to update an analysis that exists.  This method is
-/// often used by transformation APIs to update analysis results for a pass
-/// automatically as the transform is performed.
+/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
+/// get analysis information that might be around, for example to update it.
+/// This is different than getAnalysis in that it can fail (if the analysis
+/// results haven't been computed), so should only be used if you can handle
+/// the case when the analysis is not available.  This method is often used by
+/// transformation APIs to update analysis results for a pass automatically as
+/// the transform is performed.
 ///
 template<typename AnalysisType>
-AnalysisType *Pass::getAnalysisToUpdate() const {
+AnalysisType *Pass::getAnalysisIfAvailable() const {
   assert(Resolver && "Pass not resident in a PassManager object!");
 
   const PassInfo *PI = getClassPassInfo<AnalysisType>();
   if (PI == 0) return 0;
   return dynamic_cast<AnalysisType*>
-    (Resolver->getAnalysisToUpdate(PI, true));
+    (Resolver->getAnalysisIfAvailable(PI, true));
 }
 
 /// getAnalysis<AnalysisType>() - This function is used by subclasses to get
index 50cd24ba8227584cb3d9fdcd34341444db696bca..9334f1ef3f2e930fd0e5476fcbce8fece158b41c 100644 (file)
@@ -141,7 +141,7 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
 bool AsmPrinter::doInitialization(Module &M) {
   Mang = new Mangler(M, TAI->getGlobalPrefix(), TAI->getPrivateGlobalPrefix());
   
-  GCModuleInfo *MI = getAnalysisToUpdate<GCModuleInfo>();
+  GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
 
   if (TAI->hasSingleParameterDotFile()) {
@@ -163,9 +163,9 @@ bool AsmPrinter::doInitialization(Module &M) {
 
   SwitchToDataSection("");   // Reset back to no section.
   
-  MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   if (MMI) MMI->AnalyzeModule(M);
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   return false;
 }
 
@@ -218,7 +218,7 @@ bool AsmPrinter::doFinalization(Module &M) {
     }
   }
 
-  GCModuleInfo *MI = getAnalysisToUpdate<GCModuleInfo>();
+  GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
   assert(MI && "AsmPrinter didn't require GCModuleInfo?");
   for (GCModuleInfo::iterator I = MI->end(), E = MI->begin(); I != E; )
     if (GCMetadataPrinter *MP = GetOrCreateGCPrinter(*--I))
index 85df7a9d36c163ecdb880aedd895c226ae99c289..fe8ce522f065dbbea940e354ad1da652a8c57240 100644 (file)
@@ -198,7 +198,7 @@ bool BranchFolder::runOnMachineFunction(MachineFunction &MF) {
 
   RS = RegInfo->requiresRegisterScavenging(MF) ? new RegScavenger() : NULL;
 
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
 
   bool MadeChangeThisIteration = true;
   while (MadeChangeThisIteration) {
index f2978f88882ce6b778bd5cb37768ce8b89924e0e..4742ad8bbbb9f45c5edfef2e8ac9380f3dea2968 100644 (file)
@@ -205,7 +205,7 @@ bool Deleter::runOnFunction(Function &MF) {
 }
 
 bool Deleter::doFinalization(Module &M) {
-  GCModuleInfo *GMI = getAnalysisToUpdate<GCModuleInfo>();
+  GCModuleInfo *GMI = getAnalysisIfAvailable<GCModuleInfo>();
   assert(GMI && "Deleter didn't require GCModuleInfo?!");
   GMI->clear();
   return false;
index 517b3a7762e7e3c70ff2f542bf42b46907fa276b..96b81226bd9f51dedeb2e303d075813d4b054e00 100644 (file)
@@ -144,7 +144,7 @@ bool LowerIntrinsics::doInitialization(Module &M) {
   //        work against the entire module. But this cannot be done at
   //        runFunction time (initializeCustomLowering likely needs to change
   //        the module).
-  GCModuleInfo *MI = getAnalysisToUpdate<GCModuleInfo>();
+  GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
   assert(MI && "LowerIntrinsics didn't require GCModuleInfo!?");
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     if (!I->isDeclaration() && I->hasGC())
index 724c113b79b943afe8fde1d7a633b117640cac9e..1c29c7fed350ee302c178fb567206edc4bae04b2 100644 (file)
@@ -320,7 +320,7 @@ char DebugLabelFolder::ID = 0;
 
 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
   // Get machine module info.
-  MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   if (!MMI) return false;
   
   // Track if change is made.
index bd389db31f3abcaf23b77759c17446e7c04b89cf..147ccab3a1e47e5efec1f2c2a5cb684fe0e57853 100644 (file)
@@ -174,7 +174,7 @@ void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB,
   }
 
   // Update live variable information if there is any.
-  LiveVariables *LV = getAnalysisToUpdate<LiveVariables>();
+  LiveVariables *LV = getAnalysisIfAvailable<LiveVariables>();
   if (LV) {
     MachineInstr *PHICopy = prior(AfterPHIsIt);
 
index 4ebf742a4c316cb6040dfc426ac4e94453c9f963..39f96133bd19783ee1796f504989dfd5952a0c50 100644 (file)
@@ -56,7 +56,7 @@ namespace {
 
       // Get MachineModuleInfo so that we can track the construction of the
       // frame.
-      if (MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>())
+      if (MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>())
         Fn.getFrameInfo()->setMachineModuleInfo(MMI);
 
       // Allow the target machine to make some adjustments to the function
index ca0cd6e8f515d445c4c5802008eefe0c817142a3..3ae70c850dae0421fb2807d84dc1440ade033b9e 100644 (file)
@@ -314,8 +314,8 @@ bool SelectionDAGISel::runOnFunction(Function &Fn) {
   DOUT << "\n\n\n=== " << Fn.getName() << "\n";
 
   FuncInfo->set(Fn, *MF, EnableFastISel);
-  MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
-  DwarfWriter *DW = getAnalysisToUpdate<DwarfWriter>();
+  MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+  DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
   CurDAG->init(*MF, MMI, DW);
   SDL->init(GFI, *AA);
 
index 5cf2ffd3771bd19a9e968cf23910b18b926fb3da..794f772101e98839cedaf640e596ab9395239662 100644 (file)
@@ -379,7 +379,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
   MRI = &MF.getRegInfo();
   TII = TM.getInstrInfo();
   TRI = TM.getRegisterInfo();
-  LV = getAnalysisToUpdate<LiveVariables>();
+  LV = getAnalysisIfAvailable<LiveVariables>();
 
   bool MadeChange = false;
 
index c597e5fd7db0ffedde3a737d384e7719643b77bc..c3b213cebe9543a95020d13b26a95c215e91661d 100644 (file)
@@ -105,7 +105,7 @@ const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y;
 bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
   SmallPtrSet<MachineBasicBlock*, 8> Reachable;
 
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
 
   // Mark all reachable blocks.
   for (df_ext_iterator<MachineFunction*, SmallPtrSet<MachineBasicBlock*, 8> >
index 12e13466d1b393aca0c9d48d2430244623e23545..83df20cc170bacb78a6b4a5f4d7158697bccad20 100644 (file)
@@ -782,9 +782,9 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
 
   // Emit initial debug information.
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   assert(MMI);
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   assert(DW && "Dwarf Writer is not available");
   DW->BeginModule(&M, MMI, O, this, TAI);
 
index 62da3b7493c3ad4d3faf0cdf558b05450bad0b57..e9b3fc2d26b27e1ca2b457b671788c5505e54dd0 100644 (file)
@@ -491,9 +491,9 @@ bool LinuxAsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
   SwitchToTextSection("\t.text");
   // Emit initial debug information.
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   assert(DW && "Dwarf Writer is not available");
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   DW->BeginModule(&M, MMI, O, this, TAI);
   return Result;
 }
index 5fe77be040000ea0c1854d25a15f9aa27d850679..5f3ba931faf4e0fec265ace59315a5e81d72da5c 100644 (file)
@@ -641,9 +641,9 @@ bool PPCLinuxAsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
 
   // Emit initial debug information.
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   assert(MMI);
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   assert(DW && "DwarfWriter is not available");
   DW->BeginModule(&M, MMI, O, this, TAI);
 
@@ -859,9 +859,9 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
   // Emit initial debug information.
   // We need this for Personality functions.
   // AsmPrinter::doInitialization should have done this analysis.
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   assert(MMI);
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   assert(DW && "DwarfWriter is not available");
   DW->BeginModule(&M, MMI, O, this, TAI);
 
index e09411a51764dcf7537ef3dde3103bc3765491f9..9e0afc8d6f235c806ff6ab2acd8bec5ad7d9c43a 100644 (file)
@@ -737,8 +737,8 @@ bool X86ATTAsmPrinter::doInitialization(Module &M) {
     // Let PassManager know we need debug information and relay
     // the MachineModuleInfo address on to DwarfWriter.
     // AsmPrinter::doInitialization did this analysis.
-    MMI = getAnalysisToUpdate<MachineModuleInfo>();
-    DW = getAnalysisToUpdate<DwarfWriter>();
+    MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+    DW = getAnalysisIfAvailable<DwarfWriter>();
     DW->BeginModule(&M, MMI, O, this, TAI);
   }
 
@@ -975,7 +975,7 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
     }
 
     // Emit final debug information.
-    DwarfWriter *DW = getAnalysisToUpdate<DwarfWriter>();
+    DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
     DW->EndModule();
 
     // Funny Darwin hack: This flag tells the linker that no global symbols
@@ -995,11 +995,11 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
     }
 
     // Emit final debug information.
-    DwarfWriter *DW = getAnalysisToUpdate<DwarfWriter>();
+    DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
     DW->EndModule();
   } else if (Subtarget->isTargetELF()) {
     // Emit final debug information.
-    DwarfWriter *DW = getAnalysisToUpdate<DwarfWriter>();
+    DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
     DW->EndModule();
   }
 
index f966d8564d27e9f27783c9d52652c4c11cf5cba9..9e6e19fe44fd78382588c852314486e29c51e395 100644 (file)
@@ -441,9 +441,9 @@ bool XCoreAsmPrinter::doInitialization(Module &M) {
   }
 
   // Emit initial debug information.
-  DW = getAnalysisToUpdate<DwarfWriter>();
+  DW = getAnalysisIfAvailable<DwarfWriter>();
   assert(DW && "Dwarf Writer is not available");
-  DW->BeginModule(&M, getAnalysisToUpdate<MachineModuleInfo>(), 
+  DW->BeginModule(&M, getAnalysisIfAvailable<MachineModuleInfo>(),
                   O, this, TAI);
   return Result;
 }
index b226d1959a0115e9bcb2a9a733afe8b37584d2ed..5093ae90b5ba178ae7bb98d1c06b49802e8f1144 100644 (file)
@@ -99,7 +99,7 @@ void InternalizePass::LoadFile(const char *Filename) {
 }
 
 bool InternalizePass::runOnModule(Module &M) {
-  CallGraph *CG = getAnalysisToUpdate<CallGraph>();
+  CallGraph *CG = getAnalysisIfAvailable<CallGraph>();
   CallGraphNode *ExternalNode = CG ? CG->getExternalCallingNode() : 0;
 
   if (ExternalNames.empty()) {
index aed84e2df87f34c1e1575455b1b9f5c959b8fe80..65b74b4e7ff58e173aee2c78b2a5bcaf23a0bdc3 100644 (file)
@@ -457,7 +457,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
            "Expected only one incoming value from Original PreHeader");
   }
 
-  if (DominatorTree *DT = getAnalysisToUpdate<DominatorTree>()) {
+  if (DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>()) {
     DT->addNewBlock(NewPreHeader, OrigPreHeader);
     DT->changeImmediateDominator(L->getHeader(), NewPreHeader);
     DT->changeImmediateDominator(Exit, OrigPreHeader);
@@ -473,7 +473,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
     DT->changeImmediateDominator(OrigHeader, OrigLatch);
   }
 
-  if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>()) {
+  if (DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>()) {
     // New Preheader's dominance frontier is Exit block.
     DominanceFrontier::DomSetType NewPHSet;
     NewPHSet.insert(Exit);
@@ -509,7 +509,7 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) {
     // If a loop block dominates new loop latch then its frontier is
     // new header and Exit.
     BasicBlock *NewLatch = L->getLoopLatch();
-    DominatorTree *DT = getAnalysisToUpdate<DominatorTree>();
+    DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
     for (Loop::block_iterator BI = L->block_begin(), BE = L->block_end();
          BI != BE; ++BI) {
       BasicBlock *B = *BI;
index 6d685d58f96b47079ee05e128925419ff58fbd86..2025fb6828852b8e1bce77b938fb702652ab1bab 100644 (file)
@@ -170,10 +170,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
     return false;
 
   // FIXME: Reconstruct dom info, because it is not preserved properly.
-  DominatorTree *DT = getAnalysisToUpdate<DominatorTree>();
+  DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
   if (DT) {
     DT->runOnFunction(*F);
-    DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>();
+    DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>();
     if (DF)
       DF->runOnFunction(*F);
   }
index 97aa475a67fe040fd99831c55edaa322cff59cd0..a563c7a9ee92aa10ae7297f62b0549c4afe45bf1 100644 (file)
@@ -188,8 +188,8 @@ static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
 bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
   LI = &getAnalysis<LoopInfo>();
   LPM = &LPM_Ref;
-  DF = getAnalysisToUpdate<DominanceFrontier>();
-  DT = getAnalysisToUpdate<DominatorTree>();
+  DF = getAnalysisIfAvailable<DominanceFrontier>();
+  DT = getAnalysisIfAvailable<DominatorTree>();
   currentLoop = L;
   Function *F = currentLoop->getHeader()->getParent();
   bool Changed = false;
index 431424ee9f3914ca8c559b8b6d1012aae64ac87d..7b633b20077d443e97154d56d11c1d1e4829c0d0 100644 (file)
@@ -136,7 +136,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock* BB, Pass* P) {
   
   // Finally, erase the old block and update dominator info.
   if (P) {
-    if (DominatorTree* DT = P->getAnalysisToUpdate<DominatorTree>()) {
+    if (DominatorTree* DT = P->getAnalysisIfAvailable<DominatorTree>()) {
       DomTreeNode* DTN = DT->getNode(BB);
       DomTreeNode* PredDTN = DT->getNode(PredBB);
   
@@ -299,11 +299,11 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
   BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split");
 
   // The new block lives in whichever loop the old one did.
-  if (LoopInfo* LI = P->getAnalysisToUpdate<LoopInfo>())
+  if (LoopInfo* LI = P->getAnalysisIfAvailable<LoopInfo>())
     if (Loop *L = LI->getLoopFor(Old))
       L->addBasicBlockToLoop(New, LI->getBase());
 
-  if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) 
+  if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>())
     {
       // Old dominates New. New node domiantes all other nodes dominated by Old.
       DomTreeNode *OldNode = DT->getNode(Old);
@@ -319,7 +319,7 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
         DT->changeImmediateDominator(*I, NewNode);
     }
 
-  if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>())
+  if (DominanceFrontier *DF = P->getAnalysisIfAvailable<DominanceFrontier>())
     DF->splitBlock(Old);
     
   return New;
@@ -350,12 +350,12 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
     Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB);
   
   // Update dominator tree and dominator frontier if available.
-  DominatorTree *DT = P ? P->getAnalysisToUpdate<DominatorTree>() : 0;
+  DominatorTree *DT = P ? P->getAnalysisIfAvailable<DominatorTree>() : 0;
   if (DT)
     DT->splitBlock(NewBB);
-  if (DominanceFrontier *DF = P ? P->getAnalysisToUpdate<DominanceFrontier>():0)
+  if (DominanceFrontier *DF = P ? P->getAnalysisIfAvailable<DominanceFrontier>():0)
     DF->splitBlock(NewBB);
-  AliasAnalysis *AA = P ? P->getAnalysisToUpdate<AliasAnalysis>() : 0;
+  AliasAnalysis *AA = P ? P->getAnalysisIfAvailable<AliasAnalysis>() : 0;
   
   
   // Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
index a32c01671282f70779e67b2cda3c9745fc2bd9c9..c4fd1eae43cd978a54c85df5f685cf3eb8208f4f 100644 (file)
@@ -187,7 +187,7 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
   bool NewBBDominatesDestBB = true;
   
   // Should we update DominatorTree information?
-  if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
+  if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>()) {
     DomTreeNode *TINode = DT->getNode(TIBB);
 
     // The new block is not the immediate dominator for any other nodes, but
@@ -218,7 +218,7 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
   }
 
   // Should we update DominanceFrontier information?
-  if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>()) {
+  if (DominanceFrontier *DF = P->getAnalysisIfAvailable<DominanceFrontier>()) {
     // If NewBBDominatesDestBB hasn't been computed yet, do so with DF.
     if (!OtherPreds.empty()) {
       // FIXME: IMPLEMENT THIS!
@@ -252,7 +252,7 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
   }
   
   // Update LoopInfo if it is around.
-  if (LoopInfo *LI = P->getAnalysisToUpdate<LoopInfo>()) {
+  if (LoopInfo *LI = P->getAnalysisIfAvailable<LoopInfo>()) {
     // If one or the other blocks were not in a loop, the new block is not
     // either, and thus LI doesn't need to be updated.
     if (Loop *TIL = LI->getLoopFor(TIBB))
index d52d79598f0518fcf854e0522d6f415f8f9f2af4..a0306ffa527232f2d7e8e1ca1d94c2aeeffe6374 100644 (file)
@@ -79,8 +79,8 @@ Loop *llvm::CloneLoop(Loop *OrigL, LPPassManager  *LPM, LoopInfo *LI,
   DominatorTree *DT = NULL;
   DominanceFrontier *DF = NULL;
   if (P) {
-    DT = P->getAnalysisToUpdate<DominatorTree>();
-    DF = P->getAnalysisToUpdate<DominanceFrontier>();
+    DT = P->getAnalysisIfAvailable<DominatorTree>();
+    DF = P->getAnalysisIfAvailable<DominanceFrontier>();
   }
 
   SmallVector<BasicBlock *, 16> NewBlocks;
index af41036252b277f91535f6dbb78bb60bdb22b675..03d273d25d791591bcab11f608e41c81bd6cc647 100644 (file)
@@ -112,7 +112,7 @@ FunctionPass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); }
 bool LoopSimplify::runOnFunction(Function &F) {
   bool Changed = false;
   LI = &getAnalysis<LoopInfo>();
-  AA = getAnalysisToUpdate<AliasAnalysis>();
+  AA = getAnalysisIfAvailable<AliasAnalysis>();
   DT = &getAnalysis<DominatorTree>();
 
   // Check to see that no blocks (other than the header) in loops have
@@ -595,6 +595,6 @@ void LoopSimplify::InsertUniqueBackedgeBlock(Loop *L) {
 
   // Update dominator information
   DT->splitBlock(BEBlock);
-  if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>())
+  if (DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>())
     DF->splitBlock(BEBlock);
 }
index 35cbe906b70147d835392779b17946f495884cbd..6db5d7e24c5ef2f4eec9eb5cc0680261411ba4a6 100644 (file)
@@ -37,7 +37,7 @@ Pass::~Pass() {
 ModulePass::~ModulePass() { }
 
 bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
-  return Resolver->getAnalysisToUpdate(AnalysisID, true) != 0;
+  return Resolver->getAnalysisIfAvailable(AnalysisID, true) != 0;
 }
 
 // dumpPassStructure - Implement the -debug-passes=Structure option
index 690c485fe20d65aa54d4b3fb82510afc4234bbfb..f2bfaefe0f78f69775f967146417687140feb759 100644 (file)
@@ -679,7 +679,7 @@ void PMDataManager::verifyDomInfo(Pass &P, Function &F) {
   if (!VerifyDomInfo || !P.getResolver())
     return;
 
-  DominatorTree *DT = P.getAnalysisToUpdate<DominatorTree>();
+  DominatorTree *DT = P.getAnalysisIfAvailable<DominatorTree>();
   if (!DT)
     return;
 
@@ -695,7 +695,7 @@ void PMDataManager::verifyDomInfo(Pass &P, Function &F) {
     assert (0 && "Invalid dominator info");
   }
 
-  DominanceFrontier *DF = P.getAnalysisToUpdate<DominanceFrontier>();
+  DominanceFrontier *DF = P.getAnalysisIfAvailable<DominanceFrontier>();
   if (!DF) 
     return;
 
@@ -1088,8 +1088,8 @@ PMDataManager::~PMDataManager() {
 
 //===----------------------------------------------------------------------===//
 // NOTE: Is this the right place to define this method ?
-// getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
-Pass *AnalysisResolver::getAnalysisToUpdate(AnalysisID ID, bool dir) const {
+// getAnalysisIfAvailable - Return analysis result or null if it doesn't exist.
+Pass *AnalysisResolver::getAnalysisIfAvailable(AnalysisID ID, bool dir) const {
   return PM.findAnalysisPass(ID, dir);
 }