diff options
author | Dan Gohman <gohman@apple.com> | 2008-11-19 22:09:45 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-11-19 22:09:45 +0000 |
commit | 7d1cd3f21d68179f4ebf4ee18fb7a0ddca9c5a37 (patch) | |
tree | d7d6abfe86a659d9cab439402902572639ac1f54 /lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | |
parent | 252ae9e8ae4efaf1f67a608ad2563323308bd803 (diff) |
Move the code for printing a graph node label for an SUnit into
a virtual method of SelectionDAG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index 758b8f263b..d7481085df 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'. /// |