llvm.org GIT mirror llvm / 2e306ca
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225238 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 4 years ago
2 changed file(s) with 3 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
2424 #ifndef MODULE_PASS
2525 #define MODULE_PASS(NAME, CREATE_PASS)
2626 #endif
27 MODULE_PASS("no-op-module", NoOpModulePass())
2728 MODULE_PASS("print", PrintModulePass(dbgs()))
2829 MODULE_PASS("print-cg", LazyCallGraphPrinterPass(dbgs()))
2930 MODULE_PASS("verify", VerifierPass())
3738 #ifndef CGSCC_PASS
3839 #define CGSCC_PASS(NAME, CREATE_PASS)
3940 #endif
41 CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
4042 #undef CGSCC_PASS
4143
4244 #ifndef FUNCTION_ANALYSIS
4749 #ifndef FUNCTION_PASS
4850 #define FUNCTION_PASS(NAME, CREATE_PASS)
4951 #endif
52 FUNCTION_PASS("no-op-function", NoOpFunctionPass())
5053 FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
5154 FUNCTION_PASS("verify", VerifierPass())
5255 #undef FUNCTION_PASS
6666 }
6767
6868 static bool isModulePassName(StringRef Name) {
69 if (Name == "no-op-module") return true;
70
7169 #define MODULE_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
7270 #include "PassRegistry.def"
7371
8179 }
8280
8381 static bool isCGSCCPassName(StringRef Name) {
84 if (Name == "no-op-cgscc") return true;
85
8682 #define CGSCC_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
8783 #include "PassRegistry.def"
8884
9692 }
9793
9894 static bool isFunctionPassName(StringRef Name) {
99 if (Name == "no-op-function") return true;
100
10195 #define FUNCTION_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
10296 #include "PassRegistry.def"
10397
111105 }
112106
113107 static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
114 if (Name == "no-op-module") {
115 MPM.addPass(NoOpModulePass());
116 return true;
117 }
118
119108 #define MODULE_PASS(NAME, CREATE_PASS) \
120109 if (Name == NAME) { \
121110 MPM.addPass(CREATE_PASS); \
135124 }
136125
137126 static bool parseCGSCCPassName(CGSCCPassManager &CGPM, StringRef Name) {
138 if (Name == "no-op-cgscc") {
139 CGPM.addPass(NoOpCGSCCPass());
140 return true;
141 }
142
143127 #define CGSCC_PASS(NAME, CREATE_PASS) \
144128 if (Name == NAME) { \
145129 CGPM.addPass(CREATE_PASS); \
159143 }
160144
161145 static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
162 if (Name == "no-op-function") {
163 FPM.addPass(NoOpFunctionPass());
164 return true;
165 }
166
167146 #define FUNCTION_PASS(NAME, CREATE_PASS) \
168147 if (Name == NAME) { \
169148 FPM.addPass(CREATE_PASS); \