27 "write-experimental-debuginfo",
28 cl::desc(
"Write debug info in the new non-intrinsic format. Has no effect "
29 "if --preserve-input-debuginfo-format=true."),
34class PrintModulePassWrapper :
public ModulePass {
37 bool ShouldPreserveUseListOrder;
42 PrintModulePassWrapper(
raw_ostream &OS,
const std::string &Banner,
43 bool ShouldPreserveUseListOrder)
45 ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {}
55 M.removeDebugIntrinsicDeclarations();
60 M.print(OS,
nullptr, ShouldPreserveUseListOrder);
62 bool BannerPrinted =
false;
63 for (
const auto &
F :
M.functions()) {
65 if (!BannerPrinted && !Banner.empty()) {
91 PrintFunctionPassWrapper(
raw_ostream &OS,
const std::string &Banner)
102 OS << Banner <<
" (function: " <<
F.getName() <<
")\n"
105 OS << Banner << '\n' << static_cast<Value &>(
F);
120char PrintModulePassWrapper::ID = 0;
122 "Print module to stderr",
false,
true)
123char PrintFunctionPassWrapper::
ID = 0;
129 bool ShouldPreserveUseListOrder) {
130 return new PrintModulePassWrapper(
OS, Banner, ShouldPreserveUseListOrder);
134 const std::string &Banner) {
135 return new PrintFunctionPassWrapper(
OS, Banner);
139 const char *PID = (
const char *)
P->getPassID();
141 return (PID == &PrintModulePassWrapper::ID) ||
142 (PID == &PrintFunctionPassWrapper::ID);
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Performs the initial survey of the specified function
cl::opt< bool > WriteNewDbgInfoFormat("write-experimental-debuginfo", cl::desc("Write debug info in the new non-intrinsic format. Has no effect " "if --preserve-input-debuginfo-format=true."), cl::init(true))
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
Pass interface - Implemented by all 'passes'.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
bool forcePrintModuleIR()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isFunctionInPrintList(StringRef FunctionName)
bool isIRPrintingPass(Pass *P)
Return true if a pass is for IR printing.
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.
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.
Implement std::hash so that hash_code can be used in STL containers.