diff options
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/opt/PassRegistry.def | 3 | ||||
| -rw-r--r-- | llvm/tools/opt/Passes.cpp | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/llvm/tools/opt/PassRegistry.def b/llvm/tools/opt/PassRegistry.def index ea9f95f5941..a7b4326c352 100644 --- a/llvm/tools/opt/PassRegistry.def +++ b/llvm/tools/opt/PassRegistry.def @@ -20,6 +20,7 @@ #define MODULE_ANALYSIS(NAME, CREATE_PASS) #endif MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis()) +MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis()) #undef MODULE_ANALYSIS #ifndef MODULE_PASS @@ -34,6 +35,7 @@ MODULE_PASS("verify", VerifierPass()) #ifndef CGSCC_ANALYSIS #define CGSCC_ANALYSIS(NAME, CREATE_PASS) #endif +CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis()) #undef CGSCC_ANALYSIS #ifndef CGSCC_PASS @@ -45,6 +47,7 @@ CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass()) #ifndef FUNCTION_ANALYSIS #define FUNCTION_ANALYSIS(NAME, CREATE_PASS) #endif +FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis()) #undef FUNCTION_ANALYSIS #ifndef FUNCTION_PASS diff --git a/llvm/tools/opt/Passes.cpp b/llvm/tools/opt/Passes.cpp index b9c048a8c02..3acd0f3742c 100644 --- a/llvm/tools/opt/Passes.cpp +++ b/llvm/tools/opt/Passes.cpp @@ -32,6 +32,18 @@ struct NoOpModulePass { static StringRef name() { return "NoOpModulePass"; } }; +/// \brief No-op module analysis. +struct NoOpModuleAnalysis { + struct Result {}; + Result run(Module &) { return Result(); } + static StringRef name() { return "NoOpModuleAnalysis"; } + static void *ID() { return (void *)&PassID; } +private: + static char PassID; +}; + +char NoOpModuleAnalysis::PassID; + /// \brief No-op CGSCC pass which does nothing. struct NoOpCGSCCPass { PreservedAnalyses run(LazyCallGraph::SCC &C) { @@ -40,12 +52,36 @@ struct NoOpCGSCCPass { static StringRef name() { return "NoOpCGSCCPass"; } }; +/// \brief No-op CGSCC analysis. +struct NoOpCGSCCAnalysis { + struct Result {}; + Result run(LazyCallGraph::SCC &) { return Result(); } + static StringRef name() { return "NoOpCGSCCAnalysis"; } + static void *ID() { return (void *)&PassID; } +private: + static char PassID; +}; + +char NoOpCGSCCAnalysis::PassID; + /// \brief No-op function pass which does nothing. struct NoOpFunctionPass { PreservedAnalyses run(Function &F) { return PreservedAnalyses::all(); } static StringRef name() { return "NoOpFunctionPass"; } }; +/// \brief No-op function analysis. +struct NoOpFunctionAnalysis { + struct Result {}; + Result run(Function &) { return Result(); } + static StringRef name() { return "NoOpFunctionAnalysis"; } + static void *ID() { return (void *)&PassID; } +private: + static char PassID; +}; + +char NoOpFunctionAnalysis::PassID; + } // End anonymous namespace. void llvm::registerModuleAnalyses(ModuleAnalysisManager &MAM) { |

