Add helper method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5753 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-03-21 21:41:02 +00:00
parent 6f2ec7f59d
commit f1ab454b71
2 changed files with 12 additions and 0 deletions

View File

@ -142,6 +142,14 @@ public:
return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI));
}
/// mustPreserveAnalysisID - This method serves the same function as
/// getAnalysisToUpdate, but works if you just have an AnalysisID. This
/// obviously cannot give you a properly typed instance of the class if you
/// don't have the class name available (use getAnalysisToUpdate if you do),
/// but it can tell you if you need to preserve the pass at least.
///
bool mustPreserveAnalysisID(const PassInfo *AnalysisID) const;
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
/// to the analysis information that they claim to use by overriding the
/// getAnalysisUsage function.

View File

@ -142,6 +142,10 @@ void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU) {
PM->addPass(this, AU);
}
bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
return Resolver->getAnalysisToUpdate(AnalysisID) != 0;
}
// dumpPassStructure - Implement the -debug-passes=Structure option
void Pass::dumpPassStructure(unsigned Offset) {
std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";