[llvm] r206739 - [PM] Wire the analysis passes (such as they are) into the registry, and
Chandler Carruth
chandlerc at gmail.com
Mon Apr 21 01:20:11 PDT 2014
Author: chandlerc
Date: Mon Apr 21 03:20:10 2014
New Revision: 206739
URL: http://llvm.org/viewvc/llvm-project?rev=206739&view=rev
Log:
[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.
Modified:
llvm/trunk/tools/opt/NewPMDriver.cpp
llvm/trunk/tools/opt/PassRegistry.def
Modified: llvm/trunk/tools/opt/NewPMDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/NewPMDriver.cpp?rev=206739&r1=206738&r2=206739&view=diff
==============================================================================
--- llvm/trunk/tools/opt/NewPMDriver.cpp (original)
+++ llvm/trunk/tools/opt/NewPMDriver.cpp Mon Apr 21 03:20:10 2014
@@ -36,9 +36,13 @@ bool llvm::runPassPipeline(StringRef Arg
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));
Modified: llvm/trunk/tools/opt/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/PassRegistry.def?rev=206739&r1=206738&r2=206739&view=diff
==============================================================================
--- llvm/trunk/tools/opt/PassRegistry.def (original)
+++ llvm/trunk/tools/opt/PassRegistry.def Mon Apr 21 03:20:10 2014
@@ -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(dbg
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
More information about the llvm-commits
mailing list