aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/ScheduleDAG.h4
-rw-r--r--lib/CodeGen/SelectionDAG/ScheduleDAG.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp39
3 files changed, 23 insertions, 22 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h
index 8172a15..49dabe6 100644
--- a/include/llvm/CodeGen/ScheduleDAG.h
+++ b/include/llvm/CodeGen/ScheduleDAG.h
@@ -396,6 +396,10 @@ namespace llvm {
///
virtual void Schedule() = 0;
+ /// getGraphpNodeLabel - Return a label for an SUnit node in a Graphviz or similar
+ /// graph visualization.
+ virtual std::string getGraphNodeLabel(const SUnit *SU) const;
+
private:
/// EmitSubregNode - Generate machine code for subreg nodes.
///
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index b63c3c1..c2e2175 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -468,7 +468,7 @@ void SUnit::print(raw_ostream &O, const ScheduleDAG *G) const {
FlaggedNodes.push_back(N);
while (!FlaggedNodes.empty()) {
O << " ";
- FlaggedNodes.back()->dump(G->DAG);
+ FlaggedNodes.back()->print(O, G->DAG);
O << "\n";
FlaggedNodes.pop_back();
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
index 758b8f2..d748108 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -444,32 +444,29 @@ namespace llvm {
std::string DOTGraphTraits<ScheduleDAG*>::getNodeLabel(const SUnit *SU,
const ScheduleDAG *G) {
- std::string Op;
-
- if (G->DAG) {
- if (!SU->getNode())
- Op = "<CROSS RC COPY>";
- else {
- SmallVector<SDNode *, 4> FlaggedNodes;
- for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
- FlaggedNodes.push_back(N);
- while (!FlaggedNodes.empty()) {
- Op += DOTGraphTraits<SelectionDAG*>::getNodeLabel(FlaggedNodes.back(),
- G->DAG) + "\n";
- FlaggedNodes.pop_back();
- }
+ return G->getGraphNodeLabel(SU);
+}
+
+std::string ScheduleDAG::getGraphNodeLabel(const SUnit *SU) const {
+ std::string s;
+ raw_string_ostream O(s);
+ O << "SU(" << SU->NodeNum << "): ";
+ if (SU->getNode()) {
+ SmallVector<SDNode *, 4> FlaggedNodes;
+ for (SDNode *N = SU->getNode(); N; N = N->getFlaggedNode())
+ FlaggedNodes.push_back(N);
+ while (!FlaggedNodes.empty()) {
+ O << DOTGraphTraits<SelectionDAG*>::getNodeLabel(FlaggedNodes.back(), DAG);
+ FlaggedNodes.pop_back();
+ if (!FlaggedNodes.empty())
+ O << "\n ";
}
} else {
- std::string s;
- raw_string_ostream oss(s);
- SU->getInstr()->print(oss);
- Op += oss.str();
+ O << "CROSS RC COPY";
}
-
- return Op;
+ return O.str();
}
-
/// viewGraph - Pop up a ghostview window with the reachable parts of the DAG
/// rendered using 'dot'.
///