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 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // 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 | |
Dan Gohman | 84fbac5 | 2009-02-06 17:22:58 +0000 | [diff] [blame] | 14 | #include "ScheduleDAGSDNodes.h" |
Chris Lattner | 5839bf2 | 2005-08-26 17:15:30 +0000 | [diff] [blame] | 15 | #include "llvm/Constants.h" |
Bill Wendling | 0bcbd1d | 2012-06-28 00:05:13 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo.h" |
Chris Lattner | 5267651 | 2006-03-05 09:38:03 +0000 | [diff] [blame] | 17 | #include "llvm/Assembly/Writer.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/SelectionDAG.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" |
Bill Wendling | 10fff60 | 2008-07-03 22:53:42 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/MachineModuleInfo.h" |
Dan Gohman | 6f0d024 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetRegisterInfo.h" |
Chris Lattner | 7228aa7 | 2005-08-19 21:21:16 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetMachine.h" |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 24 | #include "llvm/Support/Debug.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 25 | #include "llvm/Support/GraphWriter.h" |
Chris Lattner | 62ca325 | 2008-08-23 22:53:13 +0000 | [diff] [blame] | 26 | #include "llvm/Support/raw_ostream.h" |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 27 | #include "llvm/ADT/DenseSet.h" |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 28 | #include "llvm/ADT/StringExtras.h" |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 29 | using namespace llvm; |
| 30 | |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 31 | namespace llvm { |
| 32 | template<> |
| 33 | struct DOTGraphTraits<SelectionDAG*> : public DefaultDOTGraphTraits { |
Tobias Grosser | a10d598 | 2009-11-30 12:38:13 +0000 | [diff] [blame] | 34 | |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 35 | explicit DOTGraphTraits(bool isSimple=false) : |
| 36 | DefaultDOTGraphTraits(isSimple) {} |
Tobias Grosser | a10d598 | 2009-11-30 12:38:13 +0000 | [diff] [blame] | 37 | |
Dan Gohman | 3580331 | 2008-07-21 21:06:55 +0000 | [diff] [blame] | 38 | static bool hasEdgeDestLabels() { |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | static unsigned numEdgeDestLabels(const void *Node) { |
| 43 | return ((const SDNode *) Node)->getNumValues(); |
| 44 | } |
| 45 | |
| 46 | static std::string getEdgeDestLabel(const void *Node, unsigned i) { |
Owen Anderson | e50ed30 | 2009-08-10 22:56:29 +0000 | [diff] [blame] | 47 | return ((const SDNode *) Node)->getValueType(i).getEVTString(); |
Dan Gohman | 3580331 | 2008-07-21 21:06:55 +0000 | [diff] [blame] | 48 | } |
| 49 | |
Dan Gohman | 5b69fe7 | 2009-12-01 19:20:00 +0000 | [diff] [blame] | 50 | template<typename EdgeIter> |
| 51 | static std::string getEdgeSourceLabel(const void *Node, EdgeIter I) { |
Roman Divacky | 141e997 | 2012-09-05 22:03:34 +0000 | [diff] [blame^] | 52 | return itostr(I - SDNodeIterator::begin((const SDNode *) Node)); |
Dan Gohman | 5b69fe7 | 2009-12-01 19:20:00 +0000 | [diff] [blame] | 53 | } |
| 54 | |
Dan Gohman | 3580331 | 2008-07-21 21:06:55 +0000 | [diff] [blame] | 55 | /// edgeTargetsEdgeSource - This method returns true if this outgoing edge |
Tobias Grosser | a10d598 | 2009-11-30 12:38:13 +0000 | [diff] [blame] | 56 | /// should actually target another edge source, not a node. If this method |
| 57 | /// is implemented, getEdgeTarget should be implemented. |
Dan Gohman | 3580331 | 2008-07-21 21:06:55 +0000 | [diff] [blame] | 58 | template<typename EdgeIter> |
| 59 | static bool edgeTargetsEdgeSource(const void *Node, EdgeIter I) { |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | /// getEdgeTarget - If edgeTargetsEdgeSource returns true, this method is |
| 64 | /// called to determine which outgoing edge of Node is the target of this |
| 65 | /// edge. |
| 66 | template<typename EdgeIter> |
| 67 | static EdgeIter getEdgeTarget(const void *Node, EdgeIter I) { |
| 68 | SDNode *TargetNode = *I; |
| 69 | SDNodeIterator NI = SDNodeIterator::begin(TargetNode); |
Gabor Greif | 99a6cb9 | 2008-08-26 22:36:50 +0000 | [diff] [blame] | 70 | std::advance(NI, I.getNode()->getOperand(I.getOperand()).getResNo()); |
Dan Gohman | 3580331 | 2008-07-21 21:06:55 +0000 | [diff] [blame] | 71 | return NI; |
| 72 | } |
| 73 | |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 74 | static std::string getGraphName(const SelectionDAG *G) { |
Craig Topper | 96601ca | 2012-08-22 06:07:19 +0000 | [diff] [blame] | 75 | return G->getMachineFunction().getName(); |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 76 | } |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 77 | |
| 78 | static bool renderGraphFromBottomUp() { |
| 79 | return true; |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 80 | } |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 81 | |
Chris Lattner | 37345fe | 2005-10-01 00:17:07 +0000 | [diff] [blame] | 82 | static bool hasNodeAddressLabel(const SDNode *Node, |
| 83 | const SelectionDAG *Graph) { |
| 84 | return true; |
| 85 | } |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 86 | |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 87 | /// If you want to override the dot attributes printed for a particular |
| 88 | /// edge, override this method. |
| 89 | template<typename EdgeIter> |
Tobias Grosser | a91f86c | 2011-02-27 04:11:03 +0000 | [diff] [blame] | 90 | static std::string getEdgeAttributes(const void *Node, EdgeIter EI, |
| 91 | const SelectionDAG *Graph) { |
Dan Gohman | 475871a | 2008-07-27 21:46:04 +0000 | [diff] [blame] | 92 | SDValue Op = EI.getNode()->getOperand(EI.getOperand()); |
Owen Anderson | e50ed30 | 2009-08-10 22:56:29 +0000 | [diff] [blame] | 93 | EVT VT = Op.getValueType(); |
Chris Lattner | f1b4eaf | 2010-12-21 02:38:05 +0000 | [diff] [blame] | 94 | if (VT == MVT::Glue) |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 95 | return "color=red,style=bold"; |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame] | 96 | else if (VT == MVT::Other) |
Dan Gohman | 7a0a4fc | 2007-06-18 15:30:16 +0000 | [diff] [blame] | 97 | return "color=blue,style=dashed"; |
Chris Lattner | 34ab4d4 | 2006-10-20 18:06:09 +0000 | [diff] [blame] | 98 | return ""; |
| 99 | } |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 100 | |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 101 | |
Tobias Grosser | 56f4ef3 | 2009-11-30 12:38:47 +0000 | [diff] [blame] | 102 | static std::string getSimpleNodeLabel(const SDNode *Node, |
| 103 | const SelectionDAG *G) { |
| 104 | std::string Result = Node->getOperationName(G); |
| 105 | { |
| 106 | raw_string_ostream OS(Result); |
| 107 | Node->print_details(OS, G); |
| 108 | } |
| 109 | return Result; |
| 110 | } |
| 111 | std::string getNodeLabel(const SDNode *Node, const SelectionDAG *Graph); |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 112 | static std::string getNodeAttributes(const SDNode *N, |
| 113 | const SelectionDAG *Graph) { |
| 114 | #ifndef NDEBUG |
| 115 | const std::string &Attrs = Graph->getGraphAttrs(N); |
| 116 | if (!Attrs.empty()) { |
| 117 | if (Attrs.find("shape=") == std::string::npos) |
| 118 | return std::string("shape=Mrecord,") + Attrs; |
| 119 | else |
| 120 | return Attrs; |
| 121 | } |
| 122 | #endif |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 123 | return "shape=Mrecord"; |
| 124 | } |
Chris Lattner | fc08d9c | 2005-01-10 23:52:04 +0000 | [diff] [blame] | 125 | |
| 126 | static void addCustomGraphFeatures(SelectionDAG *G, |
| 127 | GraphWriter<SelectionDAG*> &GW) { |
| 128 | GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); |
Gabor Greif | ba36cb5 | 2008-08-28 21:40:38 +0000 | [diff] [blame] | 129 | if (G->getRoot().getNode()) |
| 130 | GW.emitEdge(0, -1, G->getRoot().getNode(), G->getRoot().getResNo(), |
Dan Gohman | 694caf5 | 2008-07-22 17:52:59 +0000 | [diff] [blame] | 131 | "color=blue,style=dashed"); |
Chris Lattner | fc08d9c | 2005-01-10 23:52:04 +0000 | [diff] [blame] | 132 | } |
Chris Lattner | e0646b8 | 2005-01-10 23:26:00 +0000 | [diff] [blame] | 133 | }; |
| 134 | } |
| 135 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 136 | std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node, |
Tobias Grosser | 56f4ef3 | 2009-11-30 12:38:47 +0000 | [diff] [blame] | 137 | const SelectionDAG *G) { |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 138 | return DOTGraphTraits<SelectionDAG*>::getSimpleNodeLabel(Node, G); |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 139 | } |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 140 | |
Chris Lattner | e9c44cd | 2005-01-11 00:34:33 +0000 | [diff] [blame] | 141 | |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 142 | /// viewGraph - Pop up a ghostview window with the reachable parts of the DAG |
| 143 | /// rendered using 'dot'. |
| 144 | /// |
Dan Gohman | 462dc7f | 2008-07-21 20:00:07 +0000 | [diff] [blame] | 145 | void SelectionDAG::viewGraph(const std::string &Title) { |
Chris Lattner | e388b5e | 2005-07-14 05:17:43 +0000 | [diff] [blame] | 146 | // This code is only for debugging! |
Chris Lattner | c5f44ad | 2005-07-14 05:33:13 +0000 | [diff] [blame] | 147 | #ifndef NDEBUG |
Craig Topper | 96601ca | 2012-08-22 06:07:19 +0000 | [diff] [blame] | 148 | ViewGraph(this, "dag." + getMachineFunction().getName(), |
Daniel Dunbar | f6ccee5 | 2009-07-24 08:24:36 +0000 | [diff] [blame] | 149 | false, Title); |
Reid Spencer | 9d5b532 | 2006-06-27 16:49:46 +0000 | [diff] [blame] | 150 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 151 | errs() << "SelectionDAG::viewGraph is only available in debug builds on " |
| 152 | << "systems with Graphviz or gv!\n"; |
Reid Spencer | 9d5b532 | 2006-06-27 16:49:46 +0000 | [diff] [blame] | 153 | #endif // NDEBUG |
Chris Lattner | 6632848 | 2005-01-10 23:08:40 +0000 | [diff] [blame] | 154 | } |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 155 | |
Dan Gohman | 0b12aef | 2008-07-30 18:48:53 +0000 | [diff] [blame] | 156 | // This overload is defined out-of-line here instead of just using a |
| 157 | // default parameter because this is easiest for gdb to call. |
| 158 | void SelectionDAG::viewGraph() { |
| 159 | viewGraph(""); |
| 160 | } |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 161 | |
| 162 | /// clearGraphAttrs - Clear all previously defined node graph attributes. |
| 163 | /// Intended to be used from a debugging tool (eg. gdb). |
| 164 | void SelectionDAG::clearGraphAttrs() { |
| 165 | #ifndef NDEBUG |
| 166 | NodeGraphAttrs.clear(); |
| 167 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 168 | errs() << "SelectionDAG::clearGraphAttrs is only available in debug builds" |
| 169 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 170 | #endif |
| 171 | } |
| 172 | |
| 173 | |
| 174 | /// setGraphAttrs - Set graph attributes for a node. (eg. "color=red".) |
| 175 | /// |
| 176 | void SelectionDAG::setGraphAttrs(const SDNode *N, const char *Attrs) { |
| 177 | #ifndef NDEBUG |
| 178 | NodeGraphAttrs[N] = Attrs; |
| 179 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 180 | errs() << "SelectionDAG::setGraphAttrs is only available in debug builds" |
| 181 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 182 | #endif |
| 183 | } |
| 184 | |
| 185 | |
| 186 | /// getGraphAttrs - Get graph attributes for a node. (eg. "color=red".) |
| 187 | /// Used from getNodeAttributes. |
| 188 | const std::string SelectionDAG::getGraphAttrs(const SDNode *N) const { |
| 189 | #ifndef NDEBUG |
| 190 | std::map<const SDNode *, std::string>::const_iterator I = |
| 191 | NodeGraphAttrs.find(N); |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 192 | |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 193 | if (I != NodeGraphAttrs.end()) |
| 194 | return I->second; |
| 195 | else |
| 196 | return ""; |
| 197 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 198 | errs() << "SelectionDAG::getGraphAttrs is only available in debug builds" |
| 199 | << " on systems with Graphviz or gv!\n"; |
Dan Gohman | d98af0a | 2010-08-04 01:39:08 +0000 | [diff] [blame] | 200 | return std::string(); |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 201 | #endif |
| 202 | } |
| 203 | |
| 204 | /// setGraphColor - Convenience for setting node color attribute. |
| 205 | /// |
| 206 | void SelectionDAG::setGraphColor(const SDNode *N, const char *Color) { |
| 207 | #ifndef NDEBUG |
| 208 | NodeGraphAttrs[N] = std::string("color=") + Color; |
| 209 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 210 | errs() << "SelectionDAG::setGraphColor is only available in debug builds" |
| 211 | << " on systems with Graphviz or gv!\n"; |
Jim Laskey | ec20402 | 2006-10-02 12:26:53 +0000 | [diff] [blame] | 212 | #endif |
| 213 | } |
| 214 | |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 215 | /// setSubgraphColorHelper - Implement setSubgraphColor. Return |
| 216 | /// whether we truncated the search. |
| 217 | /// |
| 218 | bool SelectionDAG::setSubgraphColorHelper(SDNode *N, const char *Color, DenseSet<SDNode *> &visited, |
| 219 | int level, bool &printed) { |
| 220 | bool hit_limit = false; |
| 221 | |
| 222 | #ifndef NDEBUG |
| 223 | if (level >= 20) { |
| 224 | if (!printed) { |
| 225 | printed = true; |
David Greene | 9abe0bb | 2010-01-05 01:24:45 +0000 | [diff] [blame] | 226 | DEBUG(dbgs() << "setSubgraphColor hit max level\n"); |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 227 | } |
| 228 | return true; |
| 229 | } |
| 230 | |
| 231 | unsigned oldSize = visited.size(); |
| 232 | visited.insert(N); |
| 233 | if (visited.size() != oldSize) { |
| 234 | setGraphColor(N, Color); |
| 235 | for(SDNodeIterator i = SDNodeIterator::begin(N), iend = SDNodeIterator::end(N); |
| 236 | i != iend; |
| 237 | ++i) { |
| 238 | hit_limit = setSubgraphColorHelper(*i, Color, visited, level+1, printed) || hit_limit; |
| 239 | } |
| 240 | } |
| 241 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 242 | errs() << "SelectionDAG::setSubgraphColor is only available in debug builds" |
| 243 | << " on systems with Graphviz or gv!\n"; |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 244 | #endif |
| 245 | return hit_limit; |
| 246 | } |
| 247 | |
| 248 | /// setSubgraphColor - Convenience for setting subgraph color attribute. |
| 249 | /// |
| 250 | void SelectionDAG::setSubgraphColor(SDNode *N, const char *Color) { |
| 251 | #ifndef NDEBUG |
| 252 | DenseSet<SDNode *> visited; |
| 253 | bool printed = false; |
| 254 | if (setSubgraphColorHelper(N, Color, visited, 0, printed)) { |
| 255 | // Visually mark that we hit the limit |
Ted Kremenek | 8e7fa91 | 2008-10-27 22:43:07 +0000 | [diff] [blame] | 256 | if (strcmp(Color, "red") == 0) { |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 257 | setSubgraphColorHelper(N, "blue", visited, 0, printed); |
Dan Gohman | 0baf2a3 | 2009-12-01 19:16:15 +0000 | [diff] [blame] | 258 | } else if (strcmp(Color, "yellow") == 0) { |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 259 | setSubgraphColorHelper(N, "green", visited, 0, printed); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | #else |
Daniel Dunbar | 43ed267 | 2009-08-23 08:50:52 +0000 | [diff] [blame] | 264 | errs() << "SelectionDAG::setSubgraphColor is only available in debug builds" |
| 265 | << " on systems with Graphviz or gv!\n"; |
David Greene | c5e7e8d | 2008-10-27 18:17:03 +0000 | [diff] [blame] | 266 | #endif |
| 267 | } |
| 268 | |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 269 | std::string ScheduleDAGSDNodes::getGraphNodeLabel(const SUnit *SU) const { |
Dan Gohman | 7d1cd3f | 2008-11-19 22:09:45 +0000 | [diff] [blame] | 270 | std::string s; |
| 271 | raw_string_ostream O(s); |
| 272 | O << "SU(" << SU->NodeNum << "): "; |
| 273 | if (SU->getNode()) { |
Chris Lattner | 29d8f0c | 2010-12-23 17:24:32 +0000 | [diff] [blame] | 274 | SmallVector<SDNode *, 4> GluedNodes; |
| 275 | for (SDNode *N = SU->getNode(); N; N = N->getGluedNode()) |
| 276 | GluedNodes.push_back(N); |
| 277 | while (!GluedNodes.empty()) { |
Tobias Grosser | 56f4ef3 | 2009-11-30 12:38:47 +0000 | [diff] [blame] | 278 | O << DOTGraphTraits<SelectionDAG*> |
Chris Lattner | 29d8f0c | 2010-12-23 17:24:32 +0000 | [diff] [blame] | 279 | ::getSimpleNodeLabel(GluedNodes.back(), DAG); |
| 280 | GluedNodes.pop_back(); |
| 281 | if (!GluedNodes.empty()) |
Dan Gohman | 7d1cd3f | 2008-11-19 22:09:45 +0000 | [diff] [blame] | 282 | O << "\n "; |
| 283 | } |
| 284 | } else { |
| 285 | O << "CROSS RC COPY"; |
| 286 | } |
| 287 | return O.str(); |
| 288 | } |
Dan Gohman | 3e1a7ae | 2007-08-28 20:32:58 +0000 | [diff] [blame] | 289 | |
Dan Gohman | 343f0c0 | 2008-11-19 23:18:57 +0000 | [diff] [blame] | 290 | void ScheduleDAGSDNodes::getCustomGraphFeatures(GraphWriter<ScheduleDAG*> &GW) const { |
| 291 | if (DAG) { |
| 292 | // Draw a special "GraphRoot" node to indicate the root of the graph. |
| 293 | GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); |
| 294 | const SDNode *N = DAG->getRoot().getNode(); |
| 295 | if (N && N->getNodeId() != -1) |
| 296 | GW.emitEdge(0, -1, &SUnits[N->getNodeId()], -1, |
| 297 | "color=blue,style=dashed"); |
| 298 | } |
Dan Gohman | 3e1a7ae | 2007-08-28 20:32:58 +0000 | [diff] [blame] | 299 | } |