[llvm] r225245 - [PM] Simplify how we use the registry by including it only once. Still

Chandler Carruth chandlerc at gmail.com
Mon Jan 5 20:49:39 PST 2015


Author: chandlerc
Date: Mon Jan  5 22:49:38 2015
New Revision: 225245

URL: http://llvm.org/viewvc/llvm-project?rev=225245&view=rev
Log:
[PM] Simplify how we use the registry by including it only once. Still
more verbose than I'd like, but the code really isn't that interesting,
and this still seems vastly simpler than any other solutions I've come
up with. =] Maybe if we get to the 10th IR unit, this will be a problem
in practice.

Modified:
    llvm/trunk/tools/opt/Passes.cpp

Modified: llvm/trunk/tools/opt/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Passes.cpp?rev=225245&r1=225244&r2=225245&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Passes.cpp (original)
+++ llvm/trunk/tools/opt/Passes.cpp Mon Jan  5 22:49:38 2015
@@ -104,9 +104,6 @@ void llvm::registerFunctionAnalyses(Func
 
 static bool isModulePassName(StringRef Name) {
 #define MODULE_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define MODULE_ANALYSIS(NAME, CREATE_PASS)                                     \
   if (Name == "require<" NAME ">")                                             \
     return true;
@@ -117,9 +114,6 @@ static bool isModulePassName(StringRef N
 
 static bool isCGSCCPassName(StringRef Name) {
 #define CGSCC_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define CGSCC_ANALYSIS(NAME, CREATE_PASS)                                      \
   if (Name == "require<" NAME ">")                                             \
     return true;
@@ -130,9 +124,6 @@ static bool isCGSCCPassName(StringRef Na
 
 static bool isFunctionPassName(StringRef Name) {
 #define FUNCTION_PASS(NAME, CREATE_PASS) if (Name == NAME) return true;
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS)                                   \
   if (Name == "require<" NAME ">")                                             \
     return true;
@@ -147,9 +138,6 @@ static bool parseModulePassName(ModulePa
     MPM.addPass(CREATE_PASS);                                                  \
     return true;                                                               \
   }
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define MODULE_ANALYSIS(NAME, CREATE_PASS)                                     \
   if (Name == "require<" NAME ">") {                                           \
     MPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>());         \
@@ -166,9 +154,6 @@ static bool parseCGSCCPassName(CGSCCPass
     CGPM.addPass(CREATE_PASS);                                                 \
     return true;                                                               \
   }
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define CGSCC_ANALYSIS(NAME, CREATE_PASS)                                      \
   if (Name == "require<" NAME ">") {                                           \
     CGPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>());        \
@@ -185,9 +170,6 @@ static bool parseFunctionPassName(Functi
     FPM.addPass(CREATE_PASS);                                                  \
     return true;                                                               \
   }
-#include "PassRegistry.def"
-
-  // We also support building a require pass around any analysis.
 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS)                                   \
   if (Name == "require<" NAME ">") {                                           \
     FPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>());         \





More information about the llvm-commits mailing list