diff options
Diffstat (limited to 'lib')
31 files changed, 291 insertions, 278 deletions
diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index 3eab452d40..f1bd7c1d17 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -19,7 +19,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/Streams.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; static cl::opt<bool> @@ -165,10 +165,10 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) { } if (PrintAll || (PrintAllFailures && R == ModRef)) { - cerr << MRString << ": Ptr: "; - cerr << "[" << Size << "B] "; - WriteAsOperand(*cerr.stream(), P, true, M); - cerr << "\t<->" << *CS.getInstruction(); + errs() << MRString << ": Ptr: "; + errs() << "[" << Size << "B] "; + WriteAsOperand(errs(), P, true, M); + errs() << "\t<->" << *CS.getInstruction(); } return R; } diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index 73f50d741c..2364d984f9 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -44,19 +44,21 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { if (ShortNames && !Node->getName().empty()) return Node->getNameStr() + ":"; - std::ostringstream Out; + std::string Str; + raw_string_ostream OS(Str); + if (ShortNames) { - WriteAsOperand(Out, Node, false); - return Out.str(); + WriteAsOperand(OS, Node, false); + return OS.str(); } if (Node->getName().empty()) { - WriteAsOperand(Out, Node, false); - Out << ":"; + WriteAsOperand(OS, Node, false); + OS << ":"; } - - Out << *Node; - std::string OutStr = Out.str(); + + OS << *Node; + std::string OutStr = OS.str(); if (OutStr[0] == '\n') OutStr.erase(OutStr.begin()); // Process string output to make it nicer... diff --git a/lib/Analysis/IVUsers.cpp b/lib/Analysis/IVUsers.cpp index 00622d360a..08e9969e6a 100644 --- a/lib/Analysis/IVUsers.cpp +++ b/lib/Analysis/IVUsers.cpp @@ -228,14 +228,14 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) { if (LI->getLoopFor(User->getParent()) != L) { if (isa<PHINode>(User) || Processed.count(User) || !AddUsersIfInteresting(User)) { - DOUT << "FOUND USER in other loop: " << *User << '\n' - << " OF SCEV: " << *ISE << "\n"; + DEBUG(errs() << "FOUND USER in other loop: " << *User << '\n' + << " OF SCEV: " << *ISE << '\n'); AddUserToIVUsers = true; } } else if (Processed.count(User) || !AddUsersIfInteresting(User)) { - DOUT << "FOUND USER: " << *User << '\n' - << " OF SCEV: " << *ISE << "\n"; + DEBUG(errs() << "FOUND USER: " << *User << '\n' + << " OF SCEV: " << *ISE << '\n'); AddUserToIVUsers = true; } diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp index c5a65f0685..b0db671724 100644 --- a/lib/Analysis/InstCount.cpp +++ b/lib/Analysis/InstCount.cpp @@ -18,7 +18,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/InstVisitor.h" -#include "llvm/Support/Streams.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -47,7 +47,7 @@ namespace { #include "llvm/Instruction.def" void visitInstruction(Instruction &I) { - cerr << "Instruction Count does not know about " << I; + errs() << "Instruction Count does not know about " << I; llvm_unreachable(0); } public: diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp index 16b1947230..6a6b1b2048 100644 --- a/lib/Analysis/Interval.cpp +++ b/lib/Analysis/Interval.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/Interval.h" #include "llvm/BasicBlock.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/raw_ostream.h" #include <algorithm> using namespace llvm; @@ -29,29 +30,30 @@ bool Interval::isLoop() const { // There is a loop in this interval iff one of the predecessors of the header // node lives in the interval. for (::pred_iterator I = ::pred_begin(HeaderNode), E = ::pred_end(HeaderNode); - I != E; ++I) { - if (contains(*I)) return true; - } + I != E; ++I) + if (contains(*I)) + return true; return false; } -void Interval::print(std::ostream &o) const { - o << "-------------------------------------------------------------\n" +void Interval::print(std::ostream &O) const { + raw_os_ostream OS(O); + OS << "-------------------------------------------------------------\n" << "Interval Contents:\n"; // Print out all of the basic blocks in the interval... for (std::vector<BasicBlock*>::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) - o << **I << "\n"; + OS << **I << "\n"; - o << "Interval Predecessors:\n"; + OS << "Interval Predecessors:\n"; for (std::vector<BasicBlock*>::const_iterator I = Predecessors.begin(), E = Predecessors.end(); I != E; ++I) - o << **I << "\n"; + OS << **I << "\n"; - o << "Interval Successors:\n"; + OS << "Interval Successors:\n"; for (std::vector<BasicBlock*>::const_iterator I = Successors.begin(), E = Successors.end(); I != E; ++I) - o << **I << "\n"; + OS << **I << "\n"; } diff --git a/lib/Analysis/SparsePropagation.cpp b/lib/Analysis/SparsePropagation.cpp index 887982b1d7..8db607189c 100644 --- a/lib/Analysis/SparsePropagation.cpp +++ b/lib/Analysis/SparsePropagation.cpp @@ -29,7 +29,7 @@ using namespace llvm; AbstractLatticeFunction::~AbstractLatticeFunction() {} /// PrintValue - Render the specified lattice value to the specified stream. -void AbstractLatticeFunction::PrintValue(LatticeVal V, std::ostream &OS) { +void AbstractLatticeFunction::PrintValue(LatticeVal V, raw_ostream &OS) { if (V == UndefVal) OS << "undefined"; else if (V == OverdefinedVal) @@ -312,7 +312,7 @@ void SparseSolver::Solve(Function &F) { } } -void SparseSolver::Print(Function &F, std::ostream &OS) const { +void SparseSolver::Print(Function &F, raw_ostream &OS) const { OS << "\nFUNCTION: " << F.getNameStr() << "\n"; for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { if (!BBExecutable.count(BB)) diff --git a/lib/Analysis/Trace.cpp b/lib/Analysis/Trace.cpp index 31c7a19ff6..c9b303b48b 100644 --- a/lib/Analysis/Trace.cpp +++ b/lib/Analysis/Trace.cpp @@ -18,7 +18,7 @@ #include "llvm/Analysis/Trace.h" #include "llvm/Function.h" #include "llvm/Assembly/Writer.h" -#include "llvm/Support/Streams.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; Function *Trace::getFunction() const { @@ -31,8 +31,8 @@ Module *Trace::getModule() const { /// print - Write trace to output stream. /// -void Trace::print(std::ostream &O) const { - Function *F = getFunction (); +void Trace::print(raw_ostream &O) const { + Function *F = getFunction(); O << "; Trace from function " << F->getNameStr() << ", blocks:\n"; for (const_iterator i = begin(), e = end(); i != e; ++i) { O << "; "; @@ -46,5 +46,5 @@ void Trace::print(std::ostream &O) const { /// output stream. /// void Trace::dump() const { - print(cerr); + print(errs()); } diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp index 1a7734fe7c..73b15edba3 100644 --- a/lib/CodeGen/MachOWriter.cpp +++ b/lib/CodeGen/MachOWriter.cpp @@ -634,7 +634,7 @@ void MachOWriter::InitMem(const Constant *C, uintptr_t Offset, } case Instruction::Add: default: - cerr << "ConstantExpr not handled as global var init: " << *CE << "\n"; + errs() << "ConstantExpr not handled as global var init: " << *CE <<"\n"; llvm_unreachable(0); } } else if (PC->getType()->isSingleValueType()) { @@ -732,7 +732,7 @@ void MachOWriter::InitMem(const Constant *C, uintptr_t Offset, WorkList.push_back(CPair(CPS->getOperand(i), PA+SL->getElementOffset(i))); } else { - cerr << "Bad Type: " << *PC->getType() << "\n"; + errs() << "Bad Type: " << *PC->getType() << "\n"; llvm_unreachable("Unknown constant type to initialize memory with!"); } } diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 45180c91f0..31210a7eab 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -26,7 +26,6 @@ #include "llvm/Support/MathExtras.h" #include <algorithm> #include <cmath> -#include <cstring> using namespace llvm; STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed"); @@ -57,7 +56,7 @@ static void executeFAddInst(GenericValue &Dest, GenericValue Src1, IMPLEMENT_BINARY_OPERATOR(+, Float); IMPLEMENT_BINARY_OPERATOR(+, Double); default: - cerr << "Unhandled type for FAdd instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FAdd instruction: " << *Ty << "\n"; llvm_unreachable(0); } } @@ -68,7 +67,7 @@ static void executeFSubInst(GenericValue &Dest, GenericValue Src1, IMPLEMENT_BINARY_OPERATOR(-, Float); IMPLEMENT_BINARY_OPERATOR(-, Double); default: - cerr << "Unhandled type for FSub instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FSub instruction: " << *Ty << "\n"; llvm_unreachable(0); } } @@ -79,7 +78,7 @@ static void executeFMulInst(GenericValue &Dest, GenericValue Src1, IMPLEMENT_BINARY_OPERATOR(*, Float); IMPLEMENT_BINARY_OPERATOR(*, Double); default: - cerr << "Unhandled type for FMul instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FMul instruction: " << *Ty << "\n"; llvm_unreachable(0); } } @@ -90,7 +89,7 @@ static void executeFDivInst(GenericValue &Dest, GenericValue Src1, IMPLEMENT_BINARY_OPERATOR(/, Float); IMPLEMENT_BINARY_OPERATOR(/, Double); default: - cerr << "Unhandled type for FDiv instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FDiv instruction: " << *Ty << "\n"; llvm_unreachable(0); } } @@ -105,7 +104,7 @@ static void executeFRemInst(GenericValue &Dest, GenericValue Src1, Dest.DoubleVal = fmod(Src1.DoubleVal, Src2.DoubleVal); break; default: - cerr << "Unhandled type for Rem instruction: " << *Ty << "\n"; + errs() << "Unhandled type for Rem instruction: " << *Ty << "\n"; llvm_unreachable(0); } } @@ -132,7 +131,7 @@ static GenericValue executeICMP_EQ(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(eq,Ty); IMPLEMENT_POINTER_ICMP(==); default: - cerr << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -145,7 +144,7 @@ static GenericValue executeICMP_NE(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(ne,Ty); IMPLEMENT_POINTER_ICMP(!=); default: - cerr << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -158,7 +157,7 @@ static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(ult,Ty); IMPLEMENT_POINTER_ICMP(<); default: - cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -171,7 +170,7 @@ static GenericValue executeICMP_SLT(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(slt,Ty); IMPLEMENT_POINTER_ICMP(<); default: - cerr << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -184,7 +183,7 @@ static GenericValue executeICMP_UGT(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(ugt,Ty); IMPLEMENT_POINTER_ICMP(>); default: - cerr << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -197,7 +196,7 @@ static GenericValue executeICMP_SGT(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(sgt,Ty); IMPLEMENT_POINTER_ICMP(>); default: - cerr << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -210,7 +209,7 @@ static GenericValue executeICMP_ULE(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(ule,Ty); IMPLEMENT_POINTER_ICMP(<=); default: - cerr << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -223,7 +222,7 @@ static GenericValue executeICMP_SLE(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(sle,Ty); IMPLEMENT_POINTER_ICMP(<=); default: - cerr << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -236,7 +235,7 @@ static GenericValue executeICMP_UGE(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(uge,Ty); IMPLEMENT_POINTER_ICMP(>=); default: - cerr << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -249,7 +248,7 @@ static GenericValue executeICMP_SGE(GenericValue Src1, GenericValue Src2, IMPLEMENT_INTEGER_ICMP(sge,Ty); IMPLEMENT_POINTER_ICMP(>=); default: - cerr << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n"; + errs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -274,7 +273,7 @@ void Interpreter::visitICmpInst(ICmpInst &I) { case ICmpInst::ICMP_UGE: R = executeICMP_UGE(Src1, Src2, Ty); break; case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break; default: - cerr << "Don't know how to handle this ICmp predicate!\n-->" << I; + errs() << "Don't know how to handle this ICmp predicate!\n-->" << I; llvm_unreachable(0); } @@ -293,7 +292,7 @@ static GenericValue executeFCMP_OEQ(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(==, Float); IMPLEMENT_FCMP(==, Double); default: - cerr << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -307,7 +306,7 @@ static GenericValue executeFCMP_ONE(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(!=, Double); default: - cerr << "Unhandled type for FCmp NE instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -320,7 +319,7 @@ static GenericValue executeFCMP_OLE(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(<=, Float); IMPLEMENT_FCMP(<=, Double); default: - cerr << "Unhandled type for FCmp LE instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -333,7 +332,7 @@ static GenericValue executeFCMP_OGE(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(>=, Float); IMPLEMENT_FCMP(>=, Double); default: - cerr << "Unhandled type for FCmp GE instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -346,7 +345,7 @@ static GenericValue executeFCMP_OLT(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(<, Float); IMPLEMENT_FCMP(<, Double); default: - cerr << "Unhandled type for FCmp LT instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -359,7 +358,7 @@ static GenericValue executeFCMP_OGT(GenericValue Src1, GenericValue Src2, IMPLEMENT_FCMP(>, Float); IMPLEMENT_FCMP(>, Double); default: - cerr << "Unhandled type for FCmp GT instruction: " << *Ty << "\n"; + errs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n"; llvm_unreachable(0); } return Dest; @@ -468,7 +467,7 @@ void Interpreter::visitFCmpInst(FCmpInst &I) { case FCmpInst::FCMP_UGE: R = executeFCMP_UGE(Src1, Src2, Ty); break; case FCmpInst::FCMP_OGE: R = executeFCMP_OGE(Src1, Src2, Ty); break; default: - cerr << "Don't know how to handle this FCmp predicate!\n-->" << I; + errs() << "Don't know how to handle this FCmp predicate!\n-->" << I; llvm_unreachable(0); } @@ -514,7 +513,7 @@ static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1, return Result; } default: - cerr << "Unhandled Cmp predicate\n"; + errs() << "Unhandled Cmp predicate\n"; llvm_unreachable(0); } } @@ -543,7 +542,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) { case Instruction::Or: R.IntVal = Src1.IntVal | Src2.IntVal; break; case Instruction::Xor: R.IntVal = Src1.IntVal ^ Src2.IntVal; break; default: - cerr << "Don't know how to handle this binary operator!\n-->" << I; + errs() << "Don't know how to handle this binary operator!\n-->" << I; llvm_unreachable(0); } @@ -814,7 +813,7 @@ void Interpreter::visitLoadInst(LoadInst &I) { LoadValueFromMemory(Result, Ptr, I.getType()); SetValue(&I, Result, SF); if (I.isVolatile() && PrintVolatile) - cerr << "Volatile load " << I; + errs() << "Volatile load " << I; } void Interpreter::visitStoreInst(StoreInst &I) { @@ -824,7 +823,7 @@ void Interpreter::visitStoreInst(StoreInst &I) { StoreValueToMemory(Val, (GenericValue *)GVTOP(SRC), I.getOperand(0)->getType()); if (I.isVolatile() && PrintVolatile) - cerr << "Volatile store: " << I; + errs() << "Volatile store: " << I; } //===----------------------------------------------------------------------===// @@ -1178,7 +1177,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) { IMPLEMENT_VAARG(Float); IMPLEMENT_VAARG(Double); default: - cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n"; + errs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n"; llvm_unreachable(0); } @@ -1265,7 +1264,7 @@ GenericValue Interpreter::getConstantExprValue (ConstantExpr *CE, Dest.IntVal = Op0.IntVal.ashr(Op1.IntVal.getZExtValue()); break; default: - cerr << "Unhandled ConstantExpr: " << *CE << "\n"; + errs() << "Unhandled ConstantExpr: " << *CE << "\n"; llvm_unreachable(0); return GenericValue(); } @@ -1338,30 +1337,29 @@ void Interpreter::run() { // Track the number of dynamic instructions executed. ++NumDynamicInsts; - DOUT << "About to interpret: " << I; + DEBUG(errs() << "About to interpret: " << I); visit(I); // Dispatch to one of the visit* methods... #if 0 // This is not safe, as visiting the instruction could lower it and free I. -#ifndef NDEBUG +DEBUG( if (!isa<CallInst>(I) && !isa<InvokeInst>(I) && I.getType() != Type::VoidTy) { - DOUT << " --> "; + errs() << " --> "; const GenericValue &Val = SF.Values[&I]; switch (I.getType()->getTypeID()) { default: llvm_unreachable("Invalid GenericValue Type"); - case Type::VoidTyID: DOUT << "void"; break; - case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; - case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; - case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); + case Type::VoidTyID: errs() << "void"; break; + case Type::FloatTyID: errs() << "float " << Val.FloatVal; break; + case Type::DoubleTyID: errs() << "double " << Val.DoubleVal; break; + case Type::PointerTyID: errs() << "void* " << intptr_t(Val.PointerVal); break; case Type::IntegerTyID: - DOUT << "i" << Val.IntVal.getBitWidth() << " " - << Val.IntVal.toStringUnsigned(10) - << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; + errs() << "i" << Val.IntVal.getBitWidth() << " " + << Val.IntVal.toStringUnsigned(10) + << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; break; } - } -#endif + }); #endif } } diff --git a/lib/ExecutionEngine/Interpreter/Interpreter.h b/lib/ExecutionEngine/Interpreter/Interpreter.h index 10e53e9a14..e026287bb5 100644 --- a/lib/ExecutionEngine/Interpreter/Interpreter.h +++ b/lib/ExecutionEngine/Interpreter/Interpreter.h @@ -17,12 +17,12 @@ #include "llvm/Function.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" -#include "llvm/Support/InstVisitor.h" -#include "llvm/Support/CallSite.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ErrorHandling.h" - +#include "llvm/Support/InstVisitor.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { class IntrinsicLowering; @@ -174,7 +174,7 @@ public: void visitVAArgInst(VAArgInst &I); void visitInstruction(Instruction &I) { - cerr << I; + errs() << I; llvm_unreachable("Instruction not interpretable yet!"); } diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index ca0bf73002..effba471e0 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -25,7 +25,6 @@ #include "llvm/ValueSymbolTable.h" #include "llvm/Instructions.h" #include "llvm/Assembly/Writer.h" -#include "llvm/Support/Streams.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/System/Path.h" #include "llvm/ADT/DenseMap.h" @@ -145,7 +144,7 @@ protected: // for debugging... virtual void dump() const { - cerr << "AbstractTypeSet!\n"; + errs() << "AbstractTypeSet!\n"; } }; } @@ -338,11 +337,11 @@ static bool LinkTypes(Module *Dest, const Module *Src, std::string *Err) { static void PrintMap(const std::map<const Value*, Value*> &M) { for (std::map<const Value*, Value*>::const_iterator I = M.begin(), E =M.end(); I != E; ++I) { - cerr << " Fr: " << (void*)I->first << " "; + errs() << " Fr: " << (void*)I->first << " "; I->first->dump(); - cerr << " To: " << (void*)I->second << " "; + errs() << " To: " << (void*)I->second << " "; I->second->dump(); - cerr << "\n"; + errs() << "\n"; } } #endif @@ -414,10 +413,10 @@ static Value *RemapOperand(const Value *In, } #ifndef NDEBUG - cerr << "LinkModules ValueMap: \n"; + errs() << "LinkModules ValueMap: \n"; PrintMap(ValueMap); - cerr << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; + errs() << "Couldn't remap value: " << (void*)In << " " << *In << "\n"; llvm_unreachable("Couldn't remap value!"); #endif return 0; @@ -1280,10 +1279,10 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { if (!Src->getDataLayout().empty() && !Dest->getDataLayout().empty() && Src->getDataLayout() != Dest->getDataLayout()) - cerr << "WARNING: Linking two modules of different data layouts!\n"; + errs() << "WARNING: Linking two modules of different data layouts!\n"; if (!Src->getTargetTriple().empty() && Dest->getTargetTriple() != Src->getTargetTriple()) - cerr << "WARNING: Linking two modules of different target triples!\n"; + errs() << "WARNING: Linking two modules of different target triples!\n"; // Append the module inline asm string. if (!Src->getModuleInlineAsm().empty()) { diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 8099bb3e3b..6fea22f14d 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -319,7 +319,7 @@ namespace { void visitInstruction(Instruction &I) { #ifndef NDEBUG - cerr << "C Writer does not know about " << I; + errs() << "C Writer does not know about " << I; #endif llvm_unreachable(0); } @@ -506,7 +506,7 @@ CWriter::printSimpleType(formatted_raw_ostream &Out, const Type *Ty, default: #ifndef NDEBUG - cerr << "Unknown primitive type: " << *Ty << "\n"; + errs() << "Unknown primitive type: " << *Ty << "\n"; #endif llvm_unreachable(0); } @@ -553,7 +553,7 @@ CWriter::printSimpleType(std::ostream &Out, const Type *Ty, bool isSigned, default: #ifndef NDEBUG - cerr << "Unknown primitive type: " << *Ty << "\n"; + errs() << "Unknown primitive type: " << *Ty << "\n"; #endif llvm_unreachable(0); } @@ -1110,7 +1110,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) { } default: #ifndef NDEBUG - cerr << "CWriter Error: Unhandled constant expression: " + errs() << "CWriter Error: Unhandled constant expression: " << *CE << "\n"; #endif llvm_unreachable(0); @@ -1323,7 +1323,7 @@ void CWriter::printConstant(Constant *CPV, bool Static) { // FALL THROUGH default: #ifndef NDEBUG - cerr << "Unknown constant type: " << *CPV << "\n"; + errs() << "Unknown constant type: " << *CPV << "\n"; #endif llvm_unreachable(0); } @@ -2735,7 +2735,7 @@ void CWriter::visitBinaryOperator(Instruction &I) { case Instruction::AShr: Out << " >> "; break; default: #ifndef NDEBUG - cerr << "Invalid operator type!" << I; + errs() << "Invalid operator type!" << I; #endif llvm_unreachable(0); } @@ -2776,7 +2776,7 @@ void CWriter::visitICmpInst(ICmpInst &I) { case ICmpInst::ICMP_SGT: Out << " > "; break; default: #ifndef NDEBUG - cerr << "Invalid icmp predicate!" << I; + errs() << "Invalid icmp predicate!" << I; #endif llvm_unreachable(0); } |