From b5ce3ebed1ee2f0790eafcf4e501d2964ee34c68 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 19 Nov 2008 21:32:03 +0000 Subject: [PATCH] Convert SUnit's dump method into a print method and implement dump in terms of it. llvm-svn: 59665 --- include/llvm/CodeGen/ScheduleDAG.h | 1 + lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index e90bceb7be5..8172a15fb4d 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -242,6 +242,7 @@ namespace llvm { void dump(const ScheduleDAG *G) const; void dumpAll(const ScheduleDAG *G) const; + void print(raw_ostream &O, const ScheduleDAG *G) const; }; //===--------------------------------------------------------------------===// diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index da68cd5029d..b63c3c1cf10 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -18,6 +18,7 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; ScheduleDAG::ScheduleDAG(SelectionDAG *dag, MachineBasicBlock *bb, @@ -459,22 +460,25 @@ void ScheduleDAG::Run() { /// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or /// a group of nodes flagged together. -void SUnit::dump(const ScheduleDAG *G) const { - cerr << "SU(" << NodeNum << "): "; +void SUnit::print(raw_ostream &O, const ScheduleDAG *G) const { + O << "SU(" << NodeNum << "): "; if (getNode()) { SmallVector FlaggedNodes; for (SDNode *N = getNode(); N; N = N->getFlaggedNode()) FlaggedNodes.push_back(N); while (!FlaggedNodes.empty()) { - cerr << " "; + O << " "; FlaggedNodes.back()->dump(G->DAG); - cerr << "\n"; + O << "\n"; FlaggedNodes.pop_back(); } } else { - cerr << "CROSS RC COPY "; + O << "CROSS RC COPY\n"; } - cerr << "\n"; +} + +void SUnit::dump(const ScheduleDAG *G) const { + print(errs(), G); } void SUnit::dumpAll(const ScheduleDAG *G) const {