Convert SUnit's dump method into a print method and implement

dump in terms of it.

llvm-svn: 59665
This commit is contained in:
Dan Gohman 2008-11-19 21:32:03 +00:00
parent dbfc693f47
commit 78fb6214f3
2 changed files with 11 additions and 6 deletions

View File

@ -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;
};
//===--------------------------------------------------------------------===//

View File

@ -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<SDNode *, 4> 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 {