diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-21 08:20:10 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-21 08:20:10 +0000 |
commit | 4d3682bda5d737183f188d2b58e0ff8c837d241f (patch) | |
tree | 945d048d4a0e38a0600f6ccb606d50bf30a10a4f /tools/opt | |
parent | f69bb5e43c1427d23800e4e678a7c2f2088f0c88 (diff) | |
download | llvm-4d3682bda5d737183f188d2b58e0ff8c837d241f.tar.gz llvm-4d3682bda5d737183f188d2b58e0ff8c837d241f.tar.bz2 llvm-4d3682bda5d737183f188d2b58e0ff8c837d241f.tar.xz |
[PM] Wire the analysis passes (such as they are) into the registry, and
teach the opt driver to use it rather than a manual list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r-- | tools/opt/NewPMDriver.cpp | 10 | ||||
-rw-r--r-- | tools/opt/PassRegistry.def | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tools/opt/NewPMDriver.cpp b/tools/opt/NewPMDriver.cpp index fc4a1bf76c..39a6579356 100644 --- a/tools/opt/NewPMDriver.cpp +++ b/tools/opt/NewPMDriver.cpp @@ -36,9 +36,13 @@ bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M, FunctionAnalysisManager FAM; ModuleAnalysisManager MAM; - // FIXME: Lift this registration of analysis passes into a .def file adjacent - // to the one used to associate names with passes. - MAM.registerPass(LazyCallGraphAnalysis()); +#define MODULE_ANALYSIS(NAME, CREATE_PASS) \ + MAM.registerPass(CREATE_PASS); +#include "PassRegistry.def" + +#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \ + FAM.registerPass(CREATE_PASS); +#include "PassRegistry.def" // Cross register the analysis managers through their proxies. MAM.registerPass(FunctionAnalysisManagerModuleProxy(FAM)); diff --git a/tools/opt/PassRegistry.def b/tools/opt/PassRegistry.def index 6b507f7755..92ab2d932f 100644 --- a/tools/opt/PassRegistry.def +++ b/tools/opt/PassRegistry.def @@ -16,6 +16,12 @@ // NOTE: NO INCLUDE GUARD DESIRED! +#ifndef MODULE_ANALYSIS +#define MODULE_ANALYSIS(NAME, CREATE_PASS) +#endif +MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis()) +#undef MODULE_ANALYSIS + #ifndef MODULE_PASS #define MODULE_PASS(NAME, CREATE_PASS) #endif @@ -23,6 +29,11 @@ MODULE_PASS("print", PrintModulePass(dbgs())) MODULE_PASS("print-cg", LazyCallGraphPrinterPass(dbgs())) #undef MODULE_PASS +#ifndef FUNCTION_ANALYSIS +#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) +#endif +#undef FUNCTION_ANALYSIS + #ifndef FUNCTION_PASS #define FUNCTION_PASS(NAME, CREATE_PASS) #endif |