25 bool ShouldPreserveUseListOrder)
26 : OS(OS), Banner(Banner),
27 ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
31 M.
print(OS,
nullptr, ShouldPreserveUseListOrder);
37 : OS(OS), Banner(Banner) {}
40 OS << Banner << static_cast<Value &>(
F);
46 class PrintModulePassWrapper :
public ModulePass {
52 PrintModulePassWrapper(
raw_ostream &OS,
const std::string &Banner,
53 bool ShouldPreserveUseListOrder)
54 :
ModulePass(
ID),
P(OS, Banner, ShouldPreserveUseListOrder) {}
56 bool runOnModule(
Module &M)
override {
72 PrintFunctionPassWrapper(
raw_ostream &OS,
const std::string &Banner)
76 bool runOnFunction(
Function &
F)
override {
93 PrintBasicBlockPass(
raw_ostream &Out,
const std::string &Banner)
96 bool runOnBasicBlock(
BasicBlock &BB)
override {
110 "Print module to stderr",
false,
false)
111 char PrintFunctionPassWrapper::
ID = 0;
114 char PrintBasicBlockPass::ID = 0;
119 const std::
string &Banner,
120 bool ShouldPreserveUseListOrder) {
121 return new PrintModulePassWrapper(OS, Banner, ShouldPreserveUseListOrder);
125 const std::string &Banner) {
126 return new PrintFunctionPassWrapper(OS, Banner);
130 const std::string &Banner) {
131 return new PrintBasicBlockPass(OS, Banner);
A Module instance is used to store all the information related to an LLVM module. ...
Pass for printing a Module as LLVM's text IR assembly.
void Print(const Unit &U, const char *PrintAfter="")
FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed...
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false) const
Print the module to an output stream with an optional AssemblyAnnotationWriter.
An abstract set of preserved analyses following a transformation pass run.
LLVM Basic Block Representation.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
BasicBlockPass class - This class is used to implement most local optimizations.
Module.h This file contains the declarations for the Module class.
PreservedAnalyses run(Module &M)
BasicBlockPass * createPrintBasicBlockPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that writes the BB to the specified raw_ostream.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setPreservesAll()
Set by analyses that do not transform their input at all.
PreservedAnalyses run(Function &F)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
This file defines passes to print out IR in various granularities.
INITIALIZE_PASS(PrintModulePassWrapper,"print-module","Print module to stderr", false, false) char PrintFunctionPassWrapper INITIALIZE_PASS(PrintFunctionPassWrapper,"print-function","Print function to stderr", false, false) char PrintBasicBlockPass INITIALIZE_PASS(PrintBasicBlockPass,"print-bb","Print BB to stderr", false, false) ModulePass *llvm
This class implements an extremely fast bulk output stream that can only output to a stream...
print Print MemDeps of function
This header defines various interfaces for pass management in LLVM.
Pass for printing a Function as LLVM's text IR assembly.