llvm.org GIT mirror llvm / 2bbc5ab
[PM] Move the analysis registry into the Passes.cpp file and provide a normal interface for it in Passes.h. This gives us essentially a single interface for running pass managers which are provided from the bottom of the LLVM stack through interfaces at the top of the LLVM stack that populate them with all of the different analyses available throughout. It also means there is a single blob of code that needs to include all of the pass headers and needs to deal with the registry of passes and parsing names. No functionality changed intended, should just be cleanup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225237 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 4 years ago
3 changed file(s) with 46 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1616 #include "Passes.h"
1717 #include "llvm/ADT/StringRef.h"
1818 #include "llvm/Analysis/CGSCCPassManager.h"
19 #include "llvm/Analysis/LazyCallGraph.h"
2019 #include "llvm/Bitcode/BitcodeWriterPass.h"
2120 #include "llvm/IR/IRPrintingPasses.h"
2221 #include "llvm/IR/LLVMContext.h"
3736 CGSCCAnalysisManager CGAM;
3837 ModuleAnalysisManager MAM;
3938
40 #define MODULE_ANALYSIS(NAME, CREATE_PASS) \
41 MAM.registerPass(CREATE_PASS);
42 #include "PassRegistry.def"
43
44 #define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
45 CGAM.registerPass(CREATE_PASS);
46 #include "PassRegistry.def"
47
48 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
49 FAM.registerPass(CREATE_PASS);
50 #include "PassRegistry.def"
39 // Register all the basic analyses with the managers.
40 registerModuleAnalyses(MAM);
41 registerCGSCCAnalyses(CGAM);
42 registerFunctionAnalyses(FAM);
5143
5244 // Cross register the analysis managers through their proxies.
5345 MAM.registerPass(FunctionAnalysisManagerModuleProxy(FAM));
4747
4848 } // End anonymous namespace.
4949
50 void llvm::registerModuleAnalyses(ModuleAnalysisManager &MAM) {
51 #define MODULE_ANALYSIS(NAME, CREATE_PASS) \
52 MAM.registerPass(CREATE_PASS);
53 #include "PassRegistry.def"
54 }
55
56 void llvm::registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM) {
57 #define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
58 CGAM.registerPass(CREATE_PASS);
59 #include "PassRegistry.def"
60 }
61
62 void llvm::registerFunctionAnalyses(FunctionAnalysisManager &FAM) {
63 #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
64 FAM.registerPass(CREATE_PASS);
65 #include "PassRegistry.def"
66 }
67
5068 static bool isModulePassName(StringRef Name) {
5169 if (Name == "no-op-module") return true;
5270
1818 #include "llvm/ADT/StringRef.h"
1919
2020 namespace llvm {
21 class CGSCCAnalysisManager;
22 class FunctionAnalysisManager;
23 class ModuleAnalysisManager;
2124 class ModulePassManager;
25
26 /// \brief Registers all available module analysis passes.
27 ///
28 /// This is an interface that can be used to populate a \c
29 /// ModuleAnalysisManager with all registered module analyses. Callers can
30 /// still manually register any additional analyses.
31 void registerModuleAnalyses(ModuleAnalysisManager &MAM);
32
33 /// \brief Registers all available CGSCC analysis passes.
34 ///
35 /// This is an interface that can be used to populate a \c CGSCCAnalysisManager
36 /// with all registered CGSCC analyses. Callers can still manually register any
37 /// additional analyses.
38 void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM);
39
40 /// \brief Registers all available function analysis passes.
41 ///
42 /// This is an interface that can be used to populate a \c
43 /// FunctionAnalysisManager with all registered function analyses. Callers can
44 /// still manually register any additional analyses.
45 void registerFunctionAnalyses(FunctionAnalysisManager &FAM);
2246
2347 /// \brief Parse a textual pass pipeline description into a \c ModulePassManager.
2448 ///