diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-10 20:30:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-10 20:30:44 +0000 |
commit | 0e52e3e2210ea06525218499a9422eecca7f5066 (patch) | |
tree | fe0e44a1a8eb5f9a7af3f0a16832b7338c49571f /include | |
parent | b49cebb26ac8f48a2e8db89eb1fa72c4d1fdf49d (diff) | |
download | external_llvm-0e52e3e2210ea06525218499a9422eecca7f5066.zip external_llvm-0e52e3e2210ea06525218499a9422eecca7f5066.tar.gz external_llvm-0e52e3e2210ea06525218499a9422eecca7f5066.tar.bz2 |
Allow a pass to obtain an analysis result for updating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Pass.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 6b2ad86..af68d42 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -101,6 +101,19 @@ protected: return *(AnalysisType*)Resolver->getAnalysis(AID); } + // 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(AnalysisID AID = AnalysisType::ID) { + assert(Resolver && "Pass not resident in a PassManager object!"); + return (AnalysisType*)Resolver->getAnalysisToUpdate(AID); + } + + private: friend class PassManagerT<Module>; friend class PassManagerT<Function>; @@ -249,6 +262,13 @@ struct AnalysisResolver { 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) { + Pass *Result = getAnalysisOrNullUp(ID); + return Result; + } + virtual unsigned getDepth() const = 0; virtual void markPassUsed(AnalysisID P, Pass *User) = 0; |