From 34ab4d45d2aa11bee666836e3571be2627959a42 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 20 Oct 2006 18:06:09 +0000 Subject: [PATCH] Make flag and chain edges visually distinguishable from value edges in DOT output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31067 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../SelectionDAG/SelectionDAGPrinter.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index f68c227dc0c..2c392d9d64d 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -41,6 +41,20 @@ namespace llvm { const SelectionDAG *Graph) { return true; } + + /// If you want to override the dot attributes printed for a particular + /// edge, override this method. + template + static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { + SDOperand Op = EI.getNode()->getOperand(EI.getOperand()); + MVT::ValueType VT = Op.getValueType(); + if (VT == MVT::Flag) + return "color=red,style=bold"; + else if (VT == MVT::Other) + return "style=dashed"; + return ""; + } + static std::string getNodeLabel(const SDNode *Node, const SelectionDAG *Graph); @@ -114,7 +128,8 @@ std::string DOTGraphTraits::getNodeLabel(const SDNode *Node, Op += LBB->getName(); //Op += " " + (const void*)BBDN->getBasicBlock(); } else if (const RegisterSDNode *R = dyn_cast(Node)) { - if (G && R->getReg() != 0 && MRegisterInfo::isPhysicalRegister(R->getReg())) { + if (G && R->getReg() != 0 && + MRegisterInfo::isPhysicalRegister(R->getReg())) { Op = Op + " " + G->getTarget().getRegisterInfo()->getName(R->getReg()); } else { Op += " #" + utostr(R->getReg());