diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 09:53:24 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 09:53:24 +0000 |
commit | 3f0e83067d7938f742d21e14fc87c006d2fc3161 (patch) | |
tree | 0e2a8ee846b77708fb133710defbe6da510b37ae | |
parent | f6ccee5a9d2b9573f679bca6266ade3eb8cd3f88 (diff) | |
download | external_llvm-3f0e83067d7938f742d21e14fc87c006d2fc3161.zip external_llvm-3f0e83067d7938f742d21e14fc87c006d2fc3161.tar.gz external_llvm-3f0e83067d7938f742d21e14fc87c006d2fc3161.tar.bz2 |
Move to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76963 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/SparseBitVector.h | 7 | ||||
-rw-r--r-- | lib/Analysis/IPA/Andersens.cpp | 67 | ||||
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/ScheduleDAG.cpp | 73 |
4 files changed, 77 insertions, 74 deletions
diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h index 6230135..bcb4aac 100644 --- a/include/llvm/ADT/SparseBitVector.h +++ b/include/llvm/ADT/SparseBitVector.h @@ -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; diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 71d66f6..84cde63 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -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"; } } } diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index ee07211..79a4762 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -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, diff --git a/lib/CodeGen/ScheduleDAG.cpp b/lib/CodeGen/ScheduleDAG.cpp index a8452df..bc48dc2 100644 --- a/lib/CodeGen/ScheduleDAG.cpp +++ b/lib/CodeGen/ScheduleDAG.cpp @@ -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; } } |