summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-01-06 02:37:55 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-01-06 02:37:55 +0000
commita872f3f67699177169a4531946af322ab64a3fc2 (patch)
tree3c49b772389ebf38ae08eaabbbe87b21a1cca585 /llvm/tools/opt
parentb70f6734901eec6b20e44ab140d345aa38503a5d (diff)
downloadbcm5719-llvm-a872f3f67699177169a4531946af322ab64a3fc2.tar.gz
bcm5719-llvm-a872f3f67699177169a4531946af322ab64a3fc2.zip
[PM] Sink the no-op pass parsing logic into the .def-based registry to
simplify things. This will become more important as I add no-op analyses that want to re-use the logic we already have for analyses in the registry. For now, no functionality changed. llvm-svn: 225238
Diffstat (limited to 'llvm/tools/opt')
-rw-r--r--llvm/tools/opt/PassRegistry.def3
-rw-r--r--llvm/tools/opt/Passes.cpp21
2 files changed, 3 insertions, 21 deletions
diff --git a/llvm/tools/opt/PassRegistry.def b/llvm/tools/opt/PassRegistry.def
index ed7fdf125d5..ea9f95f5941 100644
--- a/llvm/tools/opt/PassRegistry.def
+++ b/llvm/tools/opt/PassRegistry.def
@@ -25,6 +25,7 @@ MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
#ifndef MODULE_PASS
#define MODULE_PASS(NAME, CREATE_PASS)
#endif
+MODULE_PASS("no-op-module", NoOpModulePass())
MODULE_PASS("print", PrintModulePass(dbgs()))
MODULE_PASS("print-cg", LazyCallGraphPrinterPass(dbgs()))
MODULE_PASS("verify", VerifierPass())
@@ -38,6 +39,7 @@ MODULE_PASS("verify", VerifierPass())
#ifndef CGSCC_PASS
#define CGSCC_PASS(NAME, CREATE_PASS)
#endif
+CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
#undef CGSCC_PASS
#ifndef FUNCTION_ANALYSIS
@@ -48,6 +50,7 @@ MODULE_PASS("verify", VerifierPass())
#ifndef FUNCTION_PASS
#define FUNCTION_PASS(NAME, CREATE_PASS)
#endif
+FUNCTION_PASS("no-op-function", NoOpFunctionPass())
FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
FUNCTION_PASS("verify", VerifierPass())
#undef FUNCTION_PASS
diff --git a/llvm/tools/opt/Passes.cpp b/llvm/tools/opt/Passes.cpp
index 0502f1ea313..b9c048a8c02 100644
--- a/llvm/tools/opt/Passes.cpp
+++ b/llvm/tools/opt/Passes.cpp
@@ -67,8 +67,6 @@ void llvm::registerFunctionAnalyses(FunctionAnalysisManager &FAM) {
}
static bool isModulePassName(StringRef Name) {
- if (Name == "no-op-module") return true;
-
#define MODULE_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
#include "PassRegistry.def"
@@ -82,8 +80,6 @@ static bool isModulePassName(StringRef Name) {
}
static bool isCGSCCPassName(StringRef Name) {
- if (Name == "no-op-cgscc") return true;
-
#define CGSCC_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
#include "PassRegistry.def"
@@ -97,8 +93,6 @@ static bool isCGSCCPassName(StringRef Name) {
}
static bool isFunctionPassName(StringRef Name) {
- if (Name == "no-op-function") return true;
-
#define FUNCTION_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
#include "PassRegistry.def"
@@ -112,11 +106,6 @@ static bool isFunctionPassName(StringRef Name) {
}
static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
- if (Name == "no-op-module") {
- MPM.addPass(NoOpModulePass());
- return true;
- }
-
#define MODULE_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
MPM.addPass(CREATE_PASS); \
@@ -136,11 +125,6 @@ static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
}
static bool parseCGSCCPassName(CGSCCPassManager &CGPM, StringRef Name) {
- if (Name == "no-op-cgscc") {
- CGPM.addPass(NoOpCGSCCPass());
- return true;
- }
-
#define CGSCC_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
CGPM.addPass(CREATE_PASS); \
@@ -160,11 +144,6 @@ static bool parseCGSCCPassName(CGSCCPassManager &CGPM, StringRef Name) {
}
static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
- if (Name == "no-op-function") {
- FPM.addPass(NoOpFunctionPass());
- return true;
- }
-
#define FUNCTION_PASS(NAME, CREATE_PASS) \
if (Name == NAME) { \
FPM.addPass(CREATE_PASS); \
OpenPOWER on IntegriCloud