From 79c5d3f9717756dc3ff56cfcaa3ae1a5930c457a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 23 Aug 2009 04:52:46 +0000 Subject: [PATCH] remove the std::ostream version of module and type printing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79823 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Module.h | 7 +------ include/llvm/Type.h | 2 -- lib/ExecutionEngine/ExecutionEngine.cpp | 4 ++-- lib/ExecutionEngine/Interpreter/Execution.cpp | 8 ++++---- lib/Transforms/Scalar/Reassociate.cpp | 6 +++--- lib/VMCore/AsmWriter.cpp | 9 --------- lib/VMCore/Type.cpp | 13 ------------- tools/llvm-prof/llvm-prof.cpp | 2 +- 8 files changed, 11 insertions(+), 40 deletions(-) diff --git a/include/llvm/Module.h b/include/llvm/Module.h index aa91af1a4ab..501625df7a3 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -468,7 +468,6 @@ public: public: /// Print the module to an output stream with AssemblyAnnotationWriter. void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const; - void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Dump the module to stderr (for debugging). void dump() const; @@ -482,11 +481,7 @@ public: /// @} }; -/// An iostream inserter for modules. -inline std::ostream &operator<<(std::ostream &O, const Module &M) { - M.print(O, 0); - return O; -} +/// An raw_ostream inserter for modules. inline raw_ostream &operator<<(raw_ostream &O, const Module &M) { M.print(O, 0); return O; diff --git a/include/llvm/Type.h b/include/llvm/Type.h index b7516323c58..94ebf1e521b 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -168,7 +168,6 @@ protected: public: void print(raw_ostream &O) const; - void print(std::ostream &O) const; /// @brief Debugging support: print to stderr void dump() const; @@ -485,7 +484,6 @@ template <> inline bool isa_impl(const Type &Ty) { return Ty.getTypeID() == Type::PointerTyID; } -std::ostream &operator<<(std::ostream &OS, const Type &T); raw_ostream &operator<<(raw_ostream &OS, const Type &T); } // End llvm namespace diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index a20122d9f9c..644740f71a4 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -814,7 +814,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, *((PointerTy*)Ptr) = Val.PointerVal; break; default: - cerr << "Cannot store value of type " << *Ty << "!\n"; + errs() << "Cannot store value of type " << *Ty << "!\n"; } if (sys::isLittleEndianHost() != getTargetData()->isLittleEndian()) @@ -930,7 +930,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { return; } - cerr << "Bad Type: " << *Init->getType() << "\n"; + errs() << "Bad Type: " << *Init->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 31210a7eabf..bb45b2c441b 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -737,9 +737,9 @@ void Interpreter::visitAllocationInst(AllocationInst &I) { // Allocate enough memory to hold the type... void *Memory = malloc(MemToAlloc); - DOUT << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x " - << NumElements << " (Total: " << MemToAlloc << ") at " - << uintptr_t(Memory) << '\n'; + DEBUG(errs() << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x " + << NumElements << " (Total: " << MemToAlloc << ") at " + << uintptr_t(Memory) << '\n'); GenericValue Result = PTOGV(Memory); assert(Result.PointerVal != 0 && "Null pointer returned by malloc!"); @@ -795,7 +795,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I, GenericValue Result; Result.PointerVal = ((char*)getOperandValue(Ptr, SF).PointerVal) + Total; - DOUT << "GEP Index " << Total << " bytes.\n"; + DEBUG(errs() << "GEP Index " << Total << " bytes.\n"); return Result; } diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index f6e11bc646f..9ef4ea8ffef 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -62,11 +62,11 @@ namespace { /// static void PrintOps(Instruction *I, const std::vector &Ops) { Module *M = I->getParent()->getParent()->getParent(); - cerr << Instruction::getOpcodeName(I->getOpcode()) << " " + errs() << Instruction::getOpcodeName(I->getOpcode()) << " " << *Ops[0].Op->getType(); for (unsigned i = 0, e = Ops.size(); i != e; ++i) { - WriteAsOperand(*cerr.stream() << " ", Ops[i].Op, false, M); - cerr << "," << Ops[i].Rank; + WriteAsOperand(errs() << " ", Ops[i].Op, false, M); + errs() << "," << Ops[i].Rank; } } #endif diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 696cd6f5c47..dc72031482b 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -1999,10 +1999,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) { // External Interface declarations //===----------------------------------------------------------------------===// -void Module::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const { - raw_os_ostream OS(o); - print(OS, AAW); -} void Module::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const { SlotTracker SlotTable(this); formatted_raw_ostream OS(ROS); @@ -2010,11 +2006,6 @@ void Module::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const { W.write(this); } -void Type::print(std::ostream &o) const { - raw_os_ostream OS(o); - print(OS); -} - void Type::print(raw_ostream &OS) const { if (this == 0) { OS << ""; diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 3f64e81f92f..36dcbccdce7 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -1208,19 +1208,6 @@ bool SequentialType::indexValid(const Value *V) const { } namespace llvm { -std::ostream &operator<<(std::ostream &OS, const Type *T) { - if (T == 0) - OS << " value!\n"; - else - T->print(OS); - return OS; -} - -std::ostream &operator<<(std::ostream &OS, const Type &T) { - T.print(OS); - return OS; -} - raw_ostream &operator<<(raw_ostream &OS, const Type &T) { T.print(OS); return OS; diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 1950b49cc5e..4110370f3bc 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -238,7 +238,7 @@ bool ProfileInfoPrinterPass::runOnModule(Module &M) { ProfileAnnotator PA(PI); if (FunctionsToPrint.empty() || PrintAllCode) - M.print(std::cout, &PA); + M.print(outs(), &PA); else // Print just a subset of the functions. for (std::set::iterator I = FunctionsToPrint.begin(),