[llvm-commits] CVS: llvm/include/llvm/ Pass.h

Christopher Lattner lattner at cs.uiuc.edu
Thu Sep 5 21:15:01 PDT 2002


Changes in directory llvm/include/llvm:

Pass.h updated: 1.25 -> 1.26

---
Log message:

Make getAnalysisToUpdate<AnalysisType>() public so that transformation APIs 
can update analysis information.


---
Diffs of the changes:

Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.25 llvm/include/llvm/Pass.h:1.26
--- llvm/include/llvm/Pass.h:1.25	Fri Aug 30 15:19:49 2002
+++ llvm/include/llvm/Pass.h	Thu Sep  5 21:14:47 2002
@@ -125,6 +125,22 @@
   // or null if it is not known.
   static const PassInfo *lookupPassInfo(const std::type_info &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.
+  ///
+  template<typename AnalysisType>
+  AnalysisType *getAnalysisToUpdate() 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));
+  }
+
 protected:
 
   /// getAnalysis<AnalysisType>() - This function is used by subclasses to get
@@ -166,21 +182,6 @@
     assert(Result && "Pass does not implement interface required!");
     return *Result;
   }
-
-  /// 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.
-  ///
-  template<typename AnalysisType>
-  AnalysisType *getAnalysisToUpdate() 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));
-  }
-
 
 private:
   friend class PassManagerT<Module>;





More information about the llvm-commits mailing list