// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
- // types, to avoid some circular reference problems. This also removes the
- // type from the internal tables of available types.
- virtual void dropAllTypeUses(bool inMap) = 0;
+ // types, to avoid some circular reference problems.
+ virtual void dropAllTypeUses() = 0;
-
- void refineAbstractTypeToInternal(const Type *NewType, bool inMap);
-
public:
//===--------------------------------------------------------------------===//
// This causes all users of 'this' to switch to reference the more concrete
// type NewType and for 'this' to be deleted.
//
- void refineAbstractTypeTo(const Type *NewType) {
- refineAbstractTypeToInternal(NewType, true);
- }
+ void refineAbstractTypeTo(const Type *NewType);
void addRef() const {
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
- // types, to avoid some circular reference problems. This also removes the
- // type from the internal tables of available types.
- virtual void dropAllTypeUses(bool inMap);
+ // types, to avoid some circular reference problems.
+ virtual void dropAllTypeUses();
public:
/// FunctionType::get - This static method is the primary way of constructing
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
- // types, to avoid some circular reference problems. This also removes the
- // type from the internal tables of available types.
- virtual void dropAllTypeUses(bool inMap);
+ // types, to avoid some circular reference problems.
+ virtual void dropAllTypeUses();
public:
/// StructType::get - This static method is the primary way to create a
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
- // types, to avoid some circular reference problems. This also removes the
- // type from the internal tables of available types.
- virtual void dropAllTypeUses(bool inMap);
+ // types, to avoid some circular reference problems.
+ virtual void dropAllTypeUses();
public:
/// ArrayType::get - This static method is the primary way to construct an
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
- // types, to avoid some circular reference problems. This also removes the
- // type from the internal tables of available types.
- virtual void dropAllTypeUses(bool inMap);
+ // types, to avoid some circular reference problems.
+ virtual void dropAllTypeUses();
public:
/// PointerType::get - This is the only way to construct a new pointer type.
static PointerType *get(const Type *ElementType);
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
// another (more concrete) type, we must eliminate all references to other
// types, to avoid some circular reference problems.
- virtual void dropAllTypeUses(bool inMap) {} // No type uses
+ virtual void dropAllTypeUses() {
+ // FIXME: THIS IS NOT AN ABSTRACT TYPE USER!
+ } // No type uses
public:
// OpaqueType::get - Static factory method for the OpaqueType class...
}
- void finishRefinement(TypeClass *Ty, iterator TyIt) {
- // FIXME: this could eventually just pass in the iterator!
- assert(TyIt->second == Ty && "Did not specify entry for the correct type!");
+ void finishRefinement(iterator TyIt) {
+ TypeClass *Ty = TyIt->second;
// The old record is now out-of-date, because one of the children has been
// updated. Remove the obsolete entry from the map.
TypeClass *NewTy = I->second;
// Refined to a different type altogether?
- Ty->refineAbstractTypeToInternal(NewTy, false);
+ Ty->refineAbstractTypeTo(NewTy);
return;
}
return MT;
}
-void FunctionType::dropAllTypeUses(bool inMap) {
-#if 0
- if (inMap) FunctionTypes.remove(FunctionTypes.getEntryForType(this));
- // Drop all uses of other types, which might be recursive.
-#endif
+void FunctionType::dropAllTypeUses() {
ResultType = OpaqueType::get();
ParamTys.clear();
}
return AT;
}
-void ArrayType::dropAllTypeUses(bool inMap) {
-#if 0
- if (inMap) ArrayTypes.remove(ArrayTypes.getEntryForType(this));
-#endif
+void ArrayType::dropAllTypeUses() {
ElementType = OpaqueType::get();
}
return ST;
}
-void StructType::dropAllTypeUses(bool inMap) {
-#if 0
- if (inMap) StructTypes.remove(StructTypes.getEntryForType(this));
-#endif
+void StructType::dropAllTypeUses() {
ETypes.clear();
ETypes.push_back(PATypeHandle(OpaqueType::get(), this));
}
return PT;
}
-void PointerType::dropAllTypeUses(bool inMap) {
-#if 0
- if (inMap) PointerTypes.remove(PointerTypes.getEntryForType(this));
-#endif
+void PointerType::dropAllTypeUses() {
ElementType = OpaqueType::get();
}
}
-// refineAbstractTypeToInternal - This function is used to when it is discovered
-// that the 'this' abstract type is actually equivalent to the NewType
-// specified. This causes all users of 'this' to switch to reference the more
-// concrete type NewType and for 'this' to be deleted.
+// refineAbstractTypeTo - This function is used to when it is discovered that
+// the 'this' abstract type is actually equivalent to the NewType specified.
+// This causes all users of 'this' to switch to reference the more concrete type
+// NewType and for 'this' to be deleted.
//
-void DerivedType::refineAbstractTypeToInternal(const Type *NewType, bool inMap){
+void DerivedType::refineAbstractTypeTo(const Type *NewType) {
assert(isAbstract() && "refineAbstractTypeTo: Current type is not abstract!");
assert(this != NewType && "Can't refine to myself!");
assert(ForwardType == 0 && "This type has already been refined!");
// the type map, and to replace any type uses with uses of non-abstract types.
// This dramatically limits the amount of recursive type trouble we can find
// ourselves in.
- dropAllTypeUses(inMap);
+ dropAllTypeUses();
// Iterate over all of the uses of this type, invoking callback. Each user
// should remove itself from our use list automatically. We have to check to
ParamTys[i] = NewType;
}
- FunctionTypes.finishRefinement(this, TMI);
+ FunctionTypes.finishRefinement(TMI);
}
void FunctionType::typeBecameConcrete(const DerivedType *AbsTy) {
ElementType.removeUserFromConcrete();
ElementType = NewType;
- ArrayTypes.finishRefinement(this, TMI);
+ ArrayTypes.finishRefinement(TMI);
}
void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) {
ETypes[i] = NewType;
}
- StructTypes.finishRefinement(this, TMI);
+ StructTypes.finishRefinement(TMI);
}
void StructType::typeBecameConcrete(const DerivedType *AbsTy) {
ElementType.removeUserFromConcrete();
ElementType = NewType;
- PointerTypes.finishRefinement(this, TMI);
+ PointerTypes.finishRefinement(TMI);
}
void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {