LLVM: lib/CodeGen/MachineCFGPrinter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
22
23using namespace llvm;
24
25#define DEBUG_TYPE "dot-machine-cfg"
26
29 cl::desc("The name of a function (or its substring)"
30 " whose CFG is viewed/printed."));
31
33 "mcfg-dot-filename-prefix", cl::Hidden,
34 cl::desc("The prefix used for the Machine CFG dot file names."));
35
38 cl::desc("Print only the CFG without blocks body"));
39
41 std::string Filename =
43 errs() << "Writing '" << Filename << "'...";
44
45 std::error_code EC;
47
49
50 if (!EC)
52 else
53 errs() << " error opening file for writing!";
54 errs() << '\n';
55}
56
57namespace {
58
60public:
61 static char ID;
62
63 MachineCFGPrinter();
64
65 bool runOnMachineFunction(MachineFunction &MF) override;
66
67 void getAnalysisUsage(AnalysisUsage &AU) const override {
70 }
71};
72
73}
74
75char MachineCFGPrinter::ID = 0;
76
78
80 false, true)
81
82
85}
86
87bool MachineCFGPrinter::runOnMachineFunction(MachineFunction &MF) {
89 return false;
90 errs() << "Writing Machine CFG for function ";
92
94 return false;
95}
static cl::opt< std::string > MCFGDotFilenamePrefix("mcfg-dot-filename-prefix", cl::Hidden, cl::desc("The prefix used for the Machine CFG dot file names."))
static void writeMCFGToDotFile(MachineFunction &MF)
Definition MachineCFGPrinter.cpp:40
static cl::opt< std::string > MCFGFuncName("mcfg-func-name", cl::Hidden, cl::desc("The name of a function (or its substring)" " whose CFG is viewed/printed."))
static cl::opt< bool > CFGOnly("dot-mcfg-only", cl::init(false), cl::Hidden, cl::desc("Print only the CFG without blocks body"))
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
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.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
A raw_ostream that writes to a file descriptor.
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '\t', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an esca...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
@ OF_Text
The file should be opened in text mode on platforms like z/OS that make this distinction.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI char & MachineCFGPrinterID
MachineCFGPrinter pass.
Definition MachineCFGPrinter.cpp:77
raw_ostream & WriteGraph(raw_ostream &O, const GraphType &G, bool ShortNames=false, const Twine &Title="")
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ABI void initializeMachineCFGPrinterPass(PassRegistry &)