diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index f3e4dfd7aef..8178598985e 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -145,6 +145,14 @@ public: /// virtual void releaseMemory(); + /// getAdjustedAnalysisPointer - This method is used when a pass implements + /// an analysis interface through multiple inheritance. If needed, it should + /// override this to adjust the this pointer as needed for the specified pass + /// info. + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + return this; + } + /// verifyAnalysis() - This member can be implemented by a analysis pass to /// check state of analysis information. virtual void verifyAnalysis() const; diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index b2983c722e2..36b831c0ef2 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -153,6 +153,16 @@ namespace { virtual void deleteValue(Value *V) {} virtual void copyValue(Value *From, Value *To) {} + + /// getAdjustedAnalysisPointer - This method is used when a pass implements + /// an analysis interface through multiple inheritance. If needed, it should + /// override this to adjust the this pointer as needed for the specified pass + /// info. + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) + return (AliasAnalysis*)this; + return this; + } }; } // End of anonymous namespace @@ -192,6 +202,16 @@ namespace { /// global) or not. bool pointsToConstantMemory(const Value *P); + /// getAdjustedAnalysisPointer - This method is used when a pass implements + /// an analysis interface through multiple inheritance. If needed, it should + /// override this to adjust the this pointer as needed for the specified pass + /// info. + virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { + if (PI->isPassID(&AliasAnalysis::ID)) + return (AliasAnalysis*)this; + return this; + } + private: // VisitedPHIs - Track PHI nodes visited by a aliasCheck() call. SmallPtrSet VisitedPHIs;