summaryrefslogtreecommitdiff
path: root/include/llvm/PassAnalysisSupport.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-29 14:26:51 +0000
committerChris Lattner <sabre@nondot.org>2003-08-29 14:26:51 +0000
commitdf9ec1052b089f7c7520823addd74b3fd97ba674 (patch)
treefaf389f784878701f35d26273c063ba03dfee7ac /include/llvm/PassAnalysisSupport.h
parent40c6fb6cac80367c2bec32295d4448e540f2d253 (diff)
downloadllvm-df9ec1052b089f7c7520823addd74b3fd97ba674.tar.gz
llvm-df9ec1052b089f7c7520823addd74b3fd97ba674.tar.bz2
llvm-df9ec1052b089f7c7520823addd74b3fd97ba674.tar.xz
Move getAnalysisToUpdate to after the definition of AnalysisResolver.
GCC 3.4 apparently wants classes to be DEFINED before they are USED. What is it smoking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/PassAnalysisSupport.h')
-rw-r--r--include/llvm/PassAnalysisSupport.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h
index 97588c3ae3..d27d669649 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/include/llvm/PassAnalysisSupport.h
@@ -110,4 +110,20 @@ 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.
+///
+template<typename AnalysisType>
+AnalysisType *Pass::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));
+}
+
#endif