15 #ifndef LLVM_ANALYSIS_CFGPRINTER_H
16 #define LLVM_ANALYSIS_CFGPRINTER_H
31 return "CFG for '" + F->
getName().
str() +
"' function";
48 enum { MaxColumns = 80 };
58 std::string OutStr = OS.
str();
59 if (OutStr[0] ==
'\n') OutStr.erase(OutStr.begin());
63 unsigned LastSpace = 0;
64 for (
unsigned i = 0; i != OutStr.length(); ++i) {
65 if (OutStr[i] ==
'\n') {
67 OutStr.insert(OutStr.begin()+i+1,
'l');
70 }
else if (OutStr[i] ==
';') {
71 unsigned Idx = OutStr.find(
'\n', i+1);
72 OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx);
74 }
else if (ColNum == MaxColumns) {
78 OutStr.insert(LastSpace,
"\\l...");
79 ColNum = i - LastSpace;
94 return getSimpleNodeLabel(Node, Graph);
96 return getCompleteNodeLabel(Node, Graph);
103 if (BI->isConditional())
110 if (SuccNo == 0)
return "def";
ConstantIntTy * getCaseValue()
Resolves case value for current case.
DOTGraphTraits(bool isSimple=false)
static std::string getGraphName(const Function *F)
std::string str() const
str - Get the contents as an std::string.
static std::string getCompleteNodeLabel(const BasicBlock *Node, const Function *)
StringRef getName() const
Return a constant reference to the value's name.
std::string getNodeLabel(const BasicBlock *Node, const Function *Graph)
FunctionPass * createCFGPrinterPass()
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
LLVM Basic Block Representation.
BranchInst - Conditional or Unconditional Branch instruction.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Self fromSuccessorIndex(SwitchInstTy *SI, unsigned SuccessorIndex)
Initializes case iterator for given SwitchInst and for given TerminatorInst's successor index...
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
static std::string getSimpleNodeLabel(const BasicBlock *Node, const Function *)
unsigned getSuccessorIndex() const
getSuccessorIndex - This is used to interface between code that wants to operate on terminator instru...
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
FunctionPass * createCFGOnlyPrinterPass()
SwitchInst - Multiway switch.
A raw_ostream that writes to an std::string.
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
static std::string getEdgeSourceLabel(const BasicBlock *Node, succ_const_iterator I)
bool empty() const
empty - Check if the string is empty.