25 bool ShouldPreserveUseListOrder)
26 : OS(OS), Banner(Banner),
27 ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
32 M.
print(OS,
nullptr, ShouldPreserveUseListOrder);
43 : OS(OS), Banner(Banner) {}
51 OS << Banner << static_cast<Value &>(
F);
58 class PrintModulePassWrapper :
public ModulePass {
64 PrintModulePassWrapper(
raw_ostream &OS,
const std::string &Banner,
65 bool ShouldPreserveUseListOrder)
66 :
ModulePass(ID),
P(OS, Banner, ShouldPreserveUseListOrder) {}
68 bool runOnModule(
Module &M)
override {
78 StringRef getPassName()
const override {
return "Print Module IR"; }
87 PrintFunctionPassWrapper(
raw_ostream &OS,
const std::string &Banner)
101 StringRef getPassName()
const override {
return "Print Function IR"; }
111 PrintBasicBlockPass(
raw_ostream &Out,
const std::string &Banner)
123 StringRef getPassName()
const override {
return "Print BasicBlock IR"; }
130 "Print module to stderr",
false,
true)
133 "Print function to stderr",
false,
true)
140 bool ShouldPreserveUseListOrder) {
141 return new PrintModulePassWrapper(OS, Banner, ShouldPreserveUseListOrder);
145 const std::string &Banner) {
146 return new PrintFunctionPassWrapper(OS, Banner);
150 const std::string &Banner) {
151 return new PrintBasicBlockPass(OS, Banner);
155 const char *PID = (
const char*)P->
getPassID();
157 return (PID == &PrintModulePassWrapper::ID)
159 || (PID == &PrintBasicBlockPass::ID);
Pass interface - Implemented by all 'passes'.
bool forcePrintModuleIR()
forcePrintModuleIR - returns true if IR printing passes should
Compute iterated dominance frontiers using a linear time algorithm.
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.
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...
bool isIRPrintingPass(Pass *P)
Return true if a pass is for IR printing.
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
iterator_range< iterator > functions()
LLVM Basic Block Representation.
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
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.
INITIALIZE_PASS(PrintModulePassWrapper, "print-module", "Print module to stderr", false, true) char PrintFunctionPassWrapper INITIALIZE_PASS(PrintFunctionPassWrapper, "print-function", "Print function to stderr", false, true) char PrintBasicBlockPass INITIALIZE_PASS(PrintBasicBlockPass, "print-bb", "Print BB to stderr", false, true) ModulePass *llvm
BasicBlockPass class - This class is used to implement most local optimizations.
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the module to an output stream with an optional AssemblyAnnotationWriter.
Module.h This file contains the declarations for the Module class.
BasicBlockPass * createPrintBasicBlockPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that writes the BB to the specified raw_ostream.
bool isFunctionInPrintList(StringRef FunctionName)
isFunctionInPrintList - returns true if a function should be printed via
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool runOnBasicBlock(MachineBasicBlock *MBB, std::vector< StringRef > &bbNames, std::vector< unsigned > &renamedInOtherBB, unsigned &basicBlockNum, unsigned &VRegGapIndex, NamedVRegCursor &NVC)
void setPreservesAll()
Set by analyses that do not transform their input at all.
PreservedAnalyses run(Module &M, AnalysisManager< Module > &)
StringRef getName() const
Return a constant reference to the value's name.
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.
Module * getParent()
Get the module that this global value is contained inside of...
PreservedAnalyses run(Function &F, AnalysisManager< Function > &)
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
Pass for printing a Function as LLVM's text IR assembly.