|
@@ -313,18 +313,21 @@ Type *Type::getStructElementType(unsigned N) const {
|
|
|
/// identically.
|
|
|
class SequentialType : public CompositeType {
|
|
|
Type *ContainedType; ///< Storage for the single contained type.
|
|
|
+ uint64_t NumElements;
|
|
|
SequentialType(const SequentialType &) = delete;
|
|
|
const SequentialType &operator=(const SequentialType &) = delete;
|
|
|
|
|
|
protected:
|
|
|
- SequentialType(TypeID TID, Type *ElType)
|
|
|
- : CompositeType(ElType->getContext(), TID), ContainedType(ElType) {
|
|
|
+ SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
|
|
|
+ : CompositeType(ElType->getContext(), TID), ContainedType(ElType),
|
|
|
+ NumElements(NumElements) {
|
|
|
ContainedTys = &ContainedType;
|
|
|
NumContainedTys = 1;
|
|
|
}
|
|
|
|
|
|
public:
|
|
|
- Type *getElementType() const { return getSequentialElementType(); }
|
|
|
+ uint64_t getNumElements() const { return NumElements; }
|
|
|
+ Type *getElementType() const { return ContainedType; }
|
|
|
|
|
|
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|
|
|
static inline bool classof(const Type *T) {
|
|
@@ -334,8 +337,6 @@ public:
|
|
|
|
|
|
/// Class to represent array types.
|
|
|
class ArrayType : public SequentialType {
|
|
|
- uint64_t NumElements;
|
|
|
-
|
|
|
ArrayType(const ArrayType &) = delete;
|
|
|
const ArrayType &operator=(const ArrayType &) = delete;
|
|
|
ArrayType(Type *ElType, uint64_t NumEl);
|
|
@@ -347,8 +348,6 @@ public:
|
|
|
/// Return true if the specified type is valid as a element type.
|
|
|
static bool isValidElementType(Type *ElemTy);
|
|
|
|
|
|
- uint64_t getNumElements() const { return NumElements; }
|
|
|
-
|
|
|
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|
|
|
static inline bool classof(const Type *T) {
|
|
|
return T->getTypeID() == ArrayTyID;
|
|
@@ -361,8 +360,6 @@ uint64_t Type::getArrayNumElements() const {
|
|
|
|
|
|
/// Class to represent vector types.
|
|
|
class VectorType : public SequentialType {
|
|
|
- unsigned NumElements;
|
|
|
-
|
|
|
VectorType(const VectorType &) = delete;
|
|
|
const VectorType &operator=(const VectorType &) = delete;
|
|
|
VectorType(Type *ElType, unsigned NumEl);
|
|
@@ -418,13 +415,10 @@ public:
|
|
|
/// Return true if the specified type is valid as a element type.
|
|
|
static bool isValidElementType(Type *ElemTy);
|
|
|
|
|
|
- /// Return the number of elements in the Vector type.
|
|
|
- unsigned getNumElements() const { return NumElements; }
|
|
|
-
|
|
|
/// Return the number of bits in the Vector type.
|
|
|
/// Returns zero when the vector is a vector of pointers.
|
|
|
unsigned getBitWidth() const {
|
|
|
- return NumElements * getElementType()->getPrimitiveSizeInBits();
|
|
|
+ return getNumElements() * getElementType()->getPrimitiveSizeInBits();
|
|
|
}
|
|
|
|
|
|
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|