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
This commit is contained in:
Dan Gohman 2010-05-14 15:29:31 +00:00
parent bd616b69f7
commit 89938ce0ad
2 changed files with 24 additions and 3 deletions

View File

@ -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>

View File

@ -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) {