X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FPassAnalysisSupport.h;h=b09ba45e346d3b9bdfdc44925f273ce4414fa3cc;hb=295643b8050d4c45b06032690d707e7281e82c92;hp=f8b139ecb1a5b72de12a6f2f5637b450c8df3f04;hpb=1465d61bdd36cfd6021036a527895f0dd358e97d;p=oota-llvm.git diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index f8b139ecb1a..b09ba45e346 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -143,13 +143,17 @@ public: AnalysisImpls.push_back(pir); } + /// clearAnalysisImpls - Clear cache that is used to connect a pass to the + /// the analysis (PassInfo). + void clearAnalysisImpls() { + AnalysisImpls.clear(); + } + // getAnalysisIfAvailable - Return analysis result or null if it doesn't exist Pass *getAnalysisIfAvailable(AnalysisID ID, bool Direction) const; // AnalysisImpls - This keeps track of which passes implements the interfaces // that are required by the current pass (to implement getAnalysis()). - // NOTE : Remove AnalysisImpls from class Pass, when AnalysisResolver - // replaces AnalysisResolver std::vector > AnalysisImpls; private: @@ -222,23 +226,21 @@ AnalysisType &Pass::getAnalysis(Function &F) { template AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) { assert(PI && "getAnalysis for unregistered pass!"); - assert(Resolver&&"Pass has not been inserted into a PassManager object!"); - // PI *must* appear in AnalysisImpls. Because the number of passes used - // should be a small number, we just do a linear search over a (dense) - // vector. - Pass *ResultPass = Resolver->findImplPass(this, PI, F); - assert (ResultPass && - "getAnalysis*() called on an analysis that was not " - "'required' by pass!"); - - // Because the AnalysisType may not be a subclass of pass (for - // AnalysisGroups), we must use dynamic_cast here to potentially adjust the - // return pointer (because the class may multiply inherit, once from pass, - // once from AnalysisType). - // - AnalysisType *Result = dynamic_cast(ResultPass); - assert(Result && "Pass does not implement interface required!"); - return *Result; + assert(Resolver && "Pass has not been inserted into a PassManager object!"); + // PI *must* appear in AnalysisImpls. Because the number of passes used + // should be a small number, we just do a linear search over a (dense) + // vector. + Pass *ResultPass = Resolver->findImplPass(this, PI, F); + assert (ResultPass && "Unable to find requested analysis info"); + + // Because the AnalysisType may not be a subclass of pass (for + // AnalysisGroups), we must use dynamic_cast here to potentially adjust the + // return pointer (because the class may multiply inherit, once from pass, + // once from AnalysisType). + // + AnalysisType *Result = dynamic_cast(ResultPass); + assert(Result && "Pass does not implement interface required!"); + return *Result; } } // End llvm namespace