summaryrefslogtreecommitdiff
path: root/include/llvm/PassAnalysisSupport.h
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2006-12-13 02:36:01 +0000
committerDevang Patel <dpatel@apple.com>2006-12-13 02:36:01 +0000
commit3162691f69f85f740bc28f3ddca39b166d35187c (patch)
treed8dd3d9007184cba80f467720eaf827c05c91999 /include/llvm/PassAnalysisSupport.h
parent21c362d3240d0ba9ff98b7f36e54f25936d1a201 (diff)
downloadllvm-3162691f69f85f740bc28f3ddca39b166d35187c.tar.gz
llvm-3162691f69f85f740bc28f3ddca39b166d35187c.tar.bz2
llvm-3162691f69f85f740bc28f3ddca39b166d35187c.tar.xz
Add #ifdef switch toggle between old and new pass manager. However,
continue to use old pass manager at the moment. To use new manager remove #define USE_OLD_PASSMANAGER 1 from Pass.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/PassAnalysisSupport.h')
-rw-r--r--include/llvm/PassAnalysisSupport.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h
index d2aec0bbc9..1575d565bb 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/include/llvm/PassAnalysisSupport.h
@@ -189,10 +189,19 @@ protected:
///
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
@@ -201,15 +210,20 @@ AnalysisType *Pass::getAnalysisToUpdate() const {
///
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);
}
template<typename AnalysisType>
AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
- assert(Resolver && "Pass has not been inserted into a PassManager object!");
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)
@@ -224,7 +238,17 @@ AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
break;
}
}
-
+#else
+ 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.
+ Pass *ResultPass = Resolver_New->findImplPass(PI);
+ assert (ResultPass &&
+ "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,