From 1838be30c70b2bb9ff8df3a7e50d038b64a7447b Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 17 Nov 2006 08:03:48 +0000 Subject: [PATCH] Removed iostream #includes. Replaced std::cerr with DOUT. llvm-svn: 31814 --- lib/VMCore/Constants.cpp | 12 +++---- lib/VMCore/Dominators.cpp | 1 - lib/VMCore/SymbolTable.cpp | 58 ++++++++++++++++----------------- lib/VMCore/Type.cpp | 47 +++++++++++++------------- lib/VMCore/Value.cpp | 8 ++--- lib/VMCore/ValueSymbolTable.cpp | 19 +++++------ 6 files changed, 71 insertions(+), 74 deletions(-) diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index ee855ca7322..d91e21841dd 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -19,11 +19,11 @@ #include "llvm/SymbolTable.h" #include "llvm/Module.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/MathExtras.h" #include -#include using namespace llvm; //===----------------------------------------------------------------------===// @@ -42,9 +42,9 @@ void Constant::destroyConstantImpl() { Value *V = use_back(); #ifndef NDEBUG // Only in -g mode... if (!isa(V)) - std::cerr << "While deleting: " << *this - << "\n\nUse still stuck around after Def is destroyed: " - << *V << "\n\n"; + DOUT << "While deleting: " << *this + << "\n\nUse still stuck around after Def is destroyed: " + << *V << "\n\n"; #endif assert(isa(V) && "References remain to Constant being destroyed"); Constant *CV = cast(V); @@ -870,7 +870,7 @@ public: } void dump() const { - std::cerr << "Constant.cpp: ValueMap\n"; + DOUT << "Constant.cpp: ValueMap\n"; } }; } diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index c3e0099ee02..3a6721aaabb 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -20,7 +20,6 @@ #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" #include -#include using namespace llvm; //===----------------------------------------------------------------------===// diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index b4f8a8820ed..06a43a7867a 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/lib/VMCore/SymbolTable.cpp @@ -16,9 +16,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/Debug.h" #include -#include - using namespace llvm; #define DEBUG_SYMBOL_TABLE 0 @@ -39,9 +38,9 @@ SymbolTable::~SymbolTable() { for (plane_iterator PI = pmap.begin(); PI != pmap.end(); ++PI) { for (value_iterator VI = PI->second.begin(); VI != PI->second.end(); ++VI) if (!isa(VI->second) ) { - std::cerr << "Value still in symbol table! Type = '" - << PI->first->getDescription() << "' Name = '" - << VI->first << "'\n"; + DOUT << "Value still in symbol table! Type = '" + << PI->first->getDescription() << "' Name = '" + << VI->first << "'\n"; LeftoverValues = false; } } @@ -136,7 +135,7 @@ void SymbolTable::remove(Value *N) { #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Removing Value: " << Entry->second->getName() << "\n"; + DOUT << " Removing Value: " << Entry->second->getName() << "\n"; #endif // Remove the value from the plane... @@ -149,8 +148,8 @@ void SymbolTable::remove(Value *N) { // if (N->getType()->isAbstract()) { #if DEBUG_ABSTYPE - std::cerr << "Plane Empty: Removing type: " - << N->getType()->getDescription() << "\n"; + DOUT << "Plane Empty: Removing type: " + << N->getType()->getDescription() << "\n"; #endif cast(N->getType())->removeAbstractTypeUser(this); } @@ -167,7 +166,7 @@ Type* SymbolTable::remove(type_iterator Entry) { #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Removing type: " << Entry->first << "\n"; + DOUT << " Removing type: " << Entry->first << "\n"; #endif tmap.erase(Entry); @@ -176,7 +175,8 @@ Type* SymbolTable::remove(type_iterator Entry) { // list... if (Result->isAbstract()) { #if DEBUG_ABSTYPE - std::cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n"; + DOUT << "Removing abstract type from symtab" + << Result->getDescription() << "\n"; #endif cast(Result)->removeAbstractTypeUser(this); } @@ -194,8 +194,8 @@ void SymbolTable::insertEntry(const std::string &Name, const Type *VTy, #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Inserting definition: " << Name << ": " - << VTy->getDescription() << "\n"; + DOUT << " Inserting definition: " << Name << ": " + << VTy->getDescription() << "\n"; #endif if (PI == pmap.end()) { // Not in collection yet... insert dummy entry @@ -210,8 +210,8 @@ void SymbolTable::insertEntry(const std::string &Name, const Type *VTy, if (VTy->isAbstract()) { cast(VTy)->addAbstractTypeUser(this); #if DEBUG_ABSTYPE - std::cerr << "Added abstract type value: " << VTy->getDescription() - << "\n"; + DOUT << "Added abstract type value: " << VTy->getDescription() + << "\n"; #endif } @@ -243,8 +243,8 @@ void SymbolTable::insert(const std::string& Name, const Type* T) { #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Inserting type: " << UniqueName << ": " - << T->getDescription() << "\n"; + DOUT << " Inserting type: " << UniqueName << ": " + << T->getDescription() << "\n"; #endif // Insert the tmap entry @@ -254,7 +254,7 @@ void SymbolTable::insert(const std::string& Name, const Type* T) { if (T->isAbstract()) { cast(T)->addAbstractTypeUser(this); #if DEBUG_ABSTYPE - std::cerr << "Added abstract type to ST: " << T->getDescription() << "\n"; + DOUT << "Added abstract type to ST: " << T->getDescription() << "\n"; #endif } } @@ -303,8 +303,8 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, if (NewType->isAbstract()) { cast(NewType)->addAbstractTypeUser(this); #if DEBUG_ABSTYPE - std::cerr << "[Added] refined to abstype: " << NewType->getDescription() - << "\n"; + DOUT << "[Added] refined to abstype: " << NewType->getDescription() + << "\n"; #endif } } @@ -368,7 +368,7 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, // Ok, now we are not referencing the type anymore... take me off your user // list please! #if DEBUG_ABSTYPE - std::cerr << "Removing type " << OldType->getDescription() << "\n"; + DOUT << "Removing type " << OldType->getDescription() << "\n"; #endif OldType->removeAbstractTypeUser(this); @@ -384,14 +384,14 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, for (type_iterator I = type_begin(), E = type_end(); I != E; ++I) { if (I->second == (Type*)OldType) { // FIXME when Types aren't const. #if DEBUG_ABSTYPE - std::cerr << "Removing type " << OldType->getDescription() << "\n"; + DOUT << "Removing type " << OldType->getDescription() << "\n"; #endif OldType->removeAbstractTypeUser(this); I->second = (Type*)NewType; // TODO FIXME when types aren't const if (NewType->isAbstract()) { #if DEBUG_ABSTYPE - std::cerr << "Added type " << NewType->getDescription() << "\n"; + DOUT << "Added type " << NewType->getDescription() << "\n"; #endif cast(NewType)->addAbstractTypeUser(this); } @@ -418,28 +418,28 @@ void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) { } static void DumpVal(const std::pair &V) { - std::cerr << " '" << V.first << "' = "; + DOUT << " '" << V.first << "' = "; V.second->dump(); - std::cerr << "\n"; + DOUT << "\n"; } static void DumpPlane(const std::pair >&P){ P.first->dump(); - std::cerr << "\n"; + DOUT << "\n"; for_each(P.second.begin(), P.second.end(), DumpVal); } static void DumpTypes(const std::pair& T ) { - std::cerr << " '" << T.first << "' = "; + DOUT << " '" << T.first << "' = "; T.second->dump(); - std::cerr << "\n"; + DOUT << "\n"; } void SymbolTable::dump() const { - std::cerr << "Symbol table dump:\n Plane:"; + DOUT << "Symbol table dump:\n Plane:"; for_each(pmap.begin(), pmap.end(), DumpPlane); - std::cerr << " Types: "; + DOUT << " Types: "; for_each(tmap.begin(), tmap.end(), DumpTypes); } diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 7ccf35a9736..fa948aaefae 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -23,7 +23,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/ManagedStatic.h" #include -#include using namespace llvm; // DEBUG_MERGE_TYPES - Enable this #define to see how and when derived types are @@ -487,7 +486,7 @@ PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) { OpaqueType::OpaqueType() : DerivedType(OpaqueTyID) { setAbstract(true); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << *this << "\n"; + DOUT << "Derived new type: " << *this << "\n"; #endif } @@ -831,8 +830,8 @@ public: void RefineAbstractType(TypeClass *Ty, const DerivedType *OldType, const Type *NewType) { #ifdef DEBUG_MERGE_TYPES - std::cerr << "RefineAbstractType(" << (void*)OldType << "[" << *OldType - << "], " << (void*)NewType << " [" << *NewType << "])\n"; + DOUT << "RefineAbstractType(" << (void*)OldType << "[" << *OldType + << "], " << (void*)NewType << " [" << *NewType << "])\n"; #endif // Otherwise, we are changing one subelement type into another. Clearly the @@ -937,12 +936,12 @@ public: void print(const char *Arg) const { #ifdef DEBUG_MERGE_TYPES - std::cerr << "TypeMap<>::" << Arg << " table contents:\n"; + DOUT << "TypeMap<>::" << Arg << " table contents:\n"; unsigned i = 0; for (typename std::map::const_iterator I = Map.begin(), E = Map.end(); I != E; ++I) - std::cerr << " " << (++i) << ". " << (void*)I->second.get() << " " - << *I->second.get() << "\n"; + DOUT << " " << (++i) << ". " << (void*)I->second.get() << " " + << *I->second.get() << "\n"; #endif } @@ -1016,7 +1015,7 @@ FunctionType *FunctionType::get(const Type *ReturnType, FunctionTypes->add(VT, MT = new FunctionType(ReturnType, Params, isVarArg)); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << MT << "\n"; + DOUT << "Derived new type: " << MT << "\n"; #endif return MT; } @@ -1065,7 +1064,7 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) { ArrayTypes->add(AVT, AT = new ArrayType(ElementType, NumElements)); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << *AT << "\n"; + DOUT << "Derived new type: " << *AT << "\n"; #endif return AT; } @@ -1116,7 +1115,7 @@ PackedType *PackedType::get(const Type *ElementType, unsigned NumElements) { PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements)); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << *PT << "\n"; + DOUT << "Derived new type: " << *PT << "\n"; #endif return PT; } @@ -1169,7 +1168,7 @@ StructType *StructType::get(const std::vector &ETypes) { StructTypes->add(STV, ST = new StructType(ETypes)); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << *ST << "\n"; + DOUT << "Derived new type: " << *ST << "\n"; #endif return ST; } @@ -1224,7 +1223,7 @@ PointerType *PointerType::get(const Type *ValueType) { PointerTypes->add(PVT, PT = new PointerType(ValueType)); #ifdef DEBUG_MERGE_TYPES - std::cerr << "Derived new type: " << *PT << "\n"; + DOUT << "Derived new type: " << *PT << "\n"; #endif return PT; } @@ -1253,14 +1252,14 @@ void Type::removeAbstractTypeUser(AbstractTypeUser *U) const { AbstractTypeUsers.erase(AbstractTypeUsers.begin()+i); #ifdef DEBUG_MERGE_TYPES - std::cerr << " remAbstractTypeUser[" << (void*)this << ", " - << *this << "][" << i << "] User = " << U << "\n"; + DOUT << " remAbstractTypeUser[" << (void*)this << ", " + << *this << "][" << i << "] User = " << U << "\n"; #endif if (AbstractTypeUsers.empty() && getRefCount() == 0 && isAbstract()) { #ifdef DEBUG_MERGE_TYPES - std::cerr << "DELETEing unused abstract type: <" << *this - << ">[" << (void*)this << "]" << "\n"; + DOUT << "DELETEing unused abstract type: <" << *this + << ">[" << (void*)this << "]" << "\n"; #endif delete this; // No users of this abstract type! } @@ -1281,9 +1280,9 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { AbstractTypeDescriptions->clear(); #ifdef DEBUG_MERGE_TYPES - std::cerr << "REFINING abstract type [" << (void*)this << " " - << *this << "] to [" << (void*)NewType << " " - << *NewType << "]!\n"; + DOUT << "REFINING abstract type [" << (void*)this << " " + << *this << "] to [" << (void*)NewType << " " + << *NewType << "]!\n"; #endif // Make sure to put the type to be refined to into a holder so that if IT gets @@ -1319,10 +1318,10 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { unsigned OldSize = AbstractTypeUsers.size(); #ifdef DEBUG_MERGE_TYPES - std::cerr << " REFINING user " << OldSize-1 << "[" << (void*)User - << "] of abstract type [" << (void*)this << " " - << *this << "] to [" << (void*)NewTy.get() << " " - << *NewTy << "]!\n"; + DOUT << " REFINING user " << OldSize-1 << "[" << (void*)User + << "] of abstract type [" << (void*)this << " " + << *this << "] to [" << (void*)NewTy.get() << " " + << *NewTy << "]!\n"; #endif User->refineAbstractType(this, NewTy); @@ -1341,7 +1340,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { // void DerivedType::notifyUsesThatTypeBecameConcrete() { #ifdef DEBUG_MERGE_TYPES - std::cerr << "typeIsREFINED type: " << (void*)this << " " << *this << "\n"; + DOUT << "typeIsREFINED type: " << (void*)this << " " << *this << "\n"; #endif unsigned OldSize = AbstractTypeUsers.size(); diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 1f0c4442de8..0d9dc07fa07 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -16,9 +16,9 @@ #include "llvm/InstrTypes.h" #include "llvm/Module.h" #include "llvm/SymbolTable.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/LeakDetector.h" #include -#include using namespace llvm; //===----------------------------------------------------------------------===// @@ -50,10 +50,10 @@ Value::~Value() { // a // if (use_begin() != use_end()) { - std::cerr << "While deleting: " << *Ty << " %" << Name << "\n"; + DOUT << "While deleting: " << *Ty << " %" << Name << "\n"; for (use_iterator I = use_begin(), E = use_end(); I != E; ++I) - std::cerr << "Use still stuck around after Def is destroyed:" - << **I << "\n"; + DOUT << "Use still stuck around after Def is destroyed:" + << **I << "\n"; } #endif assert(use_begin() == use_end() && "Uses remain when a value is destroyed!"); diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp index 1e343e74747..6efb9983874 100644 --- a/lib/VMCore/ValueSymbolTable.cpp +++ b/lib/VMCore/ValueSymbolTable.cpp @@ -15,9 +15,8 @@ #include "llvm/Type.h" #include "llvm/ValueSymbolTable.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/Debug.h" #include -#include - using namespace llvm; #define DEBUG_SYMBOL_TABLE 0 @@ -29,9 +28,9 @@ ValueSymbolTable::~ValueSymbolTable() { bool LeftoverValues = true; for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ++VI) if (!isa(VI->second) ) { - std::cerr << "Value still in symbol table! Type = '" - << VI->second->getType()->getDescription() << "' Name = '" - << VI->first << "'\n"; + DOUT << "Value still in symbol table! Type = '" + << VI->second->getType()->getDescription() << "' Name = '" + << VI->first << "'\n"; LeftoverValues = false; } assert(LeftoverValues && "Values remain in symbol table!"); @@ -89,7 +88,7 @@ void ValueSymbolTable::insert(Value* V) { #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Inserting value: " << UniqueName << ": " << V->dump() << "\n"; + DOUT << " Inserting value: " << UniqueName << ": " << V->dump() << "\n"; #endif // Insert the vmap entry @@ -105,7 +104,7 @@ bool ValueSymbolTable::erase(Value *V) { #if DEBUG_SYMBOL_TABLE dump(); - std::cerr << " Removing Value: " << Entry->second->getName() << "\n"; + DOUT << " Removing Value: " << Entry->second->getName() << "\n"; #endif // Remove the value from the plane... @@ -153,14 +152,14 @@ bool ValueSymbolTable::rename(Value *V, const std::string &name) { // DumpVal - a std::for_each function for dumping a value // static void DumpVal(const std::pair &V) { - std::cerr << " '" << V.first << "' = "; + DOUT << " '" << V.first << "' = "; V.second->dump(); - std::cerr << "\n"; + DOUT << "\n"; } // dump - print out the symbol table // void ValueSymbolTable::dump() const { - std::cerr << "ValueSymbolTable:\n"; + DOUT << "ValueSymbolTable:\n"; for_each(vmap.begin(), vmap.end(), DumpVal); }