summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-02-06 04:25:13 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-02-06 04:25:13 +0000
commitd8e62b62ee3e9a30e7b9a247fcbf5b6d1bd4b2e5 (patch)
treeb607bfe5fe27e8be22bca0a3033883f1e188c5d1 /tools
parent58bc0ca37b66bf49bc20661fd2748319a06808c3 (diff)
downloadllvm-d8e62b62ee3e9a30e7b9a247fcbf5b6d1bd4b2e5.tar.gz
llvm-d8e62b62ee3e9a30e7b9a247fcbf5b6d1bd4b2e5.tar.bz2
llvm-d8e62b62ee3e9a30e7b9a247fcbf5b6d1bd4b2e5.tar.xz
[PM] Wire up the analysis managers in the opt driver. This isn't really
necessary until we add analyses to the driver, but I have such an analysis ready and wanted to split this out. This is actually exercised by the existing tests of the new pass manager as the analysis managers are cross-checked and validated by the function and module managers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200901 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/NewPMDriver.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/opt/NewPMDriver.cpp b/tools/opt/NewPMDriver.cpp
index f21a68fc8a..313db544ab 100644
--- a/tools/opt/NewPMDriver.cpp
+++ b/tools/opt/NewPMDriver.cpp
@@ -32,8 +32,18 @@ using namespace opt_tool;
bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
tool_output_file *Out, StringRef PassPipeline,
OutputKind OK, VerifierKind VK) {
- ModulePassManager MPM;
+ 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());
+ // Cross register the analysis managers through their proxies.
+ MAM.registerPass(FunctionAnalysisManagerModuleProxy(FAM));
+ FAM.registerPass(ModuleAnalysisManagerFunctionProxy(MAM));
+
+ ModulePassManager MPM;
if (VK > VK_NoVerifier)
MPM.addPass(VerifierPass());
@@ -61,7 +71,7 @@ bool llvm::runPassPipeline(StringRef Arg0, LLVMContext &Context, Module &M,
cl::PrintOptionValues();
// Now that we have all of the passes ready, run them.
- MPM.run(&M);
+ MPM.run(&M, &MAM);
// Declare success.
if (OK != OK_NoOutput)