[PM] Wire the analysis passes (such as they are) into the registry, and
authorChandler Carruth <chandlerc@gmail.com>
Mon, 21 Apr 2014 08:20:10 +0000 (08:20 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 21 Apr 2014 08:20:10 +0000 (08:20 +0000)
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

tools/opt/NewPMDriver.cpp
tools/opt/PassRegistry.def

index fc4a1bf76c98508cf7708b0c79d5192acc23407c..39a6579356d0c8cd46e19fcde94651257920f9c8 100644 (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));
index 6b507f77555d1904915d16e983f3ec308c9900f5..92ab2d932f3f59685c770082fc4a2563934e2c4e 100644 (file)
 
 // 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