-//===----------------------------------------------------------------------===//
-// AnalysisResolver - Simple interface implemented by PassManager objects that
-// is used to pull analysis information out of them.
-//
-struct AnalysisResolver {
- virtual ~AnalysisResolver();
- virtual Pass *getAnalysisOrNullUp(AnalysisID ID) const = 0;
- virtual Pass *getAnalysisOrNullDown(AnalysisID ID) const = 0;
- virtual void addPass(ImmutablePass *IP, AnalysisUsage &AU) = 0;
- Pass *getAnalysis(AnalysisID ID) const {
- Pass *Result = getAnalysisOrNullUp(ID);
- assert(Result && "Pass has an incorrect analysis uses set!");
- return Result;
- }
-
- // getAnalysisToUpdate - Return an analysis result or null if it doesn't exist
- Pass *getAnalysisToUpdate(AnalysisID ID) const {
- return getAnalysisOrNullUp(ID);
- }
-
- // Methods for introspecting into pass manager objects...
- virtual unsigned getDepth() const = 0;
- virtual unsigned getNumContainedPasses() const = 0;
- virtual const Pass *getContainedPass(unsigned N) const = 0;
-
- virtual void markPassUsed(AnalysisID P, Pass *User) = 0;
-
- void startPass(Pass *P) {}
- void endPass(Pass *P) {}
-protected:
- void setAnalysisResolver(Pass *P, AnalysisResolver *AR);
-};
-
-/// 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.