LLVM: lib/CodeGen/MachineFunctionPrinterPass.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
21
22using namespace llvm;
23
24namespace {
25
26
27
29 static char ID;
30
31 raw_ostream &OS;
32 const std::string Banner;
33
34 MachineFunctionPrinterPass() : MachineFunctionPass(ID), OS(dbgs()) { }
35 MachineFunctionPrinterPass(raw_ostream &os, const std::string &banner)
36 : MachineFunctionPass(ID), OS(os), Banner(banner) {}
37
38 StringRef getPassName() const override { return "MachineFunction Printer"; }
39
40 void getAnalysisUsage(AnalysisUsage &AU) const override {
44 }
45
46 bool runOnMachineFunction(MachineFunction &MF) override {
48 return false;
49 OS << "# " << Banner << ":\n";
50 auto *SIWrapper = getAnalysisIfAvailable();
51 MF.print(OS, SIWrapper ? &SIWrapper->getSI() : nullptr);
52 return false;
53 }
54};
55
56char MachineFunctionPrinterPass::ID = 0;
57}
58
60INITIALIZE_PASS(MachineFunctionPrinterPass, "machineinstr-printer",
61 "Machine Function Printer", false, false)
62
63
64
65
69 return new MachineFunctionPrinterPass(OS, Banner);
70}
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
AnalysisUsage & addUsedIfAvailable()
Add the specified Pass class to the set of analyses used by this pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isFunctionInPrintList(StringRef FunctionName)
LLVM_ABI MachineFunctionPass * createMachineFunctionPrinterPass(raw_ostream &OS, const std::string &Banner="")
MachineFunctionPrinter pass - This pass prints out the machine function to the given stream as a debu...
LLVM_ABI char & MachineFunctionPrinterPassID
MachineFunctionPrinterPass - This pass prints out MachineInstr's.
Definition MachineFunctionPrinterPass.cpp:59
Implement std::hash so that hash_code can be used in STL containers.