diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 6f5f8d63b46..cdd00300183 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -125,6 +125,22 @@ public: // or null if it is not known. static const PassInfo *lookupPassInfo(const std::type_info &TI); + /// getAnalysisToUpdate() - 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 + AnalysisType *getAnalysisToUpdate() const { + assert(Resolver && "Pass not resident in a PassManager object!"); + const PassInfo *PI = getClassPassInfo(); + if (PI == 0) return 0; + return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); + } + protected: /// getAnalysis() - This function is used by subclasses to get @@ -167,21 +183,6 @@ protected: return *Result; } - /// getAnalysisToUpdate() - 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 - AnalysisType *getAnalysisToUpdate() const { - assert(Resolver && "Pass not resident in a PassManager object!"); - const PassInfo *PI = getClassPassInfo(); - if (PI == 0) return 0; - return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); - } - - private: friend class PassManagerT; friend class PassManagerT;