@@ -78,14 +78,14 @@ namespace llvm {
7878
7979// FIXME: Dummy target independent passes definitions that have not yet been
8080// ported to new pass manager. Once they do, remove these.
81- #define DUMMY_FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
81+ #define DUMMY_FUNCTION_PASS (NAME, PASS_NAME ) \
8282 struct PASS_NAME : public PassInfoMixin <PASS_NAME> { \
8383 template <typename ... Ts> PASS_NAME (Ts &&...) {} \
8484 PreservedAnalyses run (Function &, FunctionAnalysisManager &) { \
8585 return PreservedAnalyses::all (); \
8686 } \
8787 };
88- #define DUMMY_MACHINE_MODULE_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
88+ #define DUMMY_MACHINE_MODULE_PASS (NAME, PASS_NAME ) \
8989 struct PASS_NAME : public MachinePassInfoMixin <PASS_NAME> { \
9090 template <typename ... Ts> PASS_NAME (Ts &&...) {} \
9191 Error run (Module &, MachineFunctionAnalysisManager &) { \
@@ -96,25 +96,14 @@ namespace llvm {
9696 llvm_unreachable (" this api is to make new PM api happy" ); \
9797 } \
9898 };
99- #define DUMMY_MACHINE_FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
99+ #define DUMMY_MACHINE_FUNCTION_PASS (NAME, PASS_NAME ) \
100100 struct PASS_NAME : public MachinePassInfoMixin <PASS_NAME> { \
101101 template <typename ... Ts> PASS_NAME (Ts &&...) {} \
102102 PreservedAnalyses run (MachineFunction &, \
103103 MachineFunctionAnalysisManager &) { \
104104 return PreservedAnalyses::all (); \
105105 } \
106106 };
107- #define DUMMY_MACHINE_FUNCTION_ANALYSIS (NAME, PASS_NAME, CONSTRUCTOR ) \
108- struct PASS_NAME : public AnalysisInfoMixin <PASS_NAME> { \
109- template <typename ... Ts> PASS_NAME (Ts &&...) {} \
110- using Result = struct {}; \
111- template <typename IRUnitT, typename AnalysisManagerT, \
112- typename ... ExtraArgTs> \
113- Result run (IRUnitT &, AnalysisManagerT &, ExtraArgTs &&...) { \
114- return {}; \
115- } \
116- static AnalysisKey Key; \
117- };
118107#include " llvm/Passes/MachinePassRegistry.def"
119108
120109// / This class provides access to building LLVM's passes.
@@ -150,7 +139,6 @@ template <typename DerivedT> class CodeGenPassBuilder {
150139 void registerModuleAnalyses (ModuleAnalysisManager &) const ;
151140 void registerFunctionAnalyses (FunctionAnalysisManager &) const ;
152141 void registerMachineFunctionAnalyses (MachineFunctionAnalysisManager &) const ;
153- std::pair<StringRef, bool > getPassNameFromLegacyName (StringRef) const ;
154142
155143 void registerAnalyses (MachineFunctionAnalysisManager &MFAM) const {
156144 registerModuleAnalyses (*MFAM.MAM );
@@ -608,8 +596,8 @@ static inline AAManager registerAAAnalyses() {
608596template <typename Derived>
609597void CodeGenPassBuilder<Derived>::registerModuleAnalyses(
610598 ModuleAnalysisManager &MAM) const {
611- #define MODULE_ANALYSIS (NAME, PASS_NAME, CONSTRUCTOR ) \
612- MAM.registerPass ([&] { return PASS_NAME CONSTRUCTOR ; });
599+ #define MODULE_ANALYSIS (NAME, CREATE_PASS ) \
600+ MAM.registerPass ([&] { return CREATE_PASS ; });
613601#include " MachinePassRegistry.def"
614602 derived ().registerTargetAnalysis (MAM);
615603}
@@ -619,68 +607,21 @@ void CodeGenPassBuilder<Derived>::registerFunctionAnalyses(
619607 FunctionAnalysisManager &FAM) const {
620608 FAM.registerPass ([this ] { return registerAAAnalyses (); });
621609
622- #define FUNCTION_ANALYSIS (NAME, PASS_NAME, CONSTRUCTOR ) \
623- FAM.registerPass ([&] { return PASS_NAME CONSTRUCTOR ; });
610+ #define FUNCTION_ANALYSIS (NAME, CREATE_PASS ) \
611+ FAM.registerPass ([&] { return CREATE_PASS ; });
624612#include " MachinePassRegistry.def"
625613 derived ().registerTargetAnalysis (FAM);
626614}
627615
628616template <typename Derived>
629617void CodeGenPassBuilder<Derived>::registerMachineFunctionAnalyses(
630618 MachineFunctionAnalysisManager &MFAM) const {
631- #define MACHINE_FUNCTION_ANALYSIS (NAME, PASS_NAME, CONSTRUCTOR ) \
632- MFAM.registerPass ([&] { return PASS_NAME CONSTRUCTOR ; });
619+ #define MACHINE_FUNCTION_ANALYSIS (NAME, CREATE_PASS ) \
620+ MFAM.registerPass ([&] { return CREATE_PASS ; });
633621#include " MachinePassRegistry.def"
634622 derived ().registerTargetAnalysis (MFAM);
635623}
636624
637- // FIXME: For new PM, use pass name directly in commandline seems good.
638- // Translate stringfied pass name to its old commandline name. Returns the
639- // matching legacy name and a boolean value indicating if the pass is a machine
640- // pass.
641- template <typename Derived>
642- std::pair<StringRef, bool >
643- CodeGenPassBuilder<Derived>::getPassNameFromLegacyName(StringRef Name) const {
644- std::pair<StringRef, bool > Ret;
645- if (Name.empty ())
646- return Ret;
647-
648- #define FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
649- if (Name == NAME) \
650- Ret = {#PASS_NAME, false };
651- #define DUMMY_FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
652- if (Name == NAME) \
653- Ret = {#PASS_NAME, false };
654- #define MODULE_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
655- if (Name == NAME) \
656- Ret = {#PASS_NAME, false };
657- #define DUMMY_MODULE_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
658- if (Name == NAME) \
659- Ret = {#PASS_NAME, false };
660- #define MACHINE_MODULE_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
661- if (Name == NAME) \
662- Ret = {#PASS_NAME, true };
663- #define DUMMY_MACHINE_MODULE_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
664- if (Name == NAME) \
665- Ret = {#PASS_NAME, true };
666- #define MACHINE_FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
667- if (Name == NAME) \
668- Ret = {#PASS_NAME, true };
669- #define DUMMY_MACHINE_FUNCTION_PASS (NAME, PASS_NAME, CONSTRUCTOR ) \
670- if (Name == NAME) \
671- Ret = {#PASS_NAME, true };
672- #include " llvm/Passes/MachinePassRegistry.def"
673-
674- if (Ret.first .empty ())
675- Ret = derived ().getTargetPassNameFromLegacyName (Name);
676-
677- if (Ret.first .empty ())
678- report_fatal_error (Twine (' \" ' ) + Twine (Name) +
679- Twine (" \" pass could not be found." ));
680-
681- return Ret;
682- }
683-
684625template <typename Derived>
685626void CodeGenPassBuilder<Derived>::addISelPasses(AddIRPass &addPass) const {
686627 derived ().addGlobalMergePass (addPass);
0 commit comments