25 bool ShouldPreserveUseListOrder)
26 : OS(OS), Banner(Banner),
27 ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
33 M.
print(OS,
nullptr, ShouldPreserveUseListOrder);
44 : OS(OS), Banner(Banner) {}
52 OS << Banner << static_cast<Value &>(
F);
59 class PrintModulePassWrapper :
public ModulePass {
65 PrintModulePassWrapper(
raw_ostream &OS,
const std::string &Banner,
66 bool ShouldPreserveUseListOrder)
67 :
ModulePass(ID),
P(OS, Banner, ShouldPreserveUseListOrder) {}
69 bool runOnModule(
Module &M)
override {
79 StringRef getPassName()
const override {
return "Print Module IR"; }
88 PrintFunctionPassWrapper(
raw_ostream &OS,
const std::string &Banner)
102 StringRef getPassName()
const override {
return "Print Function IR"; }
112 PrintBasicBlockPass(
raw_ostream &Out,
const std::string &Banner)
124 StringRef getPassName()
const override {
return "Print BasicBlock IR"; }
131 "Print module to stderr",
false,
true)
134 "Print function to stderr",
false,
true)
141 bool ShouldPreserveUseListOrder) {
142 return new PrintModulePassWrapper(OS, Banner, ShouldPreserveUseListOrder);
146 const std::string &Banner) {
147 return new PrintFunctionPassWrapper(OS, Banner);
151 const std::string &Banner) {
152 return new PrintBasicBlockPass(OS, Banner);
156 const char *PID = (
const char*)P->
getPassID();
158 return (PID == &PrintModulePassWrapper::ID)
160 || (PID == &PrintBasicBlockPass::ID);
Pass interface - Implemented by all 'passes'.
bool forcePrintModuleIR()
forcePrintModuleIR - returns true if IR printing passes should
This class represents lattice values for constants.
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.