mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
- Generic graph printing infrastructure changes:
* Only print outgoing edges from a cell if the destination isn't null. This is important for DSGraphs, which have sources with no edges. * Allow Node attributes to override shape of the node git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d6d8f41699
commit
63a32de776
@ -69,9 +69,9 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) {
|
|||||||
|
|
||||||
std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);
|
std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);
|
||||||
|
|
||||||
O << "\tNode" << (void*)Node << " [";
|
O << "\tNode" << (void*)Node << " [shape=record,";
|
||||||
if (!NodeAttributes.empty()) O << NodeAttributes << ",";
|
if (!NodeAttributes.empty()) O << NodeAttributes << ",";
|
||||||
O << "shape=record,label=\"{"
|
O << "label=\"{"
|
||||||
<< DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
<< DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||||
|
|
||||||
// Print out the fields of the current node...
|
// Print out the fields of the current node...
|
||||||
@ -94,23 +94,24 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) {
|
|||||||
// Output all of the edges now
|
// Output all of the edges now
|
||||||
EI = GTraits::child_begin(Node);
|
EI = GTraits::child_begin(Node);
|
||||||
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) {
|
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) {
|
||||||
NodeType *TargetNode = *EI;
|
if (NodeType *TargetNode = *EI) {
|
||||||
O << "\tNode" << (void*)Node << ":g" << i << " -> Node"
|
O << "\tNode" << (void*)Node << ":g" << i << " -> Node"
|
||||||
<< (void*)TargetNode;
|
<< (void*)TargetNode;
|
||||||
if (DOTTraits::edgeTargetsEdgeSource(Node, EI)) {
|
if (DOTTraits::edgeTargetsEdgeSource(Node, EI)) {
|
||||||
typename GTraits::ChildIteratorType TargetIt =
|
typename GTraits::ChildIteratorType TargetIt =
|
||||||
DOTTraits::getEdgeTarget(Node, EI);
|
DOTTraits::getEdgeTarget(Node, EI);
|
||||||
// Figure out which edge this targets...
|
// Figure out which edge this targets...
|
||||||
unsigned Offset = std::distance(GTraits::child_begin(TargetNode),
|
unsigned Offset = std::distance(GTraits::child_begin(TargetNode),
|
||||||
TargetIt);
|
TargetIt);
|
||||||
if (Offset > 64) Offset = 64; // Targetting the trancated part?
|
if (Offset > 64) Offset = 64; // Targetting the trancated part?
|
||||||
O << ":g" << Offset;
|
O << ":g" << Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EdgeAttributes = DOTTraits::getEdgeAttributes(Node, EI);
|
std::string EdgeAttributes = DOTTraits::getEdgeAttributes(Node, EI);
|
||||||
if (!EdgeAttributes.empty())
|
if (!EdgeAttributes.empty())
|
||||||
O << "[" << EdgeAttributes << "]";
|
O << "[" << EdgeAttributes << "]";
|
||||||
O << ";\n";
|
O << ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) {
|
|||||||
|
|
||||||
std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);
|
std::string NodeAttributes = DOTTraits::getNodeAttributes(Node);
|
||||||
|
|
||||||
O << "\tNode" << (void*)Node << " [";
|
O << "\tNode" << (void*)Node << " [shape=record,";
|
||||||
if (!NodeAttributes.empty()) O << NodeAttributes << ",";
|
if (!NodeAttributes.empty()) O << NodeAttributes << ",";
|
||||||
O << "shape=record,label=\"{"
|
O << "label=\"{"
|
||||||
<< DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
<< DOT::EscapeString(DOTTraits::getNodeLabel(Node, G));
|
||||||
|
|
||||||
// Print out the fields of the current node...
|
// Print out the fields of the current node...
|
||||||
@ -94,23 +94,24 @@ std::ostream &WriteGraph(std::ostream &O, const GraphType &G) {
|
|||||||
// Output all of the edges now
|
// Output all of the edges now
|
||||||
EI = GTraits::child_begin(Node);
|
EI = GTraits::child_begin(Node);
|
||||||
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) {
|
for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) {
|
||||||
NodeType *TargetNode = *EI;
|
if (NodeType *TargetNode = *EI) {
|
||||||
O << "\tNode" << (void*)Node << ":g" << i << " -> Node"
|
O << "\tNode" << (void*)Node << ":g" << i << " -> Node"
|
||||||
<< (void*)TargetNode;
|
<< (void*)TargetNode;
|
||||||
if (DOTTraits::edgeTargetsEdgeSource(Node, EI)) {
|
if (DOTTraits::edgeTargetsEdgeSource(Node, EI)) {
|
||||||
typename GTraits::ChildIteratorType TargetIt =
|
typename GTraits::ChildIteratorType TargetIt =
|
||||||
DOTTraits::getEdgeTarget(Node, EI);
|
DOTTraits::getEdgeTarget(Node, EI);
|
||||||
// Figure out which edge this targets...
|
// Figure out which edge this targets...
|
||||||
unsigned Offset = std::distance(GTraits::child_begin(TargetNode),
|
unsigned Offset = std::distance(GTraits::child_begin(TargetNode),
|
||||||
TargetIt);
|
TargetIt);
|
||||||
if (Offset > 64) Offset = 64; // Targetting the trancated part?
|
if (Offset > 64) Offset = 64; // Targetting the trancated part?
|
||||||
O << ":g" << Offset;
|
O << ":g" << Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EdgeAttributes = DOTTraits::getEdgeAttributes(Node, EI);
|
std::string EdgeAttributes = DOTTraits::getEdgeAttributes(Node, EI);
|
||||||
if (!EdgeAttributes.empty())
|
if (!EdgeAttributes.empty())
|
||||||
O << "[" << EdgeAttributes << "]";
|
O << "[" << EdgeAttributes << "]";
|
||||||
O << ";\n";
|
O << ";\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user