25 bool ShouldPreserveUseListOrder)
26 : OS(OS), Banner(Banner),
27 ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
33 M.
print(OS,
nullptr, ShouldPreserveUseListOrder);
36 bool BannerPrinted =
false;
39 if (!BannerPrinted && !Banner.empty()) {
52 : OS(OS), Banner(Banner) {}
60 OS << Banner << '\n' << static_cast<Value &>(
F);
67 class PrintModulePassWrapper :
public ModulePass {
73 PrintModulePassWrapper(
raw_ostream &OS,
const std::string &Banner,
74 bool ShouldPreserveUseListOrder)
75 :
ModulePass(ID),
P(OS, Banner, ShouldPreserveUseListOrder) {}
77 bool runOnModule(
Module &M)
override {
87 StringRef getPassName()
const override {
return "Print Module IR"; }
96 PrintFunctionPassWrapper(
raw_ostream &OS,
const std::string &Banner)
110 StringRef getPassName()
const override {
return "Print Function IR"; }
117 "Print module to stderr",
false,
true)
120 "Print function to stderr",
false,
true)
124 bool ShouldPreserveUseListOrder) {
125 return new PrintModulePassWrapper(OS, Banner, ShouldPreserveUseListOrder);
129 const std::string &Banner) {
130 return new PrintFunctionPassWrapper(OS, Banner);
134 const char *PID = (
const char*)P->
getPassID();
136 return (PID == &PrintModulePassWrapper::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...
INITIALIZE_PASS(PrintModulePassWrapper, "print-module", "Print module to stderr", false, true) char PrintFunctionPassWrapper INITIALIZE_PASS(PrintFunctionPassWrapper, "print-function", "Print function to stderr", false, true) ModulePass *llvm
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()
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.
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.
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.
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.