summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-11-14 00:06:09 +0000
committerDan Gohman <gohman@apple.com>2008-11-14 00:06:09 +0000
commitee8273e52f292bdf098a77819b82bb552b16faed (patch)
treeeab1212f24ce65f230b3c498519b77583842f3d9 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
parenta2cbbaa41f996f0a687b1436e42220fcd749cb89 (diff)
downloadbcm5719-llvm-ee8273e52f292bdf098a77819b82bb552b16faed.tar.gz
bcm5719-llvm-ee8273e52f292bdf098a77819b82bb552b16faed.zip
Initial support for carrying MachineInstrs in SUnits.
llvm-svn: 59278
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
index 27746333e44..8ff50c1a3ad 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -420,11 +420,24 @@ namespace llvm {
static void addCustomGraphFeatures(ScheduleDAG *G,
GraphWriter<ScheduleDAG*> &GW) {
+ // Draw a special "GraphRoot" node to indicate the root of the graph.
GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot");
- const SDNode *N = G->DAG->getRoot().getNode();
- if (N && N->getNodeId() != -1)
- GW.emitEdge(0, -1, &G->SUnits[N->getNodeId()], -1,
- "color=blue,style=dashed");
+ if (G->DAG) {
+ // For an SDNode-based ScheduleDAG, point to the root of the ScheduleDAG.
+ const SDNode *N = G->DAG->getRoot().getNode();
+ if (N && N->getNodeId() != -1)
+ GW.emitEdge(0, -1, &G->SUnits[N->getNodeId()], -1,
+ "color=blue,style=dashed");
+ } else {
+ // For a MachineInstr-based ScheduleDAG, find a root to point to.
+ for (unsigned i = 0, e = G->SUnits.size(); i != e; ++i) {
+ if (G->SUnits[i].Succs.empty()) {
+ GW.emitEdge(0, -1, &G->SUnits[i], -1,
+ "color=blue,style=dashed");
+ break;
+ }
+ }
+ }
}
};
}
OpenPOWER on IntegriCloud