* Add debug support for PATypeHolder

* PATypeHolder is now not a template


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-04-04 19:26:02 +00:00
parent 22c3982cd3
commit aa06d2c103

View File

@ -32,6 +32,10 @@ using std::cerr;
static unsigned CurUID = 0; static unsigned CurUID = 0;
static vector<const Type *> UIDMappings; static vector<const Type *> UIDMappings;
void PATypeHolder::dump() const {
cerr << "PATypeHolder(" << (void*)this << ")\n";
}
Type::Type(const string &name, PrimitiveID id) Type::Type(const string &name, PrimitiveID id)
: Value(Type::TypeTy, Value::TypeVal) { : Value(Type::TypeTy, Value::TypeVal) {
setDescription(name); setDescription(name);
@ -470,15 +474,17 @@ public:
Map.erase(I); Map.erase(I);
} }
void print(const char *Arg) { void print(const char *Arg) const {
#ifdef DEBUG_MERGE_TYPES #ifdef DEBUG_MERGE_TYPES
cerr << "TypeMap<>::" << Arg << " table contents:\n"; cerr << "TypeMap<>::" << Arg << " table contents:\n";
unsigned i = 0; unsigned i = 0;
for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) for (MapTy::const_iterator I = Map.begin(), E = Map.end(); I != E; ++I)
cerr << " " << (++i) << ". " << I->second << " " cerr << " " << (++i) << ". " << I->second << " "
<< I->second->getDescription() << endl; << I->second->getDescription() << endl;
#endif #endif
} }
void dump() const { print("dump output"); }
}; };
@ -518,6 +524,10 @@ protected:
Table.add((ValType&)Tmp, (TypeClass*)OldType.get()); Table.add((ValType&)Tmp, (TypeClass*)OldType.get());
#endif #endif
} }
void dump() const {
cerr << "ValTypeBase instance!\n";
}
}; };
@ -814,7 +824,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) {
// Make sure to put the type to be refined to into a holder so that if IT gets // Make sure to put the type to be refined to into a holder so that if IT gets
// refined, that we will not continue using a dead reference... // refined, that we will not continue using a dead reference...
// //
PATypeHolder<Type> NewTy(NewType); PATypeHolder NewTy(NewType);
// Add a self use of the current type so that we don't delete ourself until // Add a self use of the current type so that we don't delete ourself until
// after this while loop. We are careful to never invoke refine on ourself, // after this while loop. We are careful to never invoke refine on ourself,
@ -846,9 +856,9 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) {
#endif #endif
User->refineAbstractType(this, NewTy); User->refineAbstractType(this, NewTy);
if (AbstractTypeUsers.size() == OldSize) { if (AbstractTypeUsers.size() == OldSize)
User->refineAbstractType(this, NewTy); User->refineAbstractType(this, NewTy);
}
assert(AbstractTypeUsers.size() != OldSize && assert(AbstractTypeUsers.size() != OldSize &&
"AbsTyUser did not remove self from user list!"); "AbsTyUser did not remove self from user list!");
} }
@ -861,7 +871,6 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) {
removeAbstractTypeUser(this); removeAbstractTypeUser(this);
} }
// typeIsRefined - Notify AbstractTypeUsers of this type that the current type // typeIsRefined - Notify AbstractTypeUsers of this type that the current type
// has been refined a bit. The pointer is still valid and still should be // has been refined a bit. The pointer is still valid and still should be
// used, but the subtypes have changed. // used, but the subtypes have changed.