mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
[SVE] Add new VectorType subclasses
Summary: Introduce new types for fixed width and scalable vectors. Does not remove getNumElements yet so as to not break code during transition period. Reviewers: deadalnix, efriedma, sdesmalen, craig.topper, huntergr Reviewed By: sdesmalen Subscribers: jholewinski, arsenm, jvesely, nhaehnle, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, kerbowa, Joonsoo, grosul1, frgossen, lldb-commits, tschuett, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm, #lldb Differential Revision: https://reviews.llvm.org/D77587
This commit is contained in:
parent
5e27e52ade
commit
7f0438624e
@ -157,10 +157,11 @@ typedef enum {
|
||||
LLVMStructTypeKind, /**< Structures */
|
||||
LLVMArrayTypeKind, /**< Arrays */
|
||||
LLVMPointerTypeKind, /**< Pointers */
|
||||
LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
|
||||
LLVMMetadataTypeKind, /**< Metadata */
|
||||
LLVMX86_MMXTypeKind, /**< X86 MMX */
|
||||
LLVMTokenTypeKind /**< Tokens */
|
||||
LLVMTokenTypeKind, /**< Tokens */
|
||||
LLVMFixedVectorTypeKind, /**< Fixed width SIMD vector type */
|
||||
LLVMScalableVectorTypeKind /**< Scalable SIMD vector type */
|
||||
} LLVMTypeKind;
|
||||
|
||||
typedef enum {
|
||||
|
@ -664,7 +664,8 @@ inline TypeSize DataLayout::getTypeSizeInBits(Type *Ty) const {
|
||||
// only 80 bits contain information.
|
||||
case Type::X86_FP80TyID:
|
||||
return TypeSize::Fixed(80);
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
VectorType *VTy = cast<VectorType>(Ty);
|
||||
auto EltCnt = VTy->getElementCount();
|
||||
uint64_t MinBits = EltCnt.Min *
|
||||
|
@ -386,7 +386,7 @@ uint64_t Type::getArrayNumElements() const {
|
||||
return cast<ArrayType>(this)->getNumElements();
|
||||
}
|
||||
|
||||
/// Class to represent vector types.
|
||||
/// Base class of all SIMD vector types
|
||||
class VectorType : public Type {
|
||||
/// A fully specified VectorType is of the form <vscale x n x Ty>. 'n' is the
|
||||
/// minimum number of elements of type Ty contained within the vector, and
|
||||
@ -403,24 +403,22 @@ class VectorType : public Type {
|
||||
|
||||
/// The element type of the vector.
|
||||
Type *ContainedType;
|
||||
/// Minumum number of elements in the vector.
|
||||
uint64_t NumElements;
|
||||
|
||||
VectorType(Type *ElType, unsigned NumEl, bool Scalable = false);
|
||||
VectorType(Type *ElType, ElementCount EC);
|
||||
/// The element count of this vector
|
||||
ElementCount EC;
|
||||
|
||||
// If true, the total number of elements is an unknown multiple of the
|
||||
// minimum 'NumElements'. Otherwise the total number of elements is exactly
|
||||
// equal to 'NumElements'.
|
||||
bool Scalable;
|
||||
protected:
|
||||
VectorType(Type *ElType, ElementCount EC, Type::TypeID TID);
|
||||
|
||||
public:
|
||||
VectorType(const VectorType &) = delete;
|
||||
VectorType &operator=(const VectorType &) = delete;
|
||||
|
||||
/// For scalable vectors, this will return the minimum number of elements
|
||||
/// in the vector.
|
||||
unsigned getNumElements() const { return NumElements; }
|
||||
/// Get the number of elements in this vector. It does not make sense to call
|
||||
/// this function on a scalable vector, and this will be moved into
|
||||
/// FixedVectorType in a future commit
|
||||
unsigned getNumElements() const { return EC.Min; }
|
||||
|
||||
Type *getElementType() const { return ContainedType; }
|
||||
|
||||
/// This static method is the primary way to construct an VectorType.
|
||||
@ -430,6 +428,10 @@ public:
|
||||
return VectorType::get(ElementType, {NumElements, Scalable});
|
||||
}
|
||||
|
||||
static VectorType *get(Type *ElementType, const VectorType *Other) {
|
||||
return VectorType::get(ElementType, Other->getElementCount());
|
||||
}
|
||||
|
||||
/// This static method gets a VectorType with the same number of elements as
|
||||
/// the input type, and the element type is an integer type of the same width
|
||||
/// as the input element type.
|
||||
@ -507,26 +509,53 @@ public:
|
||||
|
||||
/// Return an ElementCount instance to represent the (possibly scalable)
|
||||
/// number of elements in the vector.
|
||||
ElementCount getElementCount() const {
|
||||
uint64_t MinimumEltCnt = getNumElements();
|
||||
assert(MinimumEltCnt <= UINT_MAX && "Too many elements in vector");
|
||||
return { (unsigned)MinimumEltCnt, Scalable };
|
||||
}
|
||||
ElementCount getElementCount() const { return EC; }
|
||||
|
||||
/// Returns whether or not this is a scalable vector (meaning the total
|
||||
/// element count is a multiple of the minimum).
|
||||
bool isScalable() const {
|
||||
return Scalable;
|
||||
}
|
||||
bool isScalable() const { return EC.Scalable; }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast.
|
||||
static bool classof(const Type *T) {
|
||||
return T->getTypeID() == VectorTyID;
|
||||
return T->getTypeID() == FixedVectorTyID ||
|
||||
T->getTypeID() == ScalableVectorTyID;
|
||||
}
|
||||
};
|
||||
|
||||
bool Type::isVectorTy() const { return isa<VectorType>(this); }
|
||||
|
||||
/// Class to represent fixed width SIMD vectors
|
||||
class FixedVectorType : public VectorType {
|
||||
protected:
|
||||
FixedVectorType(Type *ElTy, unsigned NumElts)
|
||||
: VectorType(ElTy, {NumElts, false}, FixedVectorTyID) {}
|
||||
|
||||
public:
|
||||
static FixedVectorType *get(Type *ElementType, unsigned NumElts);
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
return T->getTypeID() == FixedVectorTyID;
|
||||
}
|
||||
};
|
||||
|
||||
/// Class to represent scalable SIMD vectors
|
||||
class ScalableVectorType : public VectorType {
|
||||
protected:
|
||||
ScalableVectorType(Type *ElTy, unsigned MinNumElts)
|
||||
: VectorType(ElTy, {MinNumElts, true}, ScalableVectorTyID) {}
|
||||
|
||||
public:
|
||||
static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
|
||||
|
||||
/// Get the minimum number of elements in this vector. The actual number of
|
||||
/// elements in the vector is an integer multiple of this value.
|
||||
uint64_t getMinNumElements() const { return getElementCount().Min; }
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
return T->getTypeID() == ScalableVectorTyID;
|
||||
}
|
||||
};
|
||||
|
||||
/// Class to represent pointers.
|
||||
class PointerType : public Type {
|
||||
explicit PointerType(Type *ElType, unsigned AddrSpace);
|
||||
|
@ -54,26 +54,27 @@ public:
|
||||
///
|
||||
enum TypeID {
|
||||
// PrimitiveTypes - make sure LastPrimitiveTyID stays up to date.
|
||||
VoidTyID = 0, ///< 0: type with no size
|
||||
HalfTyID, ///< 1: 16-bit floating point type
|
||||
FloatTyID, ///< 2: 32-bit floating point type
|
||||
DoubleTyID, ///< 3: 64-bit floating point type
|
||||
X86_FP80TyID, ///< 4: 80-bit floating point type (X87)
|
||||
FP128TyID, ///< 5: 128-bit floating point type (112-bit mantissa)
|
||||
PPC_FP128TyID, ///< 6: 128-bit floating point type (two 64-bits, PowerPC)
|
||||
LabelTyID, ///< 7: Labels
|
||||
MetadataTyID, ///< 8: Metadata
|
||||
X86_MMXTyID, ///< 9: MMX vectors (64 bits, X86 specific)
|
||||
TokenTyID, ///< 10: Tokens
|
||||
VoidTyID = 0, ///< 0: type with no size
|
||||
HalfTyID, ///< 1: 16-bit floating point type
|
||||
FloatTyID, ///< 2: 32-bit floating point type
|
||||
DoubleTyID, ///< 3: 64-bit floating point type
|
||||
X86_FP80TyID, ///< 4: 80-bit floating point type (X87)
|
||||
FP128TyID, ///< 5: 128-bit floating point type (112-bit mantissa)
|
||||
PPC_FP128TyID, ///< 6: 128-bit floating point type (two 64-bits, PowerPC)
|
||||
LabelTyID, ///< 7: Labels
|
||||
MetadataTyID, ///< 8: Metadata
|
||||
X86_MMXTyID, ///< 9: MMX vectors (64 bits, X86 specific)
|
||||
TokenTyID, ///< 10: Tokens
|
||||
|
||||
// Derived types... see DerivedTypes.h file.
|
||||
// Make sure FirstDerivedTyID stays up to date!
|
||||
IntegerTyID, ///< 11: Arbitrary bit width integers
|
||||
FunctionTyID, ///< 12: Functions
|
||||
StructTyID, ///< 13: Structures
|
||||
ArrayTyID, ///< 14: Arrays
|
||||
PointerTyID, ///< 15: Pointers
|
||||
VectorTyID ///< 16: SIMD 'packed' format, or other vector type
|
||||
IntegerTyID, ///< 11: Arbitrary bit width integers
|
||||
FunctionTyID, ///< 12: Functions
|
||||
StructTyID, ///< 13: Structures
|
||||
ArrayTyID, ///< 14: Arrays
|
||||
PointerTyID, ///< 15: Pointers
|
||||
FixedVectorTyID, ///< 16: Fixed width SIMD vector type
|
||||
ScalableVectorTyID ///< 17: Scalable SIMD vector type
|
||||
};
|
||||
|
||||
private:
|
||||
@ -266,8 +267,7 @@ public:
|
||||
return true;
|
||||
// If it is not something that can have a size (e.g. a function or label),
|
||||
// it doesn't have a size.
|
||||
if (getTypeID() != StructTyID && getTypeID() != ArrayTyID &&
|
||||
getTypeID() != VectorTyID)
|
||||
if (getTypeID() != StructTyID && getTypeID() != ArrayTyID && !isVectorTy())
|
||||
return false;
|
||||
// Otherwise we have to try harder to decide.
|
||||
return isSizedDerivedType(Visited);
|
||||
|
@ -949,7 +949,8 @@ void ModuleBitcodeWriter::writeTypeTable() {
|
||||
AbbrevToUse = ArrayAbbrev;
|
||||
break;
|
||||
}
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
VectorType *VT = cast<VectorType>(T);
|
||||
// VECTOR [numelts, eltty] or
|
||||
// [numelts, eltty, scalable]
|
||||
|
@ -362,7 +362,8 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
|
||||
case Type::FP128TyID: return MVT(MVT::f128);
|
||||
case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
|
||||
case Type::PointerTyID: return MVT(MVT::iPTR);
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
VectorType *VTy = cast<VectorType>(Ty);
|
||||
return getVectorVT(
|
||||
getVT(VTy->getElementType(), /*HandleUnknown=*/ false),
|
||||
@ -380,7 +381,8 @@ EVT EVT::getEVT(Type *Ty, bool HandleUnknown){
|
||||
return MVT::getVT(Ty, HandleUnknown);
|
||||
case Type::IntegerTyID:
|
||||
return getIntegerVT(Ty->getContext(), cast<IntegerType>(Ty)->getBitWidth());
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
VectorType *VTy = cast<VectorType>(Ty);
|
||||
return getVectorVT(Ty->getContext(),
|
||||
getEVT(VTy->getElementType(), /*HandleUnknown=*/ false),
|
||||
|
@ -624,17 +624,18 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Type::VectorTyID:
|
||||
// if the whole vector is 'undef' just reserve memory for the value.
|
||||
auto* VTy = cast<VectorType>(C->getType());
|
||||
Type *ElemTy = VTy->getElementType();
|
||||
unsigned int elemNum = VTy->getNumElements();
|
||||
Result.AggregateVal.resize(elemNum);
|
||||
if (ElemTy->isIntegerTy())
|
||||
for (unsigned int i = 0; i < elemNum; ++i)
|
||||
Result.AggregateVal[i].IntVal =
|
||||
APInt(ElemTy->getPrimitiveSizeInBits(), 0);
|
||||
break;
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
// if the whole vector is 'undef' just reserve memory for the value.
|
||||
auto *VTy = cast<VectorType>(C->getType());
|
||||
Type *ElemTy = VTy->getElementType();
|
||||
unsigned int elemNum = VTy->getNumElements();
|
||||
Result.AggregateVal.resize(elemNum);
|
||||
if (ElemTy->isIntegerTy())
|
||||
for (unsigned int i = 0; i < elemNum; ++i)
|
||||
Result.AggregateVal[i].IntVal =
|
||||
APInt(ElemTy->getPrimitiveSizeInBits(), 0);
|
||||
break;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -914,7 +915,8 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
else
|
||||
llvm_unreachable("Unknown constant pointer type!");
|
||||
break;
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
unsigned elemNum;
|
||||
Type* ElemTy;
|
||||
const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(C);
|
||||
@ -1006,8 +1008,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
break;
|
||||
}
|
||||
llvm_unreachable("Unknown constant pointer type!");
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
default:
|
||||
SmallString<256> Msg;
|
||||
@ -1046,7 +1047,8 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
|
||||
|
||||
*((PointerTy*)Ptr) = Val.PointerVal;
|
||||
break;
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
for (unsigned i = 0; i < Val.AggregateVal.size(); ++i) {
|
||||
if (cast<VectorType>(Ty)->getElementType()->isDoubleTy())
|
||||
*(((double*)Ptr)+i) = Val.AggregateVal[i].DoubleVal;
|
||||
@ -1096,7 +1098,8 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
|
||||
Result.IntVal = APInt(80, y);
|
||||
break;
|
||||
}
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
auto *VT = cast<VectorType>(Ty);
|
||||
Type *ElemT = VT->getElementType();
|
||||
const unsigned numElems = VT->getNumElements();
|
||||
|
@ -169,13 +169,14 @@ static void executeFRemInst(GenericValue &Dest, GenericValue Src1,
|
||||
Dest.IntVal = APInt(1,Src1.IntVal.OP(Src2.IntVal)); \
|
||||
break;
|
||||
|
||||
#define IMPLEMENT_VECTOR_INTEGER_ICMP(OP, TY) \
|
||||
case Type::VectorTyID: { \
|
||||
assert(Src1.AggregateVal.size() == Src2.AggregateVal.size()); \
|
||||
Dest.AggregateVal.resize( Src1.AggregateVal.size() ); \
|
||||
for( uint32_t _i=0;_i<Src1.AggregateVal.size();_i++) \
|
||||
Dest.AggregateVal[_i].IntVal = APInt(1, \
|
||||
Src1.AggregateVal[_i].IntVal.OP(Src2.AggregateVal[_i].IntVal));\
|
||||
#define IMPLEMENT_VECTOR_INTEGER_ICMP(OP, TY) \
|
||||
case Type::FixedVectorTyID: \
|
||||
case Type::ScalableVectorTyID: { \
|
||||
assert(Src1.AggregateVal.size() == Src2.AggregateVal.size()); \
|
||||
Dest.AggregateVal.resize(Src1.AggregateVal.size()); \
|
||||
for (uint32_t _i = 0; _i < Src1.AggregateVal.size(); _i++) \
|
||||
Dest.AggregateVal[_i].IntVal = APInt( \
|
||||
1, Src1.AggregateVal[_i].IntVal.OP(Src2.AggregateVal[_i].IntVal)); \
|
||||
} break;
|
||||
|
||||
// Handle pointers specially because they must be compared with only as much
|
||||
@ -367,12 +368,13 @@ void Interpreter::visitICmpInst(ICmpInst &I) {
|
||||
Src1.AggregateVal[_i].TY##Val OP Src2.AggregateVal[_i].TY##Val);\
|
||||
break;
|
||||
|
||||
#define IMPLEMENT_VECTOR_FCMP(OP) \
|
||||
case Type::VectorTyID: \
|
||||
if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) { \
|
||||
IMPLEMENT_VECTOR_FCMP_T(OP, Float); \
|
||||
} else { \
|
||||
IMPLEMENT_VECTOR_FCMP_T(OP, Double); \
|
||||
#define IMPLEMENT_VECTOR_FCMP(OP) \
|
||||
case Type::FixedVectorTyID: \
|
||||
case Type::ScalableVectorTyID: \
|
||||
if (cast<VectorType>(Ty)->getElementType()->isFloatTy()) { \
|
||||
IMPLEMENT_VECTOR_FCMP_T(OP, Float); \
|
||||
} else { \
|
||||
IMPLEMENT_VECTOR_FCMP_T(OP, Double); \
|
||||
}
|
||||
|
||||
static GenericValue executeFCMP_OEQ(GenericValue Src1, GenericValue Src2,
|
||||
@ -1327,7 +1329,7 @@ GenericValue Interpreter::executeFPTruncInst(Value *SrcVal, Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcVal->getType()->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcVal->getType())) {
|
||||
assert(SrcVal->getType()->getScalarType()->isDoubleTy() &&
|
||||
DstTy->getScalarType()->isFloatTy() &&
|
||||
"Invalid FPTrunc instruction");
|
||||
@ -1350,7 +1352,7 @@ GenericValue Interpreter::executeFPExtInst(Value *SrcVal, Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcVal->getType()->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcVal->getType())) {
|
||||
assert(SrcVal->getType()->getScalarType()->isFloatTy() &&
|
||||
DstTy->getScalarType()->isDoubleTy() && "Invalid FPExt instruction");
|
||||
|
||||
@ -1373,7 +1375,7 @@ GenericValue Interpreter::executeFPToUIInst(Value *SrcVal, Type *DstTy,
|
||||
Type *SrcTy = SrcVal->getType();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcTy->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcTy)) {
|
||||
Type *DstVecTy = DstTy->getScalarType();
|
||||
Type *SrcVecTy = SrcTy->getScalarType();
|
||||
uint32_t DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
|
||||
@ -1411,7 +1413,7 @@ GenericValue Interpreter::executeFPToSIInst(Value *SrcVal, Type *DstTy,
|
||||
Type *SrcTy = SrcVal->getType();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcTy->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcTy)) {
|
||||
Type *DstVecTy = DstTy->getScalarType();
|
||||
Type *SrcVecTy = SrcTy->getScalarType();
|
||||
uint32_t DBitWidth = cast<IntegerType>(DstVecTy)->getBitWidth();
|
||||
@ -1447,7 +1449,7 @@ GenericValue Interpreter::executeUIToFPInst(Value *SrcVal, Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcVal->getType()->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcVal->getType())) {
|
||||
Type *DstVecTy = DstTy->getScalarType();
|
||||
unsigned size = Src.AggregateVal.size();
|
||||
// the sizes of src and dst vectors must be equal
|
||||
@ -1479,7 +1481,7 @@ GenericValue Interpreter::executeSIToFPInst(Value *SrcVal, Type *DstTy,
|
||||
ExecutionContext &SF) {
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (SrcVal->getType()->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcVal->getType())) {
|
||||
Type *DstVecTy = DstTy->getScalarType();
|
||||
unsigned size = Src.AggregateVal.size();
|
||||
// the sizes of src and dst vectors must be equal
|
||||
@ -1540,8 +1542,7 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, Type *DstTy,
|
||||
Type *SrcTy = SrcVal->getType();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if ((SrcTy->getTypeID() == Type::VectorTyID) ||
|
||||
(DstTy->getTypeID() == Type::VectorTyID)) {
|
||||
if (isa<VectorType>(SrcTy) || isa<VectorType>(DstTy)) {
|
||||
// vector src bitcast to vector dst or vector src bitcast to scalar dst or
|
||||
// scalar src bitcast to vector dst
|
||||
bool isLittleEndian = getDataLayout().isLittleEndian();
|
||||
@ -1553,7 +1554,7 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, Type *DstTy,
|
||||
unsigned SrcNum;
|
||||
unsigned DstNum;
|
||||
|
||||
if (SrcTy->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(SrcTy)) {
|
||||
SrcElemTy = SrcTy->getScalarType();
|
||||
SrcBitSize = SrcTy->getScalarSizeInBits();
|
||||
SrcNum = Src.AggregateVal.size();
|
||||
@ -1566,7 +1567,7 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, Type *DstTy,
|
||||
SrcVec.AggregateVal.push_back(Src);
|
||||
}
|
||||
|
||||
if (DstTy->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(DstTy)) {
|
||||
DstElemTy = DstTy->getScalarType();
|
||||
DstBitSize = DstTy->getScalarSizeInBits();
|
||||
DstNum = (SrcNum * SrcBitSize) / DstBitSize;
|
||||
@ -1639,7 +1640,7 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, Type *DstTy,
|
||||
}
|
||||
|
||||
// convert result from integer to specified type
|
||||
if (DstTy->getTypeID() == Type::VectorTyID) {
|
||||
if (isa<VectorType>(DstTy)) {
|
||||
if (DstElemTy->isDoubleTy()) {
|
||||
Dest.AggregateVal.resize(DstNum);
|
||||
for (unsigned i = 0; i < DstNum; i++)
|
||||
@ -1662,8 +1663,7 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, Type *DstTy,
|
||||
Dest.IntVal = TempDst.AggregateVal[0].IntVal;
|
||||
}
|
||||
}
|
||||
} else { // if ((SrcTy->getTypeID() == Type::VectorTyID) ||
|
||||
// (DstTy->getTypeID() == Type::VectorTyID))
|
||||
} else { // if (isa<VectorType>(SrcTy)) || isa<VectorType>(DstTy))
|
||||
|
||||
// scalar src bitcast to scalar dst
|
||||
if (DstTy->isPointerTy()) {
|
||||
@ -1954,7 +1954,8 @@ void Interpreter::visitExtractValueInst(ExtractValueInst &I) {
|
||||
break;
|
||||
case Type::ArrayTyID:
|
||||
case Type::StructTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
Dest.AggregateVal = pSrc->AggregateVal;
|
||||
break;
|
||||
case Type::PointerTyID:
|
||||
@ -2001,7 +2002,8 @@ void Interpreter::visitInsertValueInst(InsertValueInst &I) {
|
||||
break;
|
||||
case Type::ArrayTyID:
|
||||
case Type::StructTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
pDest->AggregateVal = Src2.AggregateVal;
|
||||
break;
|
||||
case Type::PointerTyID:
|
||||
|
@ -650,7 +650,8 @@ void TypePrinting::print(Type *Ty, raw_ostream &OS) {
|
||||
OS << ']';
|
||||
return;
|
||||
}
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
VectorType *PTy = cast<VectorType>(Ty);
|
||||
OS << "<";
|
||||
if (PTy->isScalable())
|
||||
|
@ -352,7 +352,8 @@ Constant *Constant::getNullValue(Type *Ty) {
|
||||
return ConstantPointerNull::get(cast<PointerType>(Ty));
|
||||
case Type::StructTyID:
|
||||
case Type::ArrayTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
return ConstantAggregateZero::get(Ty);
|
||||
case Type::TokenTyID:
|
||||
return ConstantTokenNone::get(Ty->getContext());
|
||||
@ -1780,8 +1781,8 @@ Constant *ConstantExpr::getFPCast(Constant *C, Type *Ty) {
|
||||
|
||||
Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "Trunc operand must be integer");
|
||||
@ -1794,8 +1795,8 @@ Constant *ConstantExpr::getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getSExt(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "SExt operand must be integral");
|
||||
@ -1808,8 +1809,8 @@ Constant *ConstantExpr::getSExt(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getZExt(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && "ZEXt operand must be integral");
|
||||
@ -1822,8 +1823,8 @@ Constant *ConstantExpr::getZExt(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
@ -1834,8 +1835,8 @@ Constant *ConstantExpr::getFPTrunc(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
@ -1846,8 +1847,8 @@ Constant *ConstantExpr::getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
@ -1857,8 +1858,8 @@ Constant *ConstantExpr::getUIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
|
||||
@ -1868,8 +1869,8 @@ Constant *ConstantExpr::getSIToFP(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
@ -1879,8 +1880,8 @@ Constant *ConstantExpr::getFPToUI(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
|
||||
Constant *ConstantExpr::getFPToSI(Constant *C, Type *Ty, bool OnlyIfReduced) {
|
||||
#ifndef NDEBUG
|
||||
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
|
||||
bool toVec = Ty->getTypeID() == Type::VectorTyID;
|
||||
bool fromVec = isa<VectorType>(C->getType());
|
||||
bool toVec = isa<VectorType>(Ty);
|
||||
#endif
|
||||
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
|
||||
assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
|
||||
|
@ -501,12 +501,14 @@ LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty) {
|
||||
return LLVMArrayTypeKind;
|
||||
case Type::PointerTyID:
|
||||
return LLVMPointerTypeKind;
|
||||
case Type::VectorTyID:
|
||||
return LLVMVectorTypeKind;
|
||||
case Type::X86_MMXTyID:
|
||||
return LLVMX86_MMXTypeKind;
|
||||
case Type::TokenTyID:
|
||||
return LLVMTokenTypeKind;
|
||||
case Type::FixedVectorTyID:
|
||||
return LLVMFixedVectorTypeKind;
|
||||
case Type::ScalableVectorTyID:
|
||||
return LLVMScalableVectorTypeKind;
|
||||
}
|
||||
llvm_unreachable("Unhandled TypeID.");
|
||||
}
|
||||
|
@ -739,7 +739,8 @@ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
|
||||
AlignType = FLOAT_ALIGN;
|
||||
break;
|
||||
case Type::X86_MMXTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
AlignType = VECTOR_ALIGN;
|
||||
break;
|
||||
default:
|
||||
|
@ -73,13 +73,10 @@ bool Type::canLosslesslyBitCastTo(Type *Ty) const {
|
||||
return getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits();
|
||||
|
||||
// 64-bit fixed width vector types can be losslessly converted to x86mmx.
|
||||
if (((isa<VectorType>(this) &&
|
||||
!cast<VectorType>(this)->getElementCount().Scalable) &&
|
||||
Ty->isX86_MMXTy()) &&
|
||||
if (((isa<FixedVectorType>(this)) && Ty->isX86_MMXTy()) &&
|
||||
getPrimitiveSizeInBits().getFixedSize() == 64)
|
||||
return true;
|
||||
if ((isX86_MMXTy() && (isa<VectorType>(Ty) &&
|
||||
!cast<VectorType>(Ty)->getElementCount().Scalable)) &&
|
||||
if ((isX86_MMXTy() && isa<FixedVectorType>(Ty)) &&
|
||||
Ty->getPrimitiveSizeInBits().getFixedSize() == 64)
|
||||
return true;
|
||||
|
||||
@ -123,7 +120,8 @@ TypeSize Type::getPrimitiveSizeInBits() const {
|
||||
case Type::X86_MMXTyID: return TypeSize::Fixed(64);
|
||||
case Type::IntegerTyID:
|
||||
return TypeSize::Fixed(cast<IntegerType>(this)->getBitWidth());
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
const VectorType *VTy = cast<VectorType>(this);
|
||||
ElementCount EC = VTy->getElementCount();
|
||||
TypeSize ETS = VTy->getElementType()->getPrimitiveSizeInBits();
|
||||
@ -586,30 +584,65 @@ bool ArrayType::isValidElementType(Type *ElemTy) {
|
||||
// VectorType Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
VectorType::VectorType(Type *ElType, ElementCount EC)
|
||||
: Type(ElType->getContext(), VectorTyID), ContainedType(ElType),
|
||||
NumElements(EC.Min), Scalable(EC.Scalable) {
|
||||
VectorType::VectorType(Type *ElType, ElementCount EC, Type::TypeID TID)
|
||||
: Type(ElType->getContext(), TID), ContainedType(ElType), EC(EC) {
|
||||
ContainedTys = &ContainedType;
|
||||
NumContainedTys = 1;
|
||||
}
|
||||
|
||||
VectorType *VectorType::get(Type *ElementType, ElementCount EC) {
|
||||
assert(EC.Min > 0 && "#Elements of a VectorType must be greater than 0");
|
||||
assert(isValidElementType(ElementType) && "Element type of a VectorType must "
|
||||
"be an integer, floating point, or "
|
||||
"pointer type.");
|
||||
|
||||
LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
|
||||
VectorType *&Entry = ElementType->getContext().pImpl
|
||||
->VectorTypes[std::make_pair(ElementType, EC)];
|
||||
if (!Entry)
|
||||
Entry = new (pImpl->Alloc) VectorType(ElementType, EC);
|
||||
return Entry;
|
||||
if (EC.Scalable)
|
||||
return ScalableVectorType::get(ElementType, EC.Min);
|
||||
else
|
||||
return FixedVectorType::get(ElementType, EC.Min);
|
||||
}
|
||||
|
||||
bool VectorType::isValidElementType(Type *ElemTy) {
|
||||
return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
|
||||
ElemTy->isPointerTy();
|
||||
ElemTy->isPointerTy();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FixedVectorType Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
FixedVectorType *FixedVectorType::get(Type *ElementType, unsigned NumElts) {
|
||||
assert(NumElts > 0 && "#Elements of a VectorType must be greater than 0");
|
||||
assert(isValidElementType(ElementType) && "Element type of a VectorType must "
|
||||
"be an integer, floating point, or "
|
||||
"pointer type.");
|
||||
|
||||
ElementCount EC(NumElts, false);
|
||||
|
||||
LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
|
||||
VectorType *&Entry = ElementType->getContext()
|
||||
.pImpl->VectorTypes[std::make_pair(ElementType, EC)];
|
||||
|
||||
if (!Entry)
|
||||
Entry = new (pImpl->Alloc) FixedVectorType(ElementType, NumElts);
|
||||
return cast<FixedVectorType>(Entry);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ScalableVectorType Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
ScalableVectorType *ScalableVectorType::get(Type *ElementType,
|
||||
unsigned MinNumElts) {
|
||||
assert(MinNumElts > 0 && "#Elements of a VectorType must be greater than 0");
|
||||
assert(isValidElementType(ElementType) && "Element type of a VectorType must "
|
||||
"be an integer, floating point, or "
|
||||
"pointer type.");
|
||||
|
||||
ElementCount EC(MinNumElts, true);
|
||||
|
||||
LLVMContextImpl *pImpl = ElementType->getContext().pImpl;
|
||||
VectorType *&Entry = ElementType->getContext()
|
||||
.pImpl->VectorTypes[std::make_pair(ElementType, EC)];
|
||||
|
||||
if (!Entry)
|
||||
Entry = new (pImpl->Alloc) ScalableVectorType(ElementType, MinNumElts);
|
||||
return cast<ScalableVectorType>(Entry);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -305,7 +305,8 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
|
||||
case Type::ArrayTyID:
|
||||
return *Entry = ArrayType::get(ElementTypes[0],
|
||||
cast<ArrayType>(Ty)->getNumElements());
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
return *Entry = VectorType::get(ElementTypes[0],
|
||||
cast<VectorType>(Ty)->getNumElements());
|
||||
case Type::PointerTyID:
|
||||
|
@ -152,7 +152,7 @@ ValueType MetadataStreamerV2::getValueType(Type *Ty, StringRef TypeName) const {
|
||||
return ValueType::F64;
|
||||
case Type::PointerTyID:
|
||||
return getValueType(Ty->getPointerElementType(), TypeName);
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
return getValueType(cast<VectorType>(Ty)->getElementType(), TypeName);
|
||||
default:
|
||||
return ValueType::Struct;
|
||||
@ -185,7 +185,7 @@ std::string MetadataStreamerV2::getTypeName(Type *Ty, bool Signed) const {
|
||||
return "float";
|
||||
case Type::DoubleTyID:
|
||||
return "double";
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID: {
|
||||
auto VecTy = cast<VectorType>(Ty);
|
||||
auto ElTy = VecTy->getElementType();
|
||||
auto NumElements = VecTy->getNumElements();
|
||||
@ -599,7 +599,7 @@ StringRef MetadataStreamerV3::getValueType(Type *Ty, StringRef TypeName) const {
|
||||
return "f64";
|
||||
case Type::PointerTyID:
|
||||
return getValueType(Ty->getPointerElementType(), TypeName);
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
return getValueType(cast<VectorType>(Ty)->getElementType(), TypeName);
|
||||
default:
|
||||
return "struct";
|
||||
@ -632,7 +632,7 @@ std::string MetadataStreamerV3::getTypeName(Type *Ty, bool Signed) const {
|
||||
return "float";
|
||||
case Type::DoubleTyID:
|
||||
return "double";
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID: {
|
||||
auto VecTy = cast<VectorType>(Ty);
|
||||
auto ElTy = VecTy->getElementType();
|
||||
auto NumElements = VecTy->getNumElements();
|
||||
|
@ -408,8 +408,7 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu(
|
||||
Value *Arg = CI->getArgOperand(ArgCount);
|
||||
Type *ArgType = Arg->getType();
|
||||
SmallVector<Value *, 32> WhatToStore;
|
||||
if (ArgType->isFPOrFPVectorTy() &&
|
||||
(ArgType->getTypeID() != Type::VectorTyID)) {
|
||||
if (ArgType->isFPOrFPVectorTy() && !isa<VectorType>(ArgType)) {
|
||||
Type *IType = (ArgType->isFloatTy()) ? Int32Ty : Int64Ty;
|
||||
if (OpConvSpecifiers[ArgCount - 1] == 'f') {
|
||||
ConstantFP *fpCons = dyn_cast<ConstantFP>(Arg);
|
||||
@ -478,7 +477,7 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu(
|
||||
Arg = new PtrToIntInst(Arg, DstType, "PrintArgPtr", Brnch);
|
||||
WhatToStore.push_back(Arg);
|
||||
}
|
||||
} else if (ArgType->getTypeID() == Type::VectorTyID) {
|
||||
} else if (isa<FixedVectorType>(ArgType)) {
|
||||
Type *IType = NULL;
|
||||
uint32_t EleCount = cast<VectorType>(ArgType)->getNumElements();
|
||||
uint32_t EleSize = ArgType->getScalarSizeInBits();
|
||||
|
@ -307,7 +307,7 @@ unsigned HexagonTargetObjectFile::getSmallestAddressableSize(const Type *Ty,
|
||||
const ArrayType *ATy = cast<const ArrayType>(Ty);
|
||||
return getSmallestAddressableSize(ATy->getElementType(), GV, TM);
|
||||
}
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID: {
|
||||
const VectorType *PTy = cast<const VectorType>(Ty);
|
||||
return getSmallestAddressableSize(PTy->getElementType(), GV, TM);
|
||||
}
|
||||
|
@ -1184,7 +1184,7 @@ void NVPTXAsmPrinter::printModuleLevelGV(const GlobalVariable *GVar,
|
||||
case Type::IntegerTyID: // Integers larger than 64 bits
|
||||
case Type::StructTyID:
|
||||
case Type::ArrayTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
ElementSize = DL.getTypeStoreSize(ETy);
|
||||
// Ptx allows variable initilization only for constant and
|
||||
// global state spaces.
|
||||
@ -1358,7 +1358,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
|
||||
switch (ETy->getTypeID()) {
|
||||
case Type::StructTyID:
|
||||
case Type::ArrayTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
ElementSize = DL.getTypeStoreSize(ETy);
|
||||
O << " .b8 ";
|
||||
getSymbol(GVar)->print(O, MAI);
|
||||
@ -1892,7 +1892,7 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes,
|
||||
}
|
||||
|
||||
case Type::ArrayTyID:
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::StructTyID: {
|
||||
if (isa<ConstantAggregate>(CPV) || isa<ConstantDataSequential>(CPV)) {
|
||||
int ElementSize = DL.getTypeAllocSize(CPV->getType());
|
||||
|
@ -129,7 +129,8 @@ static bool isLeakCheckerRoot(GlobalVariable *GV) {
|
||||
default: break;
|
||||
case Type::PointerTyID:
|
||||
return true;
|
||||
case Type::VectorTyID:
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID:
|
||||
if (cast<VectorType>(Ty)->getElementType()->isPointerTy())
|
||||
return true;
|
||||
break;
|
||||
|
@ -488,7 +488,8 @@ int FunctionComparator::cmpTypes(Type *TyL, Type *TyR) const {
|
||||
return cmpNumbers(STyL->getNumElements(), STyR->getNumElements());
|
||||
return cmpTypes(STyL->getElementType(), STyR->getElementType());
|
||||
}
|
||||
case Type::VectorTyID: {
|
||||
case Type::FixedVectorTyID:
|
||||
case Type::ScalableVectorTyID: {
|
||||
auto *STyL = cast<VectorType>(TyL);
|
||||
auto *STyR = cast<VectorType>(TyR);
|
||||
if (STyL->getElementCount().Scalable != STyR->getElementCount().Scalable)
|
||||
|
@ -137,7 +137,10 @@ struct TypeCloner {
|
||||
Clone(LLVMGetElementType(Src)),
|
||||
LLVMGetPointerAddressSpace(Src)
|
||||
);
|
||||
case LLVMVectorTypeKind:
|
||||
case LLVMScalableVectorTypeKind:
|
||||
// FIXME: scalable vectors unsupported
|
||||
break;
|
||||
case LLVMFixedVectorTypeKind:
|
||||
return LLVMVectorType(
|
||||
Clone(LLVMGetElementType(Src)),
|
||||
LLVMGetVectorSize(Src)
|
||||
|
Loading…
Reference in New Issue
Block a user