mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Minor cleanups
llvm-svn: 8843
This commit is contained in:
parent
18c3f42894
commit
a2c1509b21
@ -47,13 +47,9 @@ protected:
|
|||||||
|
|
||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems. This also removes the
|
// types, to avoid some circular reference problems.
|
||||||
// type from the internal tables of available types.
|
virtual void dropAllTypeUses() = 0;
|
||||||
virtual void dropAllTypeUses(bool inMap) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void refineAbstractTypeToInternal(const Type *NewType, bool inMap);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
@ -82,9 +78,7 @@ public:
|
|||||||
// This causes all users of 'this' to switch to reference the more concrete
|
// This causes all users of 'this' to switch to reference the more concrete
|
||||||
// type NewType and for 'this' to be deleted.
|
// type NewType and for 'this' to be deleted.
|
||||||
//
|
//
|
||||||
void refineAbstractTypeTo(const Type *NewType) {
|
void refineAbstractTypeTo(const Type *NewType);
|
||||||
refineAbstractTypeToInternal(NewType, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void addRef() const {
|
void addRef() const {
|
||||||
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
|
assert(isAbstract() && "Cannot add a reference to a non-abstract type!");
|
||||||
@ -138,9 +132,8 @@ protected:
|
|||||||
|
|
||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems. This also removes the
|
// types, to avoid some circular reference problems.
|
||||||
// type from the internal tables of available types.
|
virtual void dropAllTypeUses();
|
||||||
virtual void dropAllTypeUses(bool inMap);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// FunctionType::get - This static method is the primary way of constructing
|
/// FunctionType::get - This static method is the primary way of constructing
|
||||||
@ -235,9 +228,8 @@ protected:
|
|||||||
|
|
||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems. This also removes the
|
// types, to avoid some circular reference problems.
|
||||||
// type from the internal tables of available types.
|
virtual void dropAllTypeUses();
|
||||||
virtual void dropAllTypeUses(bool inMap);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// StructType::get - This static method is the primary way to create a
|
/// StructType::get - This static method is the primary way to create a
|
||||||
@ -344,9 +336,8 @@ protected:
|
|||||||
|
|
||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems. This also removes the
|
// types, to avoid some circular reference problems.
|
||||||
// type from the internal tables of available types.
|
virtual void dropAllTypeUses();
|
||||||
virtual void dropAllTypeUses(bool inMap);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// ArrayType::get - This static method is the primary way to construct an
|
/// ArrayType::get - This static method is the primary way to construct an
|
||||||
@ -385,9 +376,8 @@ protected:
|
|||||||
|
|
||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems. This also removes the
|
// types, to avoid some circular reference problems.
|
||||||
// type from the internal tables of available types.
|
virtual void dropAllTypeUses();
|
||||||
virtual void dropAllTypeUses(bool inMap);
|
|
||||||
public:
|
public:
|
||||||
/// PointerType::get - This is the only way to construct a new pointer type.
|
/// PointerType::get - This is the only way to construct a new pointer type.
|
||||||
static PointerType *get(const Type *ElementType);
|
static PointerType *get(const Type *ElementType);
|
||||||
@ -421,7 +411,9 @@ protected:
|
|||||||
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
// dropAllTypeUses - When this (abstract) type is resolved to be equal to
|
||||||
// another (more concrete) type, we must eliminate all references to other
|
// another (more concrete) type, we must eliminate all references to other
|
||||||
// types, to avoid some circular reference problems.
|
// 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:
|
public:
|
||||||
// OpaqueType::get - Static factory method for the OpaqueType class...
|
// OpaqueType::get - Static factory method for the OpaqueType class...
|
||||||
|
@ -524,9 +524,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void finishRefinement(TypeClass *Ty, iterator TyIt) {
|
void finishRefinement(iterator TyIt) {
|
||||||
// FIXME: this could eventually just pass in the iterator!
|
TypeClass *Ty = TyIt->second;
|
||||||
assert(TyIt->second == Ty && "Did not specify entry for the correct type!");
|
|
||||||
|
|
||||||
// The old record is now out-of-date, because one of the children has been
|
// The old record is now out-of-date, because one of the children has been
|
||||||
// updated. Remove the obsolete entry from the map.
|
// updated. Remove the obsolete entry from the map.
|
||||||
@ -542,7 +541,7 @@ public:
|
|||||||
TypeClass *NewTy = I->second;
|
TypeClass *NewTy = I->second;
|
||||||
|
|
||||||
// Refined to a different type altogether?
|
// Refined to a different type altogether?
|
||||||
Ty->refineAbstractTypeToInternal(NewTy, false);
|
Ty->refineAbstractTypeTo(NewTy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,11 +661,7 @@ FunctionType *FunctionType::get(const Type *ReturnType,
|
|||||||
return MT;
|
return MT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionType::dropAllTypeUses(bool inMap) {
|
void FunctionType::dropAllTypeUses() {
|
||||||
#if 0
|
|
||||||
if (inMap) FunctionTypes.remove(FunctionTypes.getEntryForType(this));
|
|
||||||
// Drop all uses of other types, which might be recursive.
|
|
||||||
#endif
|
|
||||||
ResultType = OpaqueType::get();
|
ResultType = OpaqueType::get();
|
||||||
ParamTys.clear();
|
ParamTys.clear();
|
||||||
}
|
}
|
||||||
@ -721,10 +716,7 @@ ArrayType *ArrayType::get(const Type *ElementType, unsigned NumElements) {
|
|||||||
return AT;
|
return AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrayType::dropAllTypeUses(bool inMap) {
|
void ArrayType::dropAllTypeUses() {
|
||||||
#if 0
|
|
||||||
if (inMap) ArrayTypes.remove(ArrayTypes.getEntryForType(this));
|
|
||||||
#endif
|
|
||||||
ElementType = OpaqueType::get();
|
ElementType = OpaqueType::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,10 +773,7 @@ StructType *StructType::get(const std::vector<const Type*> &ETypes) {
|
|||||||
return ST;
|
return ST;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StructType::dropAllTypeUses(bool inMap) {
|
void StructType::dropAllTypeUses() {
|
||||||
#if 0
|
|
||||||
if (inMap) StructTypes.remove(StructTypes.getEntryForType(this));
|
|
||||||
#endif
|
|
||||||
ETypes.clear();
|
ETypes.clear();
|
||||||
ETypes.push_back(PATypeHandle(OpaqueType::get(), this));
|
ETypes.push_back(PATypeHandle(OpaqueType::get(), this));
|
||||||
}
|
}
|
||||||
@ -838,10 +827,7 @@ PointerType *PointerType::get(const Type *ValueType) {
|
|||||||
return PT;
|
return PT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerType::dropAllTypeUses(bool inMap) {
|
void PointerType::dropAllTypeUses() {
|
||||||
#if 0
|
|
||||||
if (inMap) PointerTypes.remove(PointerTypes.getEntryForType(this));
|
|
||||||
#endif
|
|
||||||
ElementType = OpaqueType::get();
|
ElementType = OpaqueType::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,12 +877,12 @@ void DerivedType::removeAbstractTypeUser(AbstractTypeUser *U) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// refineAbstractTypeToInternal - This function is used to when it is discovered
|
// refineAbstractTypeTo - This function is used to when it is discovered that
|
||||||
// that the 'this' abstract type is actually equivalent to the NewType
|
// the 'this' abstract type is actually equivalent to the NewType specified.
|
||||||
// specified. This causes all users of 'this' to switch to reference the more
|
// This causes all users of 'this' to switch to reference the more concrete type
|
||||||
// concrete type NewType and for 'this' to be deleted.
|
// 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(isAbstract() && "refineAbstractTypeTo: Current type is not abstract!");
|
||||||
assert(this != NewType && "Can't refine to myself!");
|
assert(this != NewType && "Can't refine to myself!");
|
||||||
assert(ForwardType == 0 && "This type has already been refined!");
|
assert(ForwardType == 0 && "This type has already been refined!");
|
||||||
@ -930,7 +916,7 @@ void DerivedType::refineAbstractTypeToInternal(const Type *NewType, bool inMap){
|
|||||||
// the type map, and to replace any type uses with uses of non-abstract types.
|
// 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
|
// This dramatically limits the amount of recursive type trouble we can find
|
||||||
// ourselves in.
|
// ourselves in.
|
||||||
dropAllTypeUses(inMap);
|
dropAllTypeUses();
|
||||||
|
|
||||||
// Iterate over all of the uses of this type, invoking callback. Each user
|
// 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
|
// should remove itself from our use list automatically. We have to check to
|
||||||
@ -1010,7 +996,7 @@ void FunctionType::refineAbstractType(const DerivedType *OldType,
|
|||||||
ParamTys[i] = NewType;
|
ParamTys[i] = NewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionTypes.finishRefinement(this, TMI);
|
FunctionTypes.finishRefinement(TMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionType::typeBecameConcrete(const DerivedType *AbsTy) {
|
void FunctionType::typeBecameConcrete(const DerivedType *AbsTy) {
|
||||||
@ -1040,7 +1026,7 @@ void ArrayType::refineAbstractType(const DerivedType *OldType,
|
|||||||
ElementType.removeUserFromConcrete();
|
ElementType.removeUserFromConcrete();
|
||||||
ElementType = NewType;
|
ElementType = NewType;
|
||||||
|
|
||||||
ArrayTypes.finishRefinement(this, TMI);
|
ArrayTypes.finishRefinement(TMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) {
|
void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) {
|
||||||
@ -1074,7 +1060,7 @@ void StructType::refineAbstractType(const DerivedType *OldType,
|
|||||||
ETypes[i] = NewType;
|
ETypes[i] = NewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
StructTypes.finishRefinement(this, TMI);
|
StructTypes.finishRefinement(TMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StructType::typeBecameConcrete(const DerivedType *AbsTy) {
|
void StructType::typeBecameConcrete(const DerivedType *AbsTy) {
|
||||||
@ -1103,7 +1089,7 @@ void PointerType::refineAbstractType(const DerivedType *OldType,
|
|||||||
ElementType.removeUserFromConcrete();
|
ElementType.removeUserFromConcrete();
|
||||||
ElementType = NewType;
|
ElementType = NewType;
|
||||||
|
|
||||||
PointerTypes.finishRefinement(this, TMI);
|
PointerTypes.finishRefinement(TMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
|
void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
|
||||||
|
Loading…
Reference in New Issue
Block a user