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
This commit is contained in:
Chris Lattner 2009-08-23 04:52:46 +00:00
parent 0c47a41207
commit 79c5d3f971
8 changed files with 11 additions and 40 deletions

View File

@ -468,7 +468,6 @@ public:
public: public:
/// Print the module to an output stream with AssemblyAnnotationWriter. /// Print the module to an output stream with AssemblyAnnotationWriter.
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const; void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const;
void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
/// Dump the module to stderr (for debugging). /// Dump the module to stderr (for debugging).
void dump() const; void dump() const;
@ -482,11 +481,7 @@ public:
/// @} /// @}
}; };
/// An iostream inserter for modules. /// An raw_ostream inserter for modules.
inline std::ostream &operator<<(std::ostream &O, const Module &M) {
M.print(O, 0);
return O;
}
inline raw_ostream &operator<<(raw_ostream &O, const Module &M) { inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
M.print(O, 0); M.print(O, 0);
return O; return O;

View File

@ -168,7 +168,6 @@ protected:
public: public:
void print(raw_ostream &O) const; void print(raw_ostream &O) const;
void print(std::ostream &O) const;
/// @brief Debugging support: print to stderr /// @brief Debugging support: print to stderr
void dump() const; void dump() const;
@ -485,7 +484,6 @@ template <> inline bool isa_impl<PointerType, Type>(const Type &Ty) {
return Ty.getTypeID() == Type::PointerTyID; return Ty.getTypeID() == Type::PointerTyID;
} }
std::ostream &operator<<(std::ostream &OS, const Type &T);
raw_ostream &operator<<(raw_ostream &OS, const Type &T); raw_ostream &operator<<(raw_ostream &OS, const Type &T);
} // End llvm namespace } // End llvm namespace

View File

@ -814,7 +814,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
*((PointerTy*)Ptr) = Val.PointerVal; *((PointerTy*)Ptr) = Val.PointerVal;
break; break;
default: default:
cerr << "Cannot store value of type " << *Ty << "!\n"; errs() << "Cannot store value of type " << *Ty << "!\n";
} }
if (sys::isLittleEndianHost() != getTargetData()->isLittleEndian()) if (sys::isLittleEndianHost() != getTargetData()->isLittleEndian())
@ -930,7 +930,7 @@ void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
return; return;
} }
cerr << "Bad Type: " << *Init->getType() << "\n"; errs() << "Bad Type: " << *Init->getType() << "\n";
llvm_unreachable("Unknown constant type to initialize memory with!"); llvm_unreachable("Unknown constant type to initialize memory with!");
} }

View File

@ -737,9 +737,9 @@ void Interpreter::visitAllocationInst(AllocationInst &I) {
// Allocate enough memory to hold the type... // Allocate enough memory to hold the type...
void *Memory = malloc(MemToAlloc); void *Memory = malloc(MemToAlloc);
DOUT << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x " DEBUG(errs() << "Allocated Type: " << *Ty << " (" << TypeSize << " bytes) x "
<< NumElements << " (Total: " << MemToAlloc << ") at " << NumElements << " (Total: " << MemToAlloc << ") at "
<< uintptr_t(Memory) << '\n'; << uintptr_t(Memory) << '\n');
GenericValue Result = PTOGV(Memory); GenericValue Result = PTOGV(Memory);
assert(Result.PointerVal != 0 && "Null pointer returned by malloc!"); assert(Result.PointerVal != 0 && "Null pointer returned by malloc!");
@ -795,7 +795,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
GenericValue Result; GenericValue Result;
Result.PointerVal = ((char*)getOperandValue(Ptr, SF).PointerVal) + Total; Result.PointerVal = ((char*)getOperandValue(Ptr, SF).PointerVal) + Total;
DOUT << "GEP Index " << Total << " bytes.\n"; DEBUG(errs() << "GEP Index " << Total << " bytes.\n");
return Result; return Result;
} }

View File

@ -62,11 +62,11 @@ namespace {
/// ///
static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) { static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) {
Module *M = I->getParent()->getParent()->getParent(); Module *M = I->getParent()->getParent()->getParent();
cerr << Instruction::getOpcodeName(I->getOpcode()) << " " errs() << Instruction::getOpcodeName(I->getOpcode()) << " "
<< *Ops[0].Op->getType(); << *Ops[0].Op->getType();
for (unsigned i = 0, e = Ops.size(); i != e; ++i) { for (unsigned i = 0, e = Ops.size(); i != e; ++i) {
WriteAsOperand(*cerr.stream() << " ", Ops[i].Op, false, M); WriteAsOperand(errs() << " ", Ops[i].Op, false, M);
cerr << "," << Ops[i].Rank; errs() << "," << Ops[i].Rank;
} }
} }
#endif #endif

View File

@ -1999,10 +1999,6 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
// External Interface declarations // 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 { void Module::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
SlotTracker SlotTable(this); SlotTracker SlotTable(this);
formatted_raw_ostream OS(ROS); formatted_raw_ostream OS(ROS);
@ -2010,11 +2006,6 @@ void Module::print(raw_ostream &ROS, AssemblyAnnotationWriter *AAW) const {
W.write(this); W.write(this);
} }
void Type::print(std::ostream &o) const {
raw_os_ostream OS(o);
print(OS);
}
void Type::print(raw_ostream &OS) const { void Type::print(raw_ostream &OS) const {
if (this == 0) { if (this == 0) {
OS << "<null Type>"; OS << "<null Type>";

View File

@ -1208,19 +1208,6 @@ bool SequentialType::indexValid(const Value *V) const {
} }
namespace llvm { namespace llvm {
std::ostream &operator<<(std::ostream &OS, const Type *T) {
if (T == 0)
OS << "<null> 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) { raw_ostream &operator<<(raw_ostream &OS, const Type &T) {
T.print(OS); T.print(OS);
return OS; return OS;

View File

@ -238,7 +238,7 @@ bool ProfileInfoPrinterPass::runOnModule(Module &M) {
ProfileAnnotator PA(PI); ProfileAnnotator PA(PI);
if (FunctionsToPrint.empty() || PrintAllCode) if (FunctionsToPrint.empty() || PrintAllCode)
M.print(std::cout, &PA); M.print(outs(), &PA);
else else
// Print just a subset of the functions. // Print just a subset of the functions.
for (std::set<Function*>::iterator I = FunctionsToPrint.begin(), for (std::set<Function*>::iterator I = FunctionsToPrint.begin(),