[llvm-commits] [llvm] r90134 - in /llvm/trunk: include/llvm/Analysis/CFGPrinter.h include/llvm/Support/DOTGraphTraits.h include/llvm/Support/GraphWriter.h lib/Analysis/DomPrinter.cpp lib/CodeGen/MachineFunction.cpp lib/CodeGen/ScheduleDAGPrinter.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp tools/opt/GraphPrinters.cpp
Tobias Grosser
grosser at fim.uni-passau.de
Mon Nov 30 04:38:47 PST 2009
Author: grosser
Date: Mon Nov 30 06:38:47 2009
New Revision: 90134
URL: http://llvm.org/viewvc/llvm-project?rev=90134&view=rev
Log:
Remove ShortNames from getNodeLabel in DOTGraphTraits
Modified:
llvm/trunk/include/llvm/Analysis/CFGPrinter.h
llvm/trunk/include/llvm/Support/DOTGraphTraits.h
llvm/trunk/include/llvm/Support/GraphWriter.h
llvm/trunk/lib/Analysis/DomPrinter.cpp
llvm/trunk/lib/CodeGen/MachineFunction.cpp
llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
llvm/trunk/tools/opt/GraphPrinters.cpp
Modified: llvm/trunk/include/llvm/Analysis/CFGPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFGPrinter.h?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFGPrinter.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFGPrinter.h Mon Nov 30 06:38:47 2009
@@ -31,19 +31,22 @@
return "CFG for '" + F->getNameStr() + "' function";
}
- static std::string getNodeLabel(const BasicBlock *Node,
- const Function *Graph,
- bool ShortNames) {
- if (ShortNames && !Node->getName().empty())
+ static std::string getSimpleNodeLabel(const BasicBlock *Node,
+ const Function *Graph) {
+ if (!Node->getName().empty())
return Node->getNameStr();
std::string Str;
raw_string_ostream OS(Str);
- if (ShortNames) {
- WriteAsOperand(OS, Node, false);
- return OS.str();
- }
+ WriteAsOperand(OS, Node, false);
+ return OS.str();
+ }
+
+ static std::string getCompleteNodeLabel(const BasicBlock *Node,
+ const Function *Graph) {
+ std::string Str;
+ raw_string_ostream OS(Str);
if (Node->getName().empty()) {
WriteAsOperand(OS, Node, false);
@@ -68,6 +71,14 @@
return OutStr;
}
+ std::string getNodeLabel(const BasicBlock *Node,
+ const Function *Graph) {
+ if (isSimple())
+ return getSimpleNodeLabel(Node, Graph);
+ else
+ return getCompleteNodeLabel(Node, Graph);
+ }
+
static std::string getEdgeSourceLabel(const BasicBlock *Node,
succ_const_iterator I) {
// Label source of conditional branches with "T" or "F"
Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DOTGraphTraits.h?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DOTGraphTraits.h (original)
+++ llvm/trunk/include/llvm/Support/DOTGraphTraits.h Mon Nov 30 06:38:47 2009
@@ -62,8 +62,7 @@
/// getNodeLabel - Given a node and a pointer to the top level graph, return
/// the label to print in the node.
template<typename GraphType>
- static std::string getNodeLabel(const void *Node,
- const GraphType& Graph, bool ShortNames) {
+ std::string getNodeLabel(const void *Node, const GraphType& Graph) {
return "";
}
Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Nov 30 06:38:47 2009
@@ -52,7 +52,6 @@
class GraphWriter {
raw_ostream &O;
const GraphType &G;
- bool ShortNames;
typedef DOTGraphTraits<GraphType> DOTTraits;
typedef GraphTraits<GraphType> GTraits;
@@ -89,8 +88,7 @@
}
public:
- GraphWriter(raw_ostream &o, const GraphType &g, bool SN) :
- O(o), G(g), ShortNames(SN) {
+ GraphWriter(raw_ostream &o, const GraphType &g, bool SN) : O(o), G(g) {
DTraits = DOTTraits(SN);
}
@@ -143,7 +141,7 @@
O << "label=\"{";
if (!DTraits.renderGraphFromBottomUp()) {
- O << DOT::EscapeString(DTraits.getNodeLabel(Node, G, ShortNames));
+ O << DOT::EscapeString(DTraits.getNodeLabel(Node, G));
// If we should include the address of the node in the label, do so now.
if (DTraits.hasNodeAddressLabel(Node, G))
@@ -163,7 +161,7 @@
}
if (DTraits.renderGraphFromBottomUp()) {
- O << DOT::EscapeString(DTraits.getNodeLabel(Node, G, ShortNames));
+ O << DOT::EscapeString(DTraits.getNodeLabel(Node, G));
// If we should include the address of the node in the label, do so now.
if (DTraits.hasNodeAddressLabel(Node, G))
Modified: llvm/trunk/lib/Analysis/DomPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DomPrinter.cpp?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DomPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/DomPrinter.cpp Mon Nov 30 06:38:47 2009
@@ -31,18 +31,23 @@
template<>
struct DOTGraphTraits<DomTreeNode*> : public DefaultDOTGraphTraits {
- DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
+ DOTGraphTraits (bool isSimple=false)
+ : DefaultDOTGraphTraits(isSimple) {}
- static std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph,
- bool ShortNames) {
+ std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph) {
BasicBlock *BB = Node->getBlock();
if (!BB)
return "Post dominance root node";
- return DOTGraphTraits<const Function*>::getNodeLabel(BB, BB->getParent(),
- ShortNames);
+
+ if (isSimple())
+ return DOTGraphTraits<const Function*>
+ ::getSimpleNodeLabel(BB, BB->getParent());
+ else
+ return DOTGraphTraits<const Function*>
+ ::getCompleteNodeLabel(BB, BB->getParent());
}
};
@@ -56,11 +61,8 @@
return "Dominator tree";
}
- static std::string getNodeLabel(DomTreeNode *Node,
- DominatorTree *G,
- bool ShortNames) {
- return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode(),
- ShortNames);
+ std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G) {
+ return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
}
};
@@ -74,12 +76,9 @@
static std::string getGraphName(PostDominatorTree *DT) {
return "Post dominator tree";
}
- static std::string getNodeLabel(DomTreeNode *Node,
- PostDominatorTree *G,
- bool ShortNames) {
- return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node,
- G->getRootNode(),
- ShortNames);
+
+ std::string getNodeLabel(DomTreeNode *Node, PostDominatorTree *G ) {
+ return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
}
};
}
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Nov 30 06:38:47 2009
@@ -366,10 +366,9 @@
return "CFG for '" + F->getFunction()->getNameStr() + "' function";
}
- static std::string getNodeLabel(const MachineBasicBlock *Node,
- const MachineFunction *Graph,
- bool ShortNames) {
- if (ShortNames && Node->getBasicBlock() &&
+ std::string getNodeLabel(const MachineBasicBlock *Node,
+ const MachineFunction *Graph) {
+ if (isSimple () && Node->getBasicBlock() &&
!Node->getBasicBlock()->getName().empty())
return Node->getBasicBlock()->getNameStr() + ":";
@@ -377,7 +376,7 @@
{
raw_string_ostream OSS(OutStr);
- if (ShortNames)
+ if (isSimple())
OSS << Node->getNumber() << ':';
else
Node->print(OSS);
Modified: llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScheduleDAGPrinter.cpp Mon Nov 30 06:38:47 2009
@@ -60,9 +60,7 @@
}
- static std::string getNodeLabel(const SUnit *Node,
- const ScheduleDAG *Graph,
- bool ShortNames);
+ std::string getNodeLabel(const SUnit *Node, const ScheduleDAG *Graph);
static std::string getNodeAttributes(const SUnit *N,
const ScheduleDAG *Graph) {
return "shape=Mrecord";
@@ -76,8 +74,7 @@
}
std::string DOTGraphTraits<ScheduleDAG*>::getNodeLabel(const SUnit *SU,
- const ScheduleDAG *G,
- bool ShortNames) {
+ const ScheduleDAG *G) {
return G->getGraphNodeLabel(SU);
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Nov 30 06:38:47 2009
@@ -96,9 +96,16 @@
}
- static std::string getNodeLabel(const SDNode *Node,
- const SelectionDAG *Graph,
- bool ShortNames);
+ static std::string getSimpleNodeLabel(const SDNode *Node,
+ const SelectionDAG *G) {
+ std::string Result = Node->getOperationName(G);
+ {
+ raw_string_ostream OS(Result);
+ Node->print_details(OS, G);
+ }
+ return Result;
+ }
+ std::string getNodeLabel(const SDNode *Node, const SelectionDAG *Graph);
static std::string getNodeAttributes(const SDNode *N,
const SelectionDAG *Graph) {
#ifndef NDEBUG
@@ -124,14 +131,8 @@
}
std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
- const SelectionDAG *G,
- bool ShortNames) {
- std::string Result = Node->getOperationName(G);
- {
- raw_string_ostream OS(Result);
- Node->print_details(OS, G);
- }
- return Result;
+ const SelectionDAG *G) {
+ DOTGraphTraits<SelectionDAG*>::getSimpleNodeLabel (Node, G);
}
@@ -272,8 +273,8 @@
for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
FlaggedNodes.push_back(N);
while (!FlaggedNodes.empty()) {
- O << DOTGraphTraits<SelectionDAG*>::getNodeLabel(FlaggedNodes.back(),
- DAG, false);
+ O << DOTGraphTraits<SelectionDAG*>
+ ::getSimpleNodeLabel(FlaggedNodes.back(), DAG);
FlaggedNodes.pop_back();
if (!FlaggedNodes.empty())
O << "\n ";
Modified: llvm/trunk/tools/opt/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/GraphPrinters.cpp?rev=90134&r1=90133&r2=90134&view=diff
==============================================================================
--- llvm/trunk/tools/opt/GraphPrinters.cpp (original)
+++ llvm/trunk/tools/opt/GraphPrinters.cpp Mon Nov 30 06:38:47 2009
@@ -53,8 +53,7 @@
return "Call Graph";
}
- static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph,
- bool ShortNames) {
+ static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) {
if (Node->getFunction())
return ((Value*)Node->getFunction())->getName();
else
More information about the llvm-commits
mailing list