Removed iostream #includes. Replaced std::cerr with DOUT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2006-11-17 08:03:48 +00:00
parent 6345d75729
commit 2e3def1177
6 changed files with 71 additions and 74 deletions

View File

@ -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 <algorithm>
#include <iostream>
using namespace llvm;
//===----------------------------------------------------------------------===//
@ -42,9 +42,9 @@ void Constant::destroyConstantImpl() {
Value *V = use_back();
#ifndef NDEBUG // Only in -g mode...
if (!isa<Constant>(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<Constant>(V) && "References remain to Constant being destroyed");
Constant *CV = cast<Constant>(V);
@ -870,7 +870,7 @@ public:
}
void dump() const {
std::cerr << "Constant.cpp: ValueMap\n";
DOUT << "Constant.cpp: ValueMap\n";
}
};
}

View File

@ -20,7 +20,6 @@
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SetOperations.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
//===----------------------------------------------------------------------===//

View File

@ -16,9 +16,8 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#include <iostream>
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<Constant>(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<DerivedType>(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<DerivedType>(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<DerivedType>(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<DerivedType>(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<DerivedType>(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<DerivedType>(NewType)->addAbstractTypeUser(this);
}
@ -418,28 +418,28 @@ void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
}
static void DumpVal(const std::pair<const std::string, Value *> &V) {
std::cerr << " '" << V.first << "' = ";
DOUT << " '" << V.first << "' = ";
V.second->dump();
std::cerr << "\n";
DOUT << "\n";
}
static void DumpPlane(const std::pair<const Type *,
std::map<const std::string, Value *> >&P){
P.first->dump();
std::cerr << "\n";
DOUT << "\n";
for_each(P.second.begin(), P.second.end(), DumpVal);
}
static void DumpTypes(const std::pair<const std::string, const Type*>& 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);
}

View File

@ -23,7 +23,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ManagedStatic.h"
#include <algorithm>
#include <iostream>
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<ValType, PATypeHolder>::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<const Type*> &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();

View File

@ -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 <algorithm>
#include <iostream>
using namespace llvm;
//===----------------------------------------------------------------------===//
@ -50,10 +50,10 @@ Value::~Value() {
// a <badref>
//
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!");

View File

@ -15,9 +15,8 @@
#include "llvm/Type.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#include <iostream>
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<Constant>(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<const std::string, Value *> &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);
}