diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-21 21:06:55 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-21 21:06:55 +0000 |
commit | 358033102ffaef4d1afb1c0b7e96440906f0b48f (patch) | |
tree | 14fa1a4a6ca923476c8165cbdc22e85c8a91a243 /lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | |
parent | 2dbc167294c1a7a4cd7a43f86bff104afd6110e5 (diff) | |
download | llvm-358033102ffaef4d1afb1c0b7e96440906f0b48f.tar.gz llvm-358033102ffaef4d1afb1c0b7e96440906f0b48f.tar.bz2 llvm-358033102ffaef4d1afb1c0b7e96440906f0b48f.tar.xz |
Enhance the GraphWriter support for edge destinations, and teach the
SelectionDAG graph writer to make use of them. Now, nodes with multiple
values are displayed as such, with incoming edges pointing to the
specific value they use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index ea93d11f6d..184c50e903 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -32,6 +32,37 @@ using namespace llvm; namespace llvm { template<> struct DOTGraphTraits<SelectionDAG*> : public DefaultDOTGraphTraits { + static bool hasEdgeDestLabels() { + return true; + } + + static unsigned numEdgeDestLabels(const void *Node) { + return ((const SDNode *) Node)->getNumValues(); + } + + static std::string getEdgeDestLabel(const void *Node, unsigned i) { + return ((const SDNode *) Node)->getValueType(i).getMVTString(); + } + + /// edgeTargetsEdgeSource - This method returns true if this outgoing edge + /// should actually target another edge source, not a node. If this method is + /// implemented, getEdgeTarget should be implemented. + template<typename EdgeIter> + static bool edgeTargetsEdgeSource(const void *Node, EdgeIter I) { + return true; + } + + /// getEdgeTarget - If edgeTargetsEdgeSource returns true, this method is + /// called to determine which outgoing edge of Node is the target of this + /// edge. + template<typename EdgeIter> + static EdgeIter getEdgeTarget(const void *Node, EdgeIter I) { + SDNode *TargetNode = *I; + SDNodeIterator NI = SDNodeIterator::begin(TargetNode); + std::advance(NI, I.getNode()->getOperand(I.getOperand()).ResNo); + return NI; + } + static std::string getGraphName(const SelectionDAG *G) { return G->getMachineFunction().getFunction()->getName(); } @@ -88,12 +119,6 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node, const SelectionDAG *G) { std::string Op = Node->getOperationName(G); - for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) - if (Node->getValueType(i) == MVT::Other) - Op += ":ch"; - else - Op = Op + ":" + Node->getValueType(i).getMVTString(); - if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(Node)) { Op += ": " + utostr(CSDN->getValue()); } else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(Node)) { |