Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 1 | //===-- SelectionDAGPrinter.cpp - Implement SelectionDAG::viewGraph() -----===// |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 2 | // |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This implements the SelectionDAG::viewGraph method. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | 5839bf2 | 2005-08-26 17:15:30 +0000 | [diff] [blame] | 14 | #include "llvm/Constants.h" |
| 15 | #include "llvm/Function.h" |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 16 | #include "llvm/Assembly/Writer.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/SelectionDAG.h" |
Dan Gohman | 3e1a7ae | 2007-08-28 20:32:58 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/ScheduleDAG.h" |
Evan Cheng | d6594ae | 2006-09-12 21:00:35 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineConstantPool.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/MachineFunction.h" |
Chris Lattner | 7228aa7 | 2005-08-19 21:21:16 +0000 | [diff] [blame] | 21 | #include "llvm/Target/MRegisterInfo.h" |
| 22 | #include "llvm/Target/TargetMachine.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 23 | #include "llvm/Support/GraphWriter.h" |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 24 | #include "llvm/ADT/StringExtras.h" |
Chris Lattner | 6e741f8 | 2005-07-15 22:48:31 +0000 | [diff] [blame] | 25 | #include "llvm/Config/config.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 26 | #include <fstream> |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 27 | #include <sstream> |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 28 | using namespace llvm; |
| 29 | |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 30 | namespace llvm { |
| 31 | template<> |
| 32 | struct DOTGraphTraits<SelectionDAG*> : public DefaultDOTGraphTraits { |
| 33 | static std::string getGraphName(const SelectionDAG *G) { |
| 34 | return G->getMachineFunction().getFunction()->getName(); |
| 35 | } |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 36 | |
| 37 | static bool renderGraphFromBottomUp() { |
| 38 | return true; |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 39 | } |
Chris Lattner | 37345fe | 2005-10-01 00:17:07 +0000 | [diff] [blame] | 40 | |
| 41 | static bool hasNodeAddressLabel(const SDNode *Node, |
| 42 | const SelectionDAG *Graph) { |
| 43 | return true; |
| 44 | } |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 45 | |
| 46 | /// If you want to override the dot attributes printed for a particular |
| 47 | /// edge, override this method. |
| 48 | template<typename EdgeIter> |
| 49 | static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { |
| 50 | SDOperand Op = EI.getNode()->getOperand(EI.getOperand()); |
| 51 | MVT::ValueType VT = Op.getValueType(); |
| 52 | if (VT == MVT::Flag) |
| 53 | return "color=red,style=bold"; |
| 54 | else if (VT == MVT::Other) |
Dan Gohman | 7a0a4fc | 2007-06-18 15:30:16 +0000 | [diff] [blame] | 55 | return "color=blue,style=dashed"; |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 56 | return ""; |
| 57 | } |
| 58 | |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 59 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 60 | static std::string getNodeLabel(const SDNode *Node, |
| 61 | const SelectionDAG *Graph); |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 62 | static std::string getNodeAttributes(const SDNode *N, |
| 63 | const SelectionDAG *Graph) { |
| 64 | #ifndef NDEBUG |
| 65 | const std::string &Attrs = Graph->getGraphAttrs(N); |
| 66 | if (!Attrs.empty()) { |
| 67 | if (Attrs.find("shape=") == std::string::npos) |
| 68 | return std::string("shape=Mrecord,") + Attrs; |
| 69 | else |
| 70 | return Attrs; |
| 71 | } |
| 72 | #endif |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 73 | return "shape=Mrecord"; |
| 74 | } |
Chris Lattner | fc08d9c | 2005-01-10 23:52:04 +0000 | [diff] [blame] | 75 | |
| 76 | static void addCustomGraphFeatures(SelectionDAG *G, |
| 77 | GraphWriter<SelectionDAG*> &GW) { |
| 78 | GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); |
Jim Laskey | 26f7fa7 | 2006-10-17 19:33:52 +0000 | [diff] [blame] | 79 | if (G->getRoot().Val) |
| 80 | GW.emitEdge(0, -1, G->getRoot().Val, -1, ""); |
Chris Lattner | fc08d9c | 2005-01-10 23:52:04 +0000 | [diff] [blame] | 81 | } |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 82 | }; |
| 83 | } |
| 84 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 85 | std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node, |
| 86 | const SelectionDAG *G) { |
Chris Lattner | ad95d6a | 2005-08-16 18:31:23 +0000 | [diff] [blame] | 87 | std::string Op = Node->getOperationName(G); |
Chris Lattner | c871e1d | 2005-01-11 22:21:04 +0000 | [diff] [blame] | 88 | |
Chris Lattner | ad95d6a | 2005-08-16 18:31:23 +0000 | [diff] [blame] | 89 | for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) |
| 90 | if (Node->getValueType(i) == MVT::Other) |
| 91 | Op += ":ch"; |
| 92 | else |
| 93 | Op = Op + ":" + MVT::getValueTypeString(Node->getValueType(i)); |
| 94 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 95 | if (const ConstantSDNode *CSDN = dyn_cast<ConstantSDNode>(Node)) { |
| 96 | Op += ": " + utostr(CSDN->getValue()); |
| 97 | } else if (const ConstantFPSDNode *CSDN = dyn_cast<ConstantFPSDNode>(Node)) { |
Dale Johannesen | eaf0894 | 2007-08-31 04:03:46 +0000 | [diff] [blame^] | 98 | Op += ": " + ftostr(CSDN->getValueAPF()); |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 99 | } else if (const GlobalAddressSDNode *GADN = |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 100 | dyn_cast<GlobalAddressSDNode>(Node)) { |
Evan Cheng | 61ca74b | 2005-11-30 02:04:11 +0000 | [diff] [blame] | 101 | int offset = GADN->getOffset(); |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 102 | Op += ": " + GADN->getGlobal()->getName(); |
Evan Cheng | 61ca74b | 2005-11-30 02:04:11 +0000 | [diff] [blame] | 103 | if (offset > 0) |
| 104 | Op += "+" + itostr(offset); |
| 105 | else |
| 106 | Op += itostr(offset); |
Misha Brukman | dedf2bd | 2005-04-22 04:01:18 +0000 | [diff] [blame] | 107 | } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) { |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 108 | Op += " " + itostr(FIDN->getIndex()); |
Evan Cheng | 6cc31ae | 2006-11-01 04:48:30 +0000 | [diff] [blame] | 109 | } else if (const JumpTableSDNode *JTDN = dyn_cast<JumpTableSDNode>(Node)) { |
| 110 | Op += " " + itostr(JTDN->getIndex()); |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 111 | } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){ |
Evan Cheng | d6594ae | 2006-09-12 21:00:35 +0000 | [diff] [blame] | 112 | if (CP->isMachineConstantPoolEntry()) { |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 113 | std::ostringstream SS; |
Evan Cheng | d6594ae | 2006-09-12 21:00:35 +0000 | [diff] [blame] | 114 | CP->getMachineCPVal()->print(SS); |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 115 | Op += "<" + SS.str() + ">"; |
Evan Cheng | d6594ae | 2006-09-12 21:00:35 +0000 | [diff] [blame] | 116 | } else { |
| 117 | if (ConstantFP *CFP = dyn_cast<ConstantFP>(CP->getConstVal())) |
Dale Johannesen | eaf0894 | 2007-08-31 04:03:46 +0000 | [diff] [blame^] | 118 | Op += "<" + ftostr(CFP->getValueAPF()) + ">"; |
Evan Cheng | d6594ae | 2006-09-12 21:00:35 +0000 | [diff] [blame] | 119 | else if (ConstantInt *CI = dyn_cast<ConstantInt>(CP->getConstVal())) |
| 120 | Op += "<" + utostr(CI->getZExtValue()) + ">"; |
| 121 | else { |
| 122 | std::ostringstream SS; |
| 123 | WriteAsOperand(SS, CP->getConstVal(), false); |
| 124 | Op += "<" + SS.str() + ">"; |
| 125 | } |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 126 | } |
Misha Brukman | dedf2bd | 2005-04-22 04:01:18 +0000 | [diff] [blame] | 127 | } else if (const BasicBlockSDNode *BBDN = dyn_cast<BasicBlockSDNode>(Node)) { |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 128 | Op = "BB: "; |
| 129 | const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock(); |
| 130 | if (LBB) |
| 131 | Op += LBB->getName(); |
| 132 | //Op += " " + (const void*)BBDN->getBasicBlock(); |
Chris Lattner | d5d0f9b | 2005-08-16 21:55:35 +0000 | [diff] [blame] | 133 | } else if (const RegisterSDNode *R = dyn_cast<RegisterSDNode>(Node)) { |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 134 | if (G && R->getReg() != 0 && |
| 135 | MRegisterInfo::isPhysicalRegister(R->getReg())) { |
Chris Lattner | 7228aa7 | 2005-08-19 21:21:16 +0000 | [diff] [blame] | 136 | Op = Op + " " + G->getTarget().getRegisterInfo()->getName(R->getReg()); |
| 137 | } else { |
| 138 | Op += " #" + utostr(R->getReg()); |
| 139 | } |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 140 | } else if (const ExternalSymbolSDNode *ES = |
| 141 | dyn_cast<ExternalSymbolSDNode>(Node)) { |
| 142 | Op += "'" + std::string(ES->getSymbol()) + "'"; |
Chris Lattner | 2bf3c26 | 2005-05-09 04:08:27 +0000 | [diff] [blame] | 143 | } else if (const SrcValueSDNode *M = dyn_cast<SrcValueSDNode>(Node)) { |
| 144 | if (M->getValue()) |
| 145 | Op += "<" + M->getValue()->getName() + ":" + itostr(M->getOffset()) + ">"; |
| 146 | else |
| 147 | Op += "<null:" + itostr(M->getOffset()) + ">"; |
Chris Lattner | a23e815 | 2005-08-18 03:31:02 +0000 | [diff] [blame] | 148 | } else if (const VTSDNode *N = dyn_cast<VTSDNode>(Node)) { |
Dan Gohman | b55757e | 2007-05-18 17:52:13 +0000 | [diff] [blame] | 149 | Op = Op + " VT=" + MVT::getValueTypeString(N->getVT()); |
Chris Lattner | 36ce691 | 2005-11-29 06:21:05 +0000 | [diff] [blame] | 150 | } else if (const StringSDNode *N = dyn_cast<StringSDNode>(Node)) { |
| 151 | Op = Op + "\"" + N->getValue() + "\""; |
Evan Cheng | 45aeccc | 2006-10-10 20:11:26 +0000 | [diff] [blame] | 152 | } else if (const LoadSDNode *LD = dyn_cast<LoadSDNode>(Node)) { |
| 153 | bool doExt = true; |
| 154 | switch (LD->getExtensionType()) { |
| 155 | default: doExt = false; break; |
| 156 | case ISD::EXTLOAD: |
| 157 | Op = Op + "<anyext "; |
| 158 | break; |
| 159 | case ISD::SEXTLOAD: |
| 160 | Op = Op + " <sext "; |
| 161 | break; |
| 162 | case ISD::ZEXTLOAD: |
| 163 | Op = Op + " <zext "; |
| 164 | break; |
| 165 | } |
| 166 | if (doExt) |
Evan Cheng | 2e49f09 | 2006-10-11 07:10:22 +0000 | [diff] [blame] | 167 | Op = Op + MVT::getValueTypeString(LD->getLoadedVT()) + ">"; |
Evan Cheng | 45aeccc | 2006-10-10 20:11:26 +0000 | [diff] [blame] | 168 | |
Evan Cheng | 0030582 | 2006-11-09 18:44:21 +0000 | [diff] [blame] | 169 | Op += LD->getIndexedModeName(LD->getAddressingMode()); |
Evan Cheng | 649b7ef | 2006-10-17 21:18:26 +0000 | [diff] [blame] | 170 | } else if (const StoreSDNode *ST = dyn_cast<StoreSDNode>(Node)) { |
| 171 | if (ST->isTruncatingStore()) |
| 172 | Op = Op + "<trunc " + MVT::getValueTypeString(ST->getStoredVT()) + ">"; |
Evan Cheng | 0030582 | 2006-11-09 18:44:21 +0000 | [diff] [blame] | 173 | Op += ST->getIndexedModeName(ST->getAddressingMode()); |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 174 | } |
Chris Lattner | 36ce691 | 2005-11-29 06:21:05 +0000 | [diff] [blame] | 175 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 176 | return Op; |
| 177 | } |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 178 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 179 | |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 180 | /// viewGraph - Pop up a ghostview window with the reachable parts of the DAG |
| 181 | /// rendered using 'dot'. |
| 182 | /// |
| 183 | void SelectionDAG::viewGraph() { |
Chris Lattner | e388b5e | 2005-07-14 05:17:43 +0000 | [diff] [blame] | 184 | // This code is only for debugging! |
Chris Lattner | c5f44ad | 2005-07-14 05:33:13 +0000 | [diff] [blame] | 185 | #ifndef NDEBUG |
Reid Spencer | 9d5b532 | 2006-06-27 16:49:46 +0000 | [diff] [blame] | 186 | ViewGraph(this, "dag." + getMachineFunction().getFunction()->getName()); |
| 187 | #else |
Bill Wendling | 832171c | 2006-12-07 20:04:42 +0000 | [diff] [blame] | 188 | cerr << "SelectionDAG::viewGraph is only available in debug builds on " |
| 189 | << "systems with Graphviz or gv!\n"; |
Reid Spencer | 9d5b532 | 2006-06-27 16:49:46 +0000 | [diff] [blame] | 190 | #endif // NDEBUG |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 191 | } |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 192 | |
| 193 | |
| 194 | /// clearGraphAttrs - Clear all previously defined node graph attributes. |
| 195 | /// Intended to be used from a debugging tool (eg. gdb). |
| 196 | void SelectionDAG::clearGraphAttrs() { |
| 197 | #ifndef NDEBUG |
| 198 | NodeGraphAttrs.clear(); |
| 199 | #else |
Bill Wendling | 832171c | 2006-12-07 20:04:42 +0000 | [diff] [blame] | 200 | cerr << "SelectionDAG::clearGraphAttrs is only available in debug builds" |
| 201 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 202 | #endif |
| 203 | } |
| 204 | |
| 205 | |
| 206 | /// setGraphAttrs - Set graph attributes for a node. (eg. "color=red".) |
| 207 | /// |
| 208 | void SelectionDAG::setGraphAttrs(const SDNode *N, const char *Attrs) { |
| 209 | #ifndef NDEBUG |
| 210 | NodeGraphAttrs[N] = Attrs; |
| 211 | #else |
Bill Wendling | 832171c | 2006-12-07 20:04:42 +0000 | [diff] [blame] | 212 | cerr << "SelectionDAG::setGraphAttrs is only available in debug builds" |
| 213 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 214 | #endif |
| 215 | } |
| 216 | |
| 217 | |
| 218 | /// getGraphAttrs - Get graph attributes for a node. (eg. "color=red".) |
| 219 | /// Used from getNodeAttributes. |
| 220 | const std::string SelectionDAG::getGraphAttrs(const SDNode *N) const { |
| 221 | #ifndef NDEBUG |
| 222 | std::map<const SDNode *, std::string>::const_iterator I = |
| 223 | NodeGraphAttrs.find(N); |
| 224 | |
| 225 | if (I != NodeGraphAttrs.end()) |
| 226 | return I->second; |
| 227 | else |
| 228 | return ""; |
| 229 | #else |
Bill Wendling | 832171c | 2006-12-07 20:04:42 +0000 | [diff] [blame] | 230 | cerr << "SelectionDAG::getGraphAttrs is only available in debug builds" |
| 231 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 232 | return std::string(""); |
| 233 | #endif |
| 234 | } |
| 235 | |
| 236 | /// setGraphColor - Convenience for setting node color attribute. |
| 237 | /// |
| 238 | void SelectionDAG::setGraphColor(const SDNode *N, const char *Color) { |
| 239 | #ifndef NDEBUG |
| 240 | NodeGraphAttrs[N] = std::string("color=") + Color; |
| 241 | #else |
Bill Wendling | 832171c | 2006-12-07 20:04:42 +0000 | [diff] [blame] | 242 | cerr << "SelectionDAG::setGraphColor is only available in debug builds" |
| 243 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 244 | #endif |
| 245 | } |
| 246 | |
Dan Gohman | 3e1a7ae | 2007-08-28 20:32:58 +0000 | [diff] [blame] | 247 | namespace llvm { |
| 248 | template<> |
| 249 | struct DOTGraphTraits<ScheduleDAG*> : public DefaultDOTGraphTraits { |
| 250 | static std::string getGraphName(const ScheduleDAG *G) { |
| 251 | return DOTGraphTraits<SelectionDAG*>::getGraphName(&G->DAG); |
| 252 | } |
| 253 | |
| 254 | static bool renderGraphFromBottomUp() { |
| 255 | return true; |
| 256 | } |
| 257 | |
| 258 | static bool hasNodeAddressLabel(const SUnit *Node, |
| 259 | const ScheduleDAG *Graph) { |
| 260 | return true; |
| 261 | } |
| 262 | |
| 263 | /// If you want to override the dot attributes printed for a particular |
| 264 | /// edge, override this method. |
| 265 | template<typename EdgeIter> |
| 266 | static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { |
| 267 | if (EI.isChain()) |
| 268 | return "color=blue,style=dashed"; |
| 269 | return ""; |
| 270 | } |
| 271 | |
| 272 | |
| 273 | static std::string getNodeLabel(const SUnit *Node, |
| 274 | const ScheduleDAG *Graph); |
| 275 | static std::string getNodeAttributes(const SUnit *N, |
| 276 | const ScheduleDAG *Graph) { |
| 277 | return "shape=Mrecord"; |
| 278 | } |
| 279 | |
| 280 | static void addCustomGraphFeatures(ScheduleDAG *G, |
| 281 | GraphWriter<ScheduleDAG*> &GW) { |
| 282 | GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); |
| 283 | if (G->DAG.getRoot().Val) |
| 284 | GW.emitEdge(0, -1, G->SUnitMap[G->DAG.getRoot().Val], -1, ""); |
| 285 | } |
| 286 | }; |
| 287 | } |
| 288 | |
| 289 | std::string DOTGraphTraits<ScheduleDAG*>::getNodeLabel(const SUnit *SU, |
| 290 | const ScheduleDAG *G) { |
| 291 | std::string Op; |
| 292 | |
| 293 | for (unsigned i = 0; i < SU->FlaggedNodes.size(); ++i) { |
| 294 | Op += DOTGraphTraits<SelectionDAG*>::getNodeLabel(SU->FlaggedNodes[i], |
| 295 | &G->DAG) + "\n"; |
| 296 | } |
| 297 | |
| 298 | Op += DOTGraphTraits<SelectionDAG*>::getNodeLabel(SU->Node, &G->DAG); |
| 299 | |
| 300 | return Op; |
| 301 | } |
| 302 | |
| 303 | |
| 304 | /// viewGraph - Pop up a ghostview window with the reachable parts of the DAG |
| 305 | /// rendered using 'dot'. |
| 306 | /// |
| 307 | void ScheduleDAG::viewGraph() { |
| 308 | // This code is only for debugging! |
| 309 | #ifndef NDEBUG |
| 310 | ViewGraph(this, "dag." + DAG.getMachineFunction().getFunction()->getName()); |
| 311 | #else |
| 312 | cerr << "ScheduleDAG::viewGraph is only available in debug builds on " |
| 313 | << "systems with Graphviz or gv!\n"; |
| 314 | #endif // NDEBUG |
| 315 | } |