mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-25 21:16:19 +00:00
Remove unsized array support
Add new SequentialType class llvm-svn: 1470
This commit is contained in:
parent
ba664bbc27
commit
e443a8ff8d
@ -187,7 +187,7 @@ Type *Type::VoidTy = new Type("void" , VoidTyID),
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
MethodType::MethodType(const Type *Result, const vector<const Type*> &Params,
|
MethodType::MethodType(const Type *Result, const vector<const Type*> &Params,
|
||||||
bool IsVarArgs) : DerivedType("", MethodTyID),
|
bool IsVarArgs) : DerivedType(MethodTyID),
|
||||||
ResultType(PATypeHandle<Type>(Result, this)),
|
ResultType(PATypeHandle<Type>(Result, this)),
|
||||||
isVarArgs(IsVarArgs) {
|
isVarArgs(IsVarArgs) {
|
||||||
ParamTys.reserve(Params.size());
|
ParamTys.reserve(Params.size());
|
||||||
@ -197,14 +197,8 @@ MethodType::MethodType(const Type *Result, const vector<const Type*> &Params,
|
|||||||
setDerivedTypeProperties();
|
setDerivedTypeProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayType::ArrayType(const Type *ElType, int NumEl)
|
|
||||||
: CompositeType("", ArrayTyID), ElementType(PATypeHandle<Type>(ElType, this)){
|
|
||||||
NumElements = NumEl;
|
|
||||||
setDerivedTypeProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
StructType::StructType(const vector<const Type*> &Types)
|
StructType::StructType(const vector<const Type*> &Types)
|
||||||
: CompositeType("", StructTyID) {
|
: CompositeType(StructTyID) {
|
||||||
ETypes.reserve(Types.size());
|
ETypes.reserve(Types.size());
|
||||||
for (unsigned i = 0; i < Types.size(); ++i) {
|
for (unsigned i = 0; i < Types.size(); ++i) {
|
||||||
assert(Types[i] != Type::VoidTy && "Void type in method prototype!!");
|
assert(Types[i] != Type::VoidTy && "Void type in method prototype!!");
|
||||||
@ -213,12 +207,17 @@ StructType::StructType(const vector<const Type*> &Types)
|
|||||||
setDerivedTypeProperties();
|
setDerivedTypeProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerType::PointerType(const Type *E) : DerivedType("", PointerTyID),
|
ArrayType::ArrayType(const Type *ElType, unsigned NumEl)
|
||||||
ValueType(PATypeHandle<Type>(E, this)) {
|
: SequentialType(ArrayTyID, ElType) {
|
||||||
|
NumElements = NumEl;
|
||||||
setDerivedTypeProperties();
|
setDerivedTypeProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
OpaqueType::OpaqueType() : DerivedType("", OpaqueTyID) {
|
PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) {
|
||||||
|
setDerivedTypeProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpaqueType::OpaqueType() : DerivedType(OpaqueTyID) {
|
||||||
setAbstract(true);
|
setAbstract(true);
|
||||||
setDescription("opaque"+utostr(getUniqueID()));
|
setDescription("opaque"+utostr(getUniqueID()));
|
||||||
#ifdef DEBUG_MERGE_TYPES
|
#ifdef DEBUG_MERGE_TYPES
|
||||||
@ -303,9 +302,9 @@ static string getTypeProps(const Type *Ty, vector<const Type *> &TypeStack,
|
|||||||
}
|
}
|
||||||
case Type::ArrayTyID: {
|
case Type::ArrayTyID: {
|
||||||
const ArrayType *ATy = cast<const ArrayType>(Ty);
|
const ArrayType *ATy = cast<const ArrayType>(Ty);
|
||||||
int NumElements = ATy->getNumElements();
|
unsigned NumElements = ATy->getNumElements();
|
||||||
Result = "[";
|
Result = "[";
|
||||||
if (NumElements != -1) Result += itostr(NumElements) + " x ";
|
Result += utostr(NumElements) + " x ";
|
||||||
Result += getTypeProps(ATy->getElementType(), TypeStack,
|
Result += getTypeProps(ATy->getElementType(), TypeStack,
|
||||||
isAbstract, isRecursive) + "]";
|
isAbstract, isRecursive) + "]";
|
||||||
break;
|
break;
|
||||||
@ -591,7 +590,7 @@ MethodType *MethodType::get(const Type *ReturnType,
|
|||||||
//
|
//
|
||||||
class ArrayValType : public ValTypeBase<ArrayValType, ArrayType> {
|
class ArrayValType : public ValTypeBase<ArrayValType, ArrayType> {
|
||||||
PATypeHandle<Type> ValTy;
|
PATypeHandle<Type> ValTy;
|
||||||
int Size;
|
unsigned Size;
|
||||||
public:
|
public:
|
||||||
ArrayValType(const Type *val, int sz, TypeMap<ArrayValType, ArrayType> &Tab)
|
ArrayValType(const Type *val, int sz, TypeMap<ArrayValType, ArrayType> &Tab)
|
||||||
: ValTypeBase<ArrayValType, ArrayType>(Tab), ValTy(val, this), Size(sz) {}
|
: ValTypeBase<ArrayValType, ArrayType>(Tab), ValTy(val, this), Size(sz) {}
|
||||||
@ -622,7 +621,7 @@ public:
|
|||||||
|
|
||||||
static TypeMap<ArrayValType, ArrayType> ArrayTypes;
|
static TypeMap<ArrayValType, ArrayType> ArrayTypes;
|
||||||
|
|
||||||
ArrayType *ArrayType::get(const Type *ElementType, int NumElements = -1) {
|
ArrayType *ArrayType::get(const Type *ElementType, unsigned NumElements) {
|
||||||
assert(ElementType && "Can't get array of null types!");
|
assert(ElementType && "Can't get array of null types!");
|
||||||
|
|
||||||
ArrayValType AVT(ElementType, NumElements, ArrayTypes);
|
ArrayValType AVT(ElementType, NumElements, ArrayTypes);
|
||||||
@ -947,7 +946,7 @@ void ArrayType::refineAbstractType(const DerivedType *OldType,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!OldType->isAbstract()) {
|
if (!OldType->isAbstract()) {
|
||||||
assert(ElementType == OldType);
|
assert(getElementType() == OldType);
|
||||||
ElementType.removeUserFromConcrete();
|
ElementType.removeUserFromConcrete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,11 +1007,11 @@ void PointerType::refineAbstractType(const DerivedType *OldType,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!OldType->isAbstract()) {
|
if (!OldType->isAbstract()) {
|
||||||
assert(ValueType == OldType);
|
assert(ElementType == OldType);
|
||||||
ValueType.removeUserFromConcrete();
|
ElementType.removeUserFromConcrete();
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueType = NewType;
|
ElementType = NewType;
|
||||||
const PointerType *PT = PointerTypes.containsEquivalent(this);
|
const PointerType *PT = PointerTypes.containsEquivalent(this);
|
||||||
|
|
||||||
if (PT && PT != this) {
|
if (PT && PT != this) {
|
||||||
|
Loading…
Reference in New Issue
Block a user