1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Move to raw_ostream.

llvm-svn: 76963
This commit is contained in:
Daniel Dunbar 2009-07-24 09:53:24 +00:00
parent e3fea713f1
commit 1df20e31e5
4 changed files with 77 additions and 74 deletions

View File

@ -18,10 +18,11 @@
#include <cassert>
#include <climits>
#include <cstring>
#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/ADT/ilist.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@ -887,7 +888,7 @@ operator-(const SparseBitVector<ElementSize> &LHS,
// Dump a SparseBitVector to a stream
template <unsigned ElementSize>
void dump(const SparseBitVector<ElementSize> &LHS, llvm::OStream &out) {
void dump(const SparseBitVector<ElementSize> &LHS, raw_ostream &out) {
out << "[ ";
typename SparseBitVector<ElementSize>::iterator bi;

View File

@ -826,7 +826,7 @@ unsigned Andersens::getNodeForConstantPointer(Constant *C) {
case Instruction::BitCast:
return getNodeForConstantPointer(CE->getOperand(0));
default:
cerr << "Constant Expr not yet handled: " << *CE << "\n";
errs() << "Constant Expr not yet handled: " << *CE << "\n";
llvm_unreachable(0);
}
} else {
@ -853,7 +853,7 @@ unsigned Andersens::getNodeForConstantPointerTarget(Constant *C) {
case Instruction::BitCast:
return getNodeForConstantPointerTarget(CE->getOperand(0));
default:
cerr << "Constant Expr not yet handled: " << *CE << "\n";
errs() << "Constant Expr not yet handled: " << *CE << "\n";
llvm_unreachable(0);
}
} else {
@ -1153,7 +1153,7 @@ void Andersens::visitInstruction(Instruction &I) {
return;
default:
// Is this something we aren't handling yet?
cerr << "Unknown instruction: " << I;
errs() << "Unknown instruction: " << I;
llvm_unreachable(0);
}
}
@ -1398,7 +1398,8 @@ bool Andersens::Node::intersectsIgnoring(Node *N, unsigned Ignoring) const {
void dumpToDOUT(SparseBitVector<> *bitmap) {
#ifndef NDEBUG
dump(*bitmap, DOUT);
raw_os_ostream OS(*DOUT);
dump(*bitmap, OS);
#endif
}
@ -2778,17 +2779,17 @@ unsigned Andersens::FindNode(unsigned NodeIndex) const {
void Andersens::PrintNode(const Node *N) const {
if (N == &GraphNodes[UniversalSet]) {
cerr << "<universal>";
errs() << "<universal>";
return;
} else if (N == &GraphNodes[NullPtr]) {
cerr << "<nullptr>";
errs() << "<nullptr>";
return;
} else if (N == &GraphNodes[NullObject]) {
cerr << "<null>";
errs() << "<null>";
return;
}
if (!N->getValue()) {
cerr << "artificial" << (intptr_t) N;
errs() << "artificial" << (intptr_t) N;
return;
}
@ -2797,85 +2798,85 @@ void Andersens::PrintNode(const Node *N) const {
if (Function *F = dyn_cast<Function>(V)) {
if (isa<PointerType>(F->getFunctionType()->getReturnType()) &&
N == &GraphNodes[getReturnNode(F)]) {
cerr << F->getName() << ":retval";
errs() << F->getName() << ":retval";
return;
} else if (F->getFunctionType()->isVarArg() &&
N == &GraphNodes[getVarargNode(F)]) {
cerr << F->getName() << ":vararg";
errs() << F->getName() << ":vararg";
return;
}
}
if (Instruction *I = dyn_cast<Instruction>(V))
cerr << I->getParent()->getParent()->getName() << ":";
errs() << I->getParent()->getParent()->getName() << ":";
else if (Argument *Arg = dyn_cast<Argument>(V))
cerr << Arg->getParent()->getName() << ":";
errs() << Arg->getParent()->getName() << ":";
if (V->hasName())
cerr << V->getName();
errs() << V->getName();
else
cerr << "(unnamed)";
errs() << "(unnamed)";
if (isa<GlobalValue>(V) || isa<AllocationInst>(V))
if (N == &GraphNodes[getObject(V)])
cerr << "<mem>";
errs() << "<mem>";
}
void Andersens::PrintConstraint(const Constraint &C) const {
if (C.Type == Constraint::Store) {
cerr << "*";
errs() << "*";
if (C.Offset != 0)
cerr << "(";
errs() << "(";
}
PrintNode(&GraphNodes[C.Dest]);
if (C.Type == Constraint::Store && C.Offset != 0)
cerr << " + " << C.Offset << ")";
cerr << " = ";
errs() << " + " << C.Offset << ")";
errs() << " = ";
if (C.Type == Constraint::Load) {
cerr << "*";
errs() << "*";
if (C.Offset != 0)
cerr << "(";
errs() << "(";
}
else if (C.Type == Constraint::AddressOf)
cerr << "&";
errs() << "&";
PrintNode(&GraphNodes[C.Src]);
if (C.Offset != 0 && C.Type != Constraint::Store)
cerr << " + " << C.Offset;
errs() << " + " << C.Offset;
if (C.Type == Constraint::Load && C.Offset != 0)
cerr << ")";
cerr << "\n";
errs() << ")";
errs() << "\n";
}
void Andersens::PrintConstraints() const {
cerr << "Constraints:\n";
errs() << "Constraints:\n";
for (unsigned i = 0, e = Constraints.size(); i != e; ++i)
PrintConstraint(Constraints[i]);
}
void Andersens::PrintPointsToGraph() const {
cerr << "Points-to graph:\n";
errs() << "Points-to graph:\n";
for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) {
const Node *N = &GraphNodes[i];
if (FindNode(i) != i) {
PrintNode(N);
cerr << "\t--> same as ";
errs() << "\t--> same as ";
PrintNode(&GraphNodes[FindNode(i)]);
cerr << "\n";
errs() << "\n";
} else {
cerr << "[" << (N->PointsTo->count()) << "] ";
errs() << "[" << (N->PointsTo->count()) << "] ";
PrintNode(N);
cerr << "\t--> ";
errs() << "\t--> ";
bool first = true;
for (SparseBitVector<>::iterator bi = N->PointsTo->begin();
bi != N->PointsTo->end();
++bi) {
if (!first)
cerr << ", ";
errs() << ", ";
PrintNode(&GraphNodes[*bi]);
first = false;
}
cerr << "\n";
errs() << "\n";
}
}
}

View File

@ -594,9 +594,9 @@ bool LiveIntervals::conflictsWithPhysRegRef(LiveInterval &li,
void LiveIntervals::printRegName(unsigned reg) const {
if (TargetRegisterInfo::isPhysicalRegister(reg))
cerr << tri_->getName(reg);
errs() << tri_->getName(reg);
else
cerr << "%reg" << reg;
errs() << "%reg" << reg;
}
void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,

View File

@ -19,6 +19,7 @@
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <climits>
using namespace llvm;
@ -40,7 +41,7 @@ void ScheduleDAG::dumpSchedule() const {
if (SUnit *SU = Sequence[i])
SU->dump(this);
else
cerr << "**** NOOP ****\n";
errs() << "**** NOOP ****\n";
}
}
@ -256,56 +257,56 @@ void SUnit::ComputeHeight() {
/// 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 << "): ";
errs() << "SU(" << NodeNum << "): ";
G->dumpNode(this);
}
void SUnit::dumpAll(const ScheduleDAG *G) const {
dump(G);
cerr << " # preds left : " << NumPredsLeft << "\n";
cerr << " # succs left : " << NumSuccsLeft << "\n";
cerr << " Latency : " << Latency << "\n";
cerr << " Depth : " << Depth << "\n";
cerr << " Height : " << Height << "\n";
errs() << " # preds left : " << NumPredsLeft << "\n";
errs() << " # succs left : " << NumSuccsLeft << "\n";
errs() << " Latency : " << Latency << "\n";
errs() << " Depth : " << Depth << "\n";
errs() << " Height : " << Height << "\n";
if (Preds.size() != 0) {
cerr << " Predecessors:\n";
errs() << " Predecessors:\n";
for (SUnit::const_succ_iterator I = Preds.begin(), E = Preds.end();
I != E; ++I) {
cerr << " ";
errs() << " ";
switch (I->getKind()) {
case SDep::Data: cerr << "val "; break;
case SDep::Anti: cerr << "anti"; break;
case SDep::Output: cerr << "out "; break;
case SDep::Order: cerr << "ch "; break;
case SDep::Data: errs() << "val "; break;
case SDep::Anti: errs() << "anti"; break;
case SDep::Output: errs() << "out "; break;
case SDep::Order: errs() << "ch "; break;
}
cerr << "#";
cerr << I->getSUnit() << " - SU(" << I->getSUnit()->NodeNum << ")";
errs() << "#";
errs() << I->getSUnit() << " - SU(" << I->getSUnit()->NodeNum << ")";
if (I->isArtificial())
cerr << " *";
cerr << "\n";
errs() << " *";
errs() << "\n";
}
}
if (Succs.size() != 0) {
cerr << " Successors:\n";
errs() << " Successors:\n";
for (SUnit::const_succ_iterator I = Succs.begin(), E = Succs.end();
I != E; ++I) {
cerr << " ";
errs() << " ";
switch (I->getKind()) {
case SDep::Data: cerr << "val "; break;
case SDep::Anti: cerr << "anti"; break;
case SDep::Output: cerr << "out "; break;
case SDep::Order: cerr << "ch "; break;
case SDep::Data: errs() << "val "; break;
case SDep::Anti: errs() << "anti"; break;
case SDep::Output: errs() << "out "; break;
case SDep::Order: errs() << "ch "; break;
}
cerr << "#";
cerr << I->getSUnit() << " - SU(" << I->getSUnit()->NodeNum << ")";
errs() << "#";
errs() << I->getSUnit() << " - SU(" << I->getSUnit()->NodeNum << ")";
if (I->isArtificial())
cerr << " *";
cerr << "\n";
errs() << " *";
errs() << "\n";
}
}
cerr << "\n";
errs() << "\n";
}
#ifndef NDEBUG
@ -323,35 +324,35 @@ void ScheduleDAG::VerifySchedule(bool isBottomUp) {
continue;
}
if (!AnyNotSched)
cerr << "*** Scheduling failed! ***\n";
errs() << "*** Scheduling failed! ***\n";
SUnits[i].dump(this);
cerr << "has not been scheduled!\n";
errs() << "has not been scheduled!\n";
AnyNotSched = true;
}
if (SUnits[i].isScheduled &&
(isBottomUp ? SUnits[i].getHeight() : SUnits[i].getHeight()) >
unsigned(INT_MAX)) {
if (!AnyNotSched)
cerr << "*** Scheduling failed! ***\n";
errs() << "*** Scheduling failed! ***\n";
SUnits[i].dump(this);
cerr << "has an unexpected "
errs() << "has an unexpected "
<< (isBottomUp ? "Height" : "Depth") << " value!\n";
AnyNotSched = true;
}
if (isBottomUp) {
if (SUnits[i].NumSuccsLeft != 0) {
if (!AnyNotSched)
cerr << "*** Scheduling failed! ***\n";
errs() << "*** Scheduling failed! ***\n";
SUnits[i].dump(this);
cerr << "has successors left!\n";
errs() << "has successors left!\n";
AnyNotSched = true;
}
} else {
if (SUnits[i].NumPredsLeft != 0) {
if (!AnyNotSched)
cerr << "*** Scheduling failed! ***\n";
errs() << "*** Scheduling failed! ***\n";
SUnits[i].dump(this);
cerr << "has predecessors left!\n";
errs() << "has predecessors left!\n";
AnyNotSched = true;
}
}