void startPass(Pass *P) {}
void endPass(Pass *P) {}
-protected:
- void setAnalysisResolver(Pass *P, AnalysisResolver *AR);
};
/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
///
template<typename AnalysisType>
AnalysisType *Pass::getAnalysisToUpdate() const {
-#ifdef USE_OLD_PASSMANAGER
- assert(Resolver && "Pass not resident in a PassManager object!");
-#else
assert(Resolver_New && "Pass not resident in a PassManager object!");
-#endif
+
const PassInfo *PI = getClassPassInfo<AnalysisType>();
if (PI == 0) return 0;
-#ifdef USE_OLD_PASSMANAGER
- return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI));
-#else
return dynamic_cast<AnalysisType*>
(Resolver_New->getAnalysisToUpdate(PI, true));
-#endif
}
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
///
template<typename AnalysisType>
AnalysisType &Pass::getAnalysis() const {
-#ifdef USE_OLD_PASSMANAGER
- assert(Resolver && "Pass has not been inserted into a PassManager object!");
-#else
- assert(Resolver_New && "Pass has not been inserted into a PassManager object!");
-#endif
- const PassInfo *PI = getClassPassInfo<AnalysisType>();
- return getAnalysisID<AnalysisType>(PI);
+ assert(Resolver_New &&"Pass has not been inserted into a PassManager object!");
+
+ return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>());
}
template<typename AnalysisType>
AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
assert(PI && "getAnalysis for unregistered pass!");
-#ifdef USE_OLD_PASSMANAGER
- 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 = 0;
- for (unsigned i = 0; ; ++i) {
- assert(i != AnalysisImpls.size() &&
- "getAnalysis*() called on an analysis that was not "
- "'required' by pass!");
- if (AnalysisImpls[i].first == PI) {
- ResultPass = AnalysisImpls[i].second;
- break;
- }
- }
-#else
- assert(Resolver_New && "Pass has not been inserted into a PassManager object!");
+ assert(Resolver_New&&"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.
"getAnalysis*() called on an analysis that was not "
"'required' by pass!");
-#endif
// 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,