diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/IRPrintingPasses.h | 40 | ||||
-rw-r--r-- | include/llvm/InitializePasses.h | 4 |
2 files changed, 41 insertions, 3 deletions
diff --git a/include/llvm/IR/IRPrintingPasses.h b/include/llvm/IR/IRPrintingPasses.h index 1d6cf95b0b..3d759ef57d 100644 --- a/include/llvm/IR/IRPrintingPasses.h +++ b/include/llvm/IR/IRPrintingPasses.h @@ -19,12 +19,16 @@ #ifndef LLVM_IR_PRINTMODULEPASS_H #define LLVM_IR_PRINTMODULEPASS_H +#include "llvm/ADT/StringRef.h" #include <string> namespace llvm { +class BasicBlockPass; +class Function; class FunctionPass; +class Module; class ModulePass; -class BasicBlockPass; +class PreservedAnalyses; class raw_ostream; /// \brief Create and return a pass that writes the module to the specified @@ -42,6 +46,40 @@ FunctionPass *createPrintFunctionPass(raw_ostream &OS, BasicBlockPass *createPrintBasicBlockPass(raw_ostream &OS, const std::string &Banner = ""); +/// \brief Pass for printing a Module as LLVM's text IR assembly. +/// +/// Note: This pass is for use with the new pass manager. Use the create...Pass +/// functions above to create passes for use with the legacy pass manager. +class PrintModulePass { + raw_ostream &OS; + std::string Banner; + +public: + PrintModulePass(); + PrintModulePass(raw_ostream &OS, const std::string &Banner = ""); + + PreservedAnalyses run(Module *M); + + static StringRef name() { return "PrintModulePass"; } +}; + +/// \brief Pass for printing a Function as LLVM's text IR assembly. +/// +/// Note: This pass is for use with the new pass manager. Use the create...Pass +/// functions above to create passes for use with the legacy pass manager. +class PrintFunctionPass { + raw_ostream &OS; + std::string Banner; + +public: + PrintFunctionPass(); + PrintFunctionPass(raw_ostream &OS, const std::string &Banner = ""); + + PreservedAnalyses run(Function *F); + + static StringRef name() { return "PrintFunctionPass"; } +}; + } // End llvm namespace #endif diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h index e27d6b7d39..6c7ab111cb 100644 --- a/include/llvm/InitializePasses.h +++ b/include/llvm/InitializePasses.h @@ -212,8 +212,8 @@ void initializePostDominatorTreePass(PassRegistry&); void initializePostRASchedulerPass(PassRegistry&); void initializePostMachineSchedulerPass(PassRegistry&); void initializePreVerifierPass(PassRegistry&); -void initializePrintFunctionPassPass(PassRegistry&); -void initializePrintModulePassPass(PassRegistry&); +void initializePrintFunctionPassWrapperPass(PassRegistry&); +void initializePrintModulePassWrapperPass(PassRegistry&); void initializePrintBasicBlockPassPass(PassRegistry&); void initializeProcessImplicitDefsPass(PassRegistry&); void initializePromotePassPass(PassRegistry&); |