[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
This commit is contained in:
Chandler Carruth 2014-04-21 08:20:10 +00:00
parent f69bb5e43c
commit 4d3682bda5
2 changed files with 18 additions and 3 deletions

View File

@ -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));

View File

@ -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