diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2009-11-30 12:38:47 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2009-11-30 12:38:47 +0000 |
commit | 56f4ef3232850e29c4635d0923910acce8887bd0 (patch) | |
tree | 904086d0665c9d480a8f0f3b1da2d78330406567 /include/llvm | |
parent | a10d598602308549d87d2c5d9848f5a72fda2b43 (diff) | |
download | external_llvm-56f4ef3232850e29c4635d0923910acce8887bd0.zip external_llvm-56f4ef3232850e29c4635d0923910acce8887bd0.tar.gz external_llvm-56f4ef3232850e29c4635d0923910acce8887bd0.tar.bz2 |
Remove ShortNames from getNodeLabel in DOTGraphTraits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/CFGPrinter.h | 27 | ||||
-rw-r--r-- | include/llvm/Support/DOTGraphTraits.h | 3 | ||||
-rw-r--r-- | include/llvm/Support/GraphWriter.h | 8 |
3 files changed, 23 insertions, 15 deletions
diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index 47b1a5c..6ad2e5a 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -31,19 +31,22 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { 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 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { 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" diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h index 0e8f59b..54ced15 100644 --- a/include/llvm/Support/DOTGraphTraits.h +++ b/include/llvm/Support/DOTGraphTraits.h @@ -62,8 +62,7 @@ public: /// 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 ""; } diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 185400b..d48dc78 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -52,7 +52,6 @@ template<typename GraphType> class GraphWriter { raw_ostream &O; const GraphType &G; - bool ShortNames; typedef DOTGraphTraits<GraphType> DOTTraits; typedef GraphTraits<GraphType> GTraits; @@ -89,8 +88,7 @@ class GraphWriter { } 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 @@ public: 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 @@ public: } 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)) |