summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-14 15:29:31 +0000
committerDan Gohman <gohman@apple.com>2010-05-14 15:29:31 +0000
commit89938ce0ad6a0c13104495e2a00d3cc745e34068 (patch)
tree45f0406919469fc4cd92a200bf7e4980cffc3ecb /include
parentbd616b69f7ab072a623b55a244bf61541eac5f32 (diff)
downloadllvm-89938ce0ad6a0c13104495e2a00d3cc745e34068.tar.gz
llvm-89938ce0ad6a0c13104495e2a00d3cc745e34068.tar.bz2
llvm-89938ce0ad6a0c13104495e2a00d3cc745e34068.tar.xz
Add an isNodeHidden to the graph traits, to support definition of
subgraph views. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103772 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/DOTGraphTraits.h6
-rw-r--r--include/llvm/Support/GraphWriter.h21
2 files changed, 24 insertions, 3 deletions
diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h
index ebbcf7c400..c16aa3a76d 100644
--- a/include/llvm/Support/DOTGraphTraits.h
+++ b/include/llvm/Support/DOTGraphTraits.h
@@ -59,6 +59,12 @@ public:
return false;
}
+ /// isNodeHidden - If thie function returns true, the given node is not
+ /// displayed in the graph.
+ static bool isNodeHidden(const void *Node) {
+ return false;
+ }
+
/// getNodeLabel - Given a node and a pointer to the top level graph, return
/// the label to print in the node.
template<typename GraphType>
diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h
index 13e6682ebf..559f0040c2 100644
--- a/include/llvm/Support/GraphWriter.h
+++ b/include/llvm/Support/GraphWriter.h
@@ -122,7 +122,20 @@ public:
// Loop over the graph, printing it out...
for (node_iterator I = GTraits::nodes_begin(G), E = GTraits::nodes_end(G);
I != E; ++I)
- writeNode(*I);
+ if (!isNodeHidden(*I))
+ writeNode(*I);
+ }
+
+ bool isNodeHidden(NodeType &Node) {
+ return isNodeHidden(&Node);
+ }
+
+ bool isNodeHidden(NodeType *const *Node) {
+ return isNodeHidden(*Node);
+ }
+
+ bool isNodeHidden(NodeType *Node) {
+ return DTraits.isNodeHidden(Node);
}
void writeNode(NodeType& Node) {
@@ -189,9 +202,11 @@ public:
child_iterator EI = GTraits::child_begin(Node);
child_iterator EE = GTraits::child_end(Node);
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i)
- writeEdge(Node, i, EI);
+ if (!DTraits.isNodeHidden(*EI))
+ writeEdge(Node, i, EI);
for (; EI != EE; ++EI)
- writeEdge(Node, 64, EI);
+ if (!DTraits.isNodeHidden(*EI))
+ writeEdge(Node, 64, EI);
}
void writeEdge(NodeType *Node, unsigned edgeidx, child_iterator EI) {