Make flag and chain edges visually distinguishable from value edges in DOT
authorChris Lattner <sabre@nondot.org>
Fri, 20 Oct 2006 18:06:09 +0000 (18:06 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 20 Oct 2006 18:06:09 +0000 (18:06 +0000)
output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31067 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index f68c227dc0ccfe7ef32f151b89f0c4d63120b67f..2c392d9d64d67cfb095e9fb088d4ca0e7cc4dbae 100644 (file)
@@ -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<typename EdgeIter>
+    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<SelectionDAG*>::getNodeLabel(const SDNode *Node,
       Op += LBB->getName();
     //Op += " " + (const void*)BBDN->getBasicBlock();
   } else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(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());