summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 06:03:38 +0000
commit45cfe545ec8177262dabc70580ce05feaa1c3880 (patch)
treed7e42a138f6f8b54e1a831aff3c73c653ee77784 /lib
parentcb3e3d30054edfc7481bf323b315da4edc63bc44 (diff)
downloadllvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.gz
llvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.bz2
llvm-45cfe545ec8177262dabc70580ce05feaa1c3880.tar.xz
Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/CFGPrinter.cpp11
-rw-r--r--lib/Analysis/IPA/Andersens.cpp2
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp40
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp8
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp11
-rw-r--r--lib/Analysis/InstCount.cpp2
-rw-r--r--lib/Analysis/Interval.cpp3
-rw-r--r--lib/Analysis/IntervalPartition.cpp2
-rw-r--r--lib/Analysis/LoopInfo.cpp5
-rw-r--r--lib/Analysis/LoopVR.cpp3
-rw-r--r--lib/Analysis/PostDominators.cpp5
-rw-r--r--lib/Analysis/ScalarEvolution.cpp4
-rw-r--r--lib/CodeGen/GCMetadata.cpp2
-rw-r--r--lib/CodeGen/GCStrategy.cpp3
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp15
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp3
-rw-r--r--lib/CodeGen/LiveStackAnalysis.cpp3
-rw-r--r--lib/CodeGen/MachineDominators.cpp5
-rw-r--r--lib/CodeGen/PreAllocSplitting.cpp5
-rw-r--r--lib/CodeGen/SelectionDAG/CallingConvLower.cpp24
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp5
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp13
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp2
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.h5
-rw-r--r--lib/Support/ConstantRange.cpp7
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp2
-rw-r--r--lib/Transforms/Utils/AddrModeMatcher.cpp2
-rw-r--r--lib/VMCore/Dominators.cpp8
-rw-r--r--lib/VMCore/Pass.cpp7
29 files changed, 86 insertions, 121 deletions
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index 2364d984f9..f6ecfc596f 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -26,9 +26,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Config/config.h"
-#include <iosfwd>
-#include <sstream>
-#include <fstream>
using namespace llvm;
namespace llvm {
@@ -96,7 +93,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -118,7 +115,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -150,7 +147,7 @@ namespace {
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
@@ -179,7 +176,7 @@ namespace {
cerr << "\n";
return false;
}
- void print(std::ostream &OS, const Module* = 0) const {}
+ void print(raw_ostream &OS, const Module* = 0) const {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 02b4c9ac6f..966e87c4cb 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -607,7 +607,7 @@ namespace {
//===------------------------------------------------------------------===//
// Implement Analyize interface
//
- void print(std::ostream &O, const Module* M) const {
+ void print(raw_ostream &O, const Module*) const {
PrintPointsToGraph();
}
};
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index 4d15a48d4e..f03e4b2ba2 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -18,8 +18,7 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Streams.h"
-#include <ostream>
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
@@ -68,30 +67,21 @@ public:
AU.setPreservesAll();
}
- void print(std::ostream *o, const Module *M) const {
- if (o) print(*o, M);
- }
-
- virtual void print(std::ostream &o, const Module *M) const {
- o << "CallGraph Root is: ";
+ virtual void print(raw_ostream &OS, const Module *) const {
+ OS << "CallGraph Root is: ";
if (Function *F = getRoot()->getFunction())
- o << F->getNameStr() << "\n";
- else
- o << "<<null function: 0x" << getRoot() << ">>\n";
+ OS << F->getName() << "\n";
+ else {
+ OS << "<<null function: 0x" << getRoot() << ">>\n";
+ }
- CallGraph::print(o, M);
+ CallGraph::print(OS, 0);
}
virtual void releaseMemory() {
destroy();
}
- /// dump - Print out this call graph.
- ///
- inline void dump() const {
- print(cerr, Mod);
- }
-
CallGraphNode* getExternalCallingNode() const { return ExternalCallingNode; }
CallGraphNode* getCallsExternalNode() const { return CallsExternalNode; }
@@ -187,15 +177,11 @@ void CallGraph::destroy() {
}
}
-void CallGraph::print(std::ostream &OS, const Module *M) const {
+void CallGraph::print(raw_ostream &OS, Module*) const {
for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I)
I->second->print(OS);
}
-void CallGraph::dump() const {
- print(cerr, 0);
-}
-
//===----------------------------------------------------------------------===//
// Implementations of public modification methods
//
@@ -242,21 +228,21 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
return CGN = new CallGraphNode(const_cast<Function*>(F));
}
-void CallGraphNode::print(std::ostream &OS) const {
+void CallGraphNode::print(raw_ostream &OS) const {
if (Function *F = getFunction())
- OS << "Call graph node for function: '" << F->getNameStr() <<"'\n";
+ OS << "Call graph node for function: '" << F->getName() <<"'\n";
else
OS << "Call graph node <<null function: 0x" << this << ">>:\n";
for (const_iterator I = begin(), E = end(); I != E; ++I)
if (Function *FI = I->second->getFunction())
- OS << " Calls function '" << FI->getNameStr() <<"'\n";
+ OS << " Calls function '" << FI->getName() <<"'\n";
else
OS << " Calls external node\n";
OS << "\n";
}
-void CallGraphNode::dump() const { print(cerr); }
+void CallGraphNode::dump() const { print(errs()); }
/// removeCallEdgeFor - This method removes the edge in the node for the
/// specified call site. Note that this method takes linear time, so it
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index df2f0f8bd6..00eddc4de8 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/SCCIterator.h"
#include "llvm/PassManagers.h"
#include "llvm/Function.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -56,7 +57,7 @@ public:
// Print passes managed by this manager
void dumpPassStructure(unsigned Offset) {
- llvm::cerr << std::string(Offset*2, ' ') << "Call Graph SCC Pass Manager\n";
+ errs().indent(Offset*2) << "Call Graph SCC Pass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
P->dumpPassStructure(Offset + 1);
@@ -65,9 +66,8 @@ public:
}
Pass *getContainedPass(unsigned N) {
- assert ( N < PassVector.size() && "Pass number out of range!");
- Pass *FP = static_cast<Pass *>(PassVector[N]);
- return FP;
+ assert(N < PassVector.size() && "Pass number out of range!");
+ return static_cast<Pass *>(PassVector[N]);
}
virtual PassManagerType getPassManagerType() const {
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index 920ee37455..c4fb0b9a4e 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -92,13 +92,12 @@ bool FindUsedTypes::runOnModule(Module &m) {
// passed in, then the types are printed symbolically if possible, using the
// symbol table from the module.
//
-void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
- raw_os_ostream RO(OS);
- RO << "Types in use by this module:\n";
+void FindUsedTypes::print(raw_ostream &OS, const Module *M) const {
+ OS << "Types in use by this module:\n";
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
E = UsedTypes.end(); I != E; ++I) {
- RO << " ";
- WriteTypeSymbolic(RO, *I, M);
- RO << '\n';
+ OS << " ";
+ WriteTypeSymbolic(OS, *I, M);
+ OS << '\n';
}
}
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index b0db671724..83724caf52 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -59,7 +59,7 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
- virtual void print(std::ostream &O, const Module *M) const {}
+ virtual void print(raw_ostream &O, const Module *M) const {}
};
}
diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp
index 6a6b1b2048..ca9cdcaf24 100644
--- a/lib/Analysis/Interval.cpp
+++ b/lib/Analysis/Interval.cpp
@@ -37,8 +37,7 @@ bool Interval::isLoop() const {
}
-void Interval::print(std::ostream &O) const {
- raw_os_ostream OS(O);
+void Interval::print(raw_ostream &OS) const {
OS << "-------------------------------------------------------------\n"
<< "Interval Contents:\n";
diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp
index cb8a85da55..1f17b77a5b 100644
--- a/lib/Analysis/IntervalPartition.cpp
+++ b/lib/Analysis/IntervalPartition.cpp
@@ -32,7 +32,7 @@ void IntervalPartition::releaseMemory() {
RootInterval = 0;
}
-void IntervalPartition::print(std::ostream &O, const Module*) const {
+void IntervalPartition::print(raw_ostream &O, const Module*) const {
for(unsigned i = 0, e = Intervals.size(); i != e; ++i)
Intervals[i]->print(O);
}
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 75d89af2a5..5939dea4c0 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -309,8 +309,7 @@ void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTree>();
}
-void LoopInfo::print(std::ostream &OS, const Module*) const {
- raw_os_ostream OSS(OS);
- LI.print(OSS);
+void LoopInfo::print(raw_ostream &OS, const Module*) const {
+ LI.print(OS);
}
diff --git a/lib/Analysis/LoopVR.cpp b/lib/Analysis/LoopVR.cpp
index bae02015c6..573bd3ea01 100644
--- a/lib/Analysis/LoopVR.cpp
+++ b/lib/Analysis/LoopVR.cpp
@@ -228,8 +228,7 @@ void LoopVR::getAnalysisUsage(AnalysisUsage &AU) const {
bool LoopVR::runOnFunction(Function &F) { Map.clear(); return false; }
-void LoopVR::print(std::ostream &os, const Module *) const {
- raw_os_ostream OS(os);
+void LoopVR::print(raw_ostream &OS, const Module *) const {
for (std::map<Value *, ConstantRange *>::const_iterator I = Map.begin(),
E = Map.end(); I != E; ++I) {
OS << *I->first << ": " << *I->second << '\n';
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 69522e8a39..69d6b47bbe 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -41,9 +41,8 @@ PostDominatorTree::~PostDominatorTree() {
delete DT;
}
-void PostDominatorTree::print(std::ostream &OS, const Module *) const {
- raw_os_ostream OSS(OS);
- DT->print(OSS);
+void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
+ DT->print(OS);
}
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index d2c3f58e9c..d5849b0e1d 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -5193,7 +5193,3 @@ void ScalarEvolution::print(raw_ostream &OS, const Module* ) const {
PrintLoopInfo(OS, &SE, *I);
}
-void ScalarEvolution::print(std::ostream &o, const Module *M) const {
- raw_os_ostream OS(o);
- print(OS, M);
-}
diff --git a/lib/CodeGen/GCMetadata.cpp b/lib/CodeGen/GCMetadata.cpp
index a2a7fa192c..a57296c2a6 100644
--- a/lib/CodeGen/GCMetadata.cpp
+++ b/lib/CodeGen/GCMetadata.cpp
@@ -93,7 +93,7 @@ GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,
}
}
- cerr << "unsupported GC: " << Name << "\n";
+ errs() << "unsupported GC: " << Name << "\n";
llvm_unreachable(0);
}
diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp
index af5abad537..2529e4f1f3 100644
--- a/lib/CodeGen/GCStrategy.cpp
+++ b/lib/CodeGen/GCStrategy.cpp
@@ -29,6 +29,7 @@
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -108,7 +109,7 @@ GCStrategy::~GCStrategy() {
bool GCStrategy::initializeCustomLowering(Module &M) { return false; }
bool GCStrategy::performCustomLowering(Function &F) {
- cerr << "gc " << getName() << " must override performCustomLowering.\n";
+ errs() << "gc " << getName() << " must override performCustomLowering.\n";
llvm_unreachable(0);
return 0;
}
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index cf855f0e89..e3bbdb26ea 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -16,8 +16,9 @@
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
-#include "llvm/Support/IRBuilder.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/IRBuilder.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/SmallVector.h"
using namespace llvm;
@@ -396,8 +397,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
case Intrinsic::stacksave:
case Intrinsic::stackrestore: {
if (!Warned)
- cerr << "WARNING: this target does not support the llvm.stack"
- << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
+ errs() << "WARNING: this target does not support the llvm.stack"
+ << (Callee->getIntrinsicID() == Intrinsic::stacksave ?
"save" : "restore") << " intrinsic.\n";
Warned = true;
if (Callee->getIntrinsicID() == Intrinsic::stacksave)
@@ -407,8 +408,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
case Intrinsic::returnaddress:
case Intrinsic::frameaddress:
- cerr << "WARNING: this target does not support the llvm."
- << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
+ errs() << "WARNING: this target does not support the llvm."
+ << (Callee->getIntrinsicID() == Intrinsic::returnaddress ?
"return" : "frame") << "address intrinsic.\n";
CI->replaceAllUsesWith(ConstantPointerNull::get(
cast<PointerType>(CI->getType())));
@@ -420,8 +421,8 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
case Intrinsic::pcmarker:
break; // Simply strip out pcmarker on unsupported architectures
case Intrinsic::readcyclecounter: {
- cerr << "WARNING: this target does not support the llvm.readcyclecoun"
- << "ter intrinsic. It is being lowered to a constant 0\n";
+ errs() << "WARNING: this target does not support the llvm.readcyclecoun"
+ << "ter intrinsic. It is being lowered to a constant 0\n";
CI->replaceAllUsesWith(ConstantInt::get(Type::getInt64Ty(Context), 0));
break;
}
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index edd9536e2c..96afda47d5 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -516,8 +516,7 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
}
/// print - Implement the dump method.
-void LiveIntervals::print(std::ostream &O, const Module* ) const {
- raw_os_ostream OS(O);
+void LiveIntervals::print(raw_ostream &OS, const Module* ) const {
OS << "********** INTERVALS **********\n";
for (const_iterator I = begin(), E = end(); I != E; ++I) {
I->second->print(OS, tri_);
diff --git a/lib/CodeGen/LiveStackAnalysis.cpp b/lib/CodeGen/LiveStackAnalysis.cpp
index c89b70893f..a7bea1fd4f 100644
--- a/lib/CodeGen/LiveStackAnalysis.cpp
+++ b/lib/CodeGen/LiveStackAnalysis.cpp
@@ -53,8 +53,7 @@ bool LiveStacks::runOnMachineFunction(MachineFunction &) {
}
/// print - Implement the dump method.
-void LiveStacks::print(std::ostream &O, const Module*) const {
- raw_os_ostream OS(O);
+void LiveStacks::print(raw_ostream &OS, const Module*) const {
OS << "********** INTERVALS **********\n";
for (const_iterator I = begin(), E = end(); I != E; ++I) {
diff --git a/lib/CodeGen/MachineDominators.cpp b/lib/CodeGen/MachineDominators.cpp
index 78de02abc1..0f796f3952 100644
--- a/lib/CodeGen/MachineDominators.cpp
+++ b/lib/CodeGen/MachineDominators.cpp
@@ -52,7 +52,6 @@ void MachineDominatorTree::releaseMemory() {
DT->releaseMemory();
}
-void MachineDominatorTree::print(std::ostream &OS, const Module*) const {
- raw_os_ostream OSS(OS);
- DT->print(OSS);
+void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
+ DT->print(OS);
}
diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp
index fbab7e8be7..f12ad77eea 100644
--- a/lib/CodeGen/PreAllocSplitting.cpp
+++ b/lib/CodeGen/PreAllocSplitting.cpp
@@ -121,13 +121,10 @@ namespace {
}
/// print - Implement the dump method.
- virtual void print(std::ostream &O, const Module* M = 0) const {
+ virtual void print(raw_ostream &O, const Module* M = 0) const {
LIs->print(O, M);
}
- void print(std::ostream *O, const Module* M = 0) const {
- if (O) print(*O, M);
- }
private:
MachineBasicBlock::iterator
diff --git a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
index 7a1eeb23d2..60c3056902 100644
--- a/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
+++ b/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
@@ -69,8 +69,8 @@ CCState::AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
ISD::ArgFlagsTy ArgFlags = Ins[i].Flags;
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
#ifndef NDEBUG
- cerr << "Formal argument #" << i << " has unhandled type "
- << ArgVT.getEVTString();
+ errs() << "Formal argument #" << i << " has unhandled type "
+ << ArgVT.getEVTString();
#endif
llvm_unreachable(0);
}
@@ -87,8 +87,8 @@ void CCState::AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
if (Fn(i, VT, VT, CCValAssign::Full, ArgFlags, *this)) {
#ifndef NDEBUG
- cerr << "Return operand #" << i << " has unhandled type "
- << VT.getEVTString();
+ errs() << "Return operand #" << i << " has unhandled type "
+ << VT.getEVTString();
#endif
llvm_unreachable(0);
}
@@ -106,8 +106,8 @@ void CCState::AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
ISD::ArgFlagsTy ArgFlags = Outs[i].Flags;
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
#ifndef NDEBUG
- cerr << "Call operand #" << i << " has unhandled type "
- << ArgVT.getEVTString();
+ errs() << "Call operand #" << i << " has unhandled type "
+ << ArgVT.getEVTString();
#endif
llvm_unreachable(0);
}
@@ -125,8 +125,8 @@ void CCState::AnalyzeCallOperands(SmallVectorImpl<EVT> &ArgVTs,
ISD::ArgFlagsTy ArgFlags = Flags[i];
if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) {
#ifndef NDEBUG
- cerr << "Call operand #" << i << " has unhandled type "
- << ArgVT.getEVTString();
+ errs() << "Call operand #" << i << " has unhandled type "
+ << ArgVT.getEVTString();
#endif
llvm_unreachable(0);
}
@@ -142,8 +142,8 @@ void CCState::AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
ISD::ArgFlagsTy Flags = Ins[i].Flags;
if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) {
#ifndef NDEBUG
- cerr << "Call result #" << i << " has unhandled type "
- << VT.getEVTString();
+ errs() << "Call result #" << i << " has unhandled type "
+ << VT.getEVTString();
#endif
llvm_unreachable(0);
}
@@ -155,8 +155,8 @@ void CCState::AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
void CCState::AnalyzeCallResult(EVT VT, CCAssignFn Fn) {
if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) {
#ifndef NDEBUG
- cerr << "Call result has unhandled type "
- << VT.getEVTString();
+ errs() << "Call result has unhandled type "
+ << VT.getEVTString();
#endif
llvm_unreachable(0);
}
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 9341212495..10f7b3206b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -35,6 +35,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -950,7 +951,9 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
switch (Node->getOpcode()) {
default:
#ifndef NDEBUG
- cerr << "NODE: "; Node->dump(&DAG); cerr << "\n";
+ errs() << "NODE: ";
+ Node->dump(&DAG);
+ errs() << "\n";
#endif
llvm_unreachable("Do not know how to legalize this operator!");
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index cc8d565768..ded913ba6e 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -659,7 +659,7 @@ bool SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
if (!Erased && N->getValueType(N->getNumValues()-1) != MVT::Flag &&
!N->isMachineOpcode() && !doNotCSE(N)) {
N->dump(this);
- cerr << "\n";
+ errs() << "\n";
llvm_unreachable("Node is not in map!");
}
#endif
@@ -5644,16 +5644,17 @@ static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
if (N->getOperand(i).getNode()->hasOneUse())
DumpNodes(N->getOperand(i).getNode(), indent+2, G);
else
- cerr << "\n" << std::string(indent+2, ' ')
- << (void*)N->getOperand(i).getNode() << ": <multiple use>";
+ errs() << "\n" << std::string(indent+2, ' ')
+ << (void*)N->getOperand(i).getNode() << ": <multiple use>";
- cerr << "\n" << std::string(indent, ' ');
+ errs() << "\n";
+ errs().indent(indent);
N->dump(G);
}
void SelectionDAG::dump() const {
- cerr << "SelectionDAG has " << AllNodes.size() << " nodes:";
+ errs() << "SelectionDAG has " << AllNodes.size() << " nodes:";
for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end();
I != E; ++I) {
@@ -5664,7 +5665,7 @@ void SelectionDAG::dump() const {
if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this);
- cerr << "\n\n";
+ errs() << "\n\n";
}
void SDNode::printr(raw_ostream &OS, const SelectionDAG *G) const {
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 84e3c32023..2956e34a33 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -2792,7 +2792,7 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
}
/// print - Implement the dump method.
-void SimpleRegisterCoalescing::print(std::ostream &O, const Module* m) const {
+void SimpleRegisterCoalescing::print(raw_ostream &O, const Module* m) const {
li_->print(O, m);
}
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.h b/lib/CodeGen/SimpleRegisterCoalescing.h
index c7a5df4cb8..1830353615 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.h
+++ b/lib/CodeGen/SimpleRegisterCoalescing.h
@@ -137,10 +137,7 @@ namespace llvm {
}
/// print - Implement the dump method.
- virtual void print(std::ostream &O, const Module* = 0) const;
- void print(std::ostream *O, const Module* M = 0) const {
- if (O) print(*O, M);
- }
+ virtual void print(raw_ostream &O, const Module* = 0) const;
private:
/// joinIntervals - join compatible live intervals
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 2a3da45371..423e90d993 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/ConstantRange.cpp
@@ -597,9 +597,4 @@ void ConstantRange::dump() const {
print(errs());
}
-std::ostream &llvm::operator<<(std::ostream &o,
- const ConstantRange &CR) {
- raw_os_ostream OS(o);
- OS << CR;
- return o;
-}
+
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index b77a35f629..ad9bbe1d31 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -2635,7 +2635,7 @@ PPCTargetLowering::LowerCall_SVR4(SDValue Chain, SDValue Callee,
if (Result) {
#ifndef NDEBUG
- cerr << "Call operand #" << i << " has unhandled type "
+ errs() << "Call operand #" << i << " has unhandled type "
<< ArgVT.getEVTString() << "\n";
#endif
llvm_unreachable(0);
diff --git a/lib/Transforms/Utils/AddrModeMatcher.cpp b/lib/Transforms/Utils/AddrModeMatcher.cpp
index c47e0ff50b..135a621f5d 100644
--- a/lib/Transforms/Utils/AddrModeMatcher.cpp
+++ b/lib/Transforms/Utils/AddrModeMatcher.cpp
@@ -55,7 +55,7 @@ void ExtAddrMode::print(raw_ostream &OS) const {
void ExtAddrMode::dump() const {
print(errs());
- cerr << '\n';
+ errs() << '\n';
}
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index e3bcbb7542..bb73aaf705 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -48,9 +48,8 @@ bool DominatorTree::runOnFunction(Function &F) {
return false;
}
-void DominatorTree::print(std::ostream &OS, const Module *) const {
- raw_os_ostream OSS(OS);
- DT->print(OSS);
+void DominatorTree::print(raw_ostream &OS, const Module *) const {
+ DT->print(OS);
}
@@ -264,8 +263,7 @@ DominanceFrontier::calculate(const DominatorTree &DT,
return *Result;
}
-void DominanceFrontierBase::print(std::ostream &O, const Module* ) const {
- raw_os_ostream OS(O);
+void DominanceFrontierBase::print(raw_ostream &OS, const Module* ) const {
for (const_iterator I = begin(), E = end(); I != E; ++I) {
OS << " DomFrontier for BB";
if (I->first)
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index d82389d99d..e2a8d744e3 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -19,6 +19,7 @@
#include "llvm/ModuleProvider.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Atomic.h"
#include "llvm/System/Mutex.h"
#include "llvm/System/Threading.h"
@@ -45,7 +46,7 @@ bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const {
// dumpPassStructure - Implement the -debug-passes=Structure option
void Pass::dumpPassStructure(unsigned Offset) {
- cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
+ errs().indent(Offset*2) << getPassName() << "\n";
}
/// getPassName - Return a nice clean name for a pass. This usually
@@ -62,13 +63,13 @@ const char *Pass::getPassName() const {
// to print out the contents of an analysis. Otherwise it is not necessary to
// implement this method.
//
-void Pass::print(std::ostream &O,const Module*) const {
+void Pass::print(raw_ostream &O,const Module*) const {
O << "Pass::print not implemented for pass: '" << getPassName() << "'!\n";
}
// dump - call print(cerr);
void Pass::dump() const {
- print(*cerr.stream(), 0);
+ print(errs(), 0);
}
//===----------------------------------------------------------------------===//