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