16 #ifndef LLVM_CODEGEN_VALUETYPES_H
17 #define LLVM_CODEGEN_VALUETYPES_H
37 Type *LLVMTy =
nullptr;
40 constexpr
EVT() =
default;
45 return !(*
this != VT);
51 return LLVMTy != VT.LLVMTy;
68 return getExtendedIntegerVT(Context, BitWidth);
74 bool IsScalable =
false) {
79 assert(!IsScalable &&
"We don't support extended scalable types yet");
80 return getExtendedVectorVT(Context, VT, NumElements);
89 assert (!EC.
Scalable &&
"We don't support extended scalable types yet");
90 return getExtendedVectorVT(Context, VT, EC.
Min);
99 "We don't support extended scalable types yet");
100 return changeExtendedVectorElementTypeToInteger();
108 "Simple vector VT not representable by simple integer vector VT!");
122 return changeExtendedTypeToInteger();
219 return BitSize >= 8 && !(BitSize & (BitSize - 1));
224 if (EVT::operator==(VT))
return true;
230 if (EVT::operator==(VT))
return false;
236 if (EVT::operator==(VT))
return true;
242 if (EVT::operator==(VT))
return false;
248 if (EVT::operator==(VT))
return true;
269 return getExtendedVectorElementType();
277 return getExtendedVectorNumElements();
287 "We don't support extended scalable types yet");
288 return {getExtendedVectorNumElements(),
false};
295 return getExtendedSizeInBits();
354 assert(!(EltCnt.Min & 1) &&
"Splitting vector, but not in half!");
361 return !(NElts & (NElts - 1));
403 return L.LLVMTy < R.LLVMTy;
413 EVT changeExtendedTypeToInteger()
const;
414 EVT changeExtendedVectorElementTypeToInteger()
const;
417 unsigned NumElements);
420 bool isExtendedScalarInteger()
const LLVM_READONLY;
421 bool isExtendedVector()
const LLVM_READONLY;
422 bool isExtended16BitVector()
const LLVM_READONLY;
423 bool isExtended32BitVector()
const LLVM_READONLY;
424 bool isExtended64BitVector()
const LLVM_READONLY;
425 bool isExtended128BitVector()
const LLVM_READONLY;
426 bool isExtended256BitVector()
const LLVM_READONLY;
427 bool isExtended512BitVector()
const LLVM_READONLY;
428 bool isExtended1024BitVector()
const LLVM_READONLY;
429 bool isExtended2048BitVector()
const LLVM_READONLY;
430 EVT getExtendedVectorElementType()
const;
431 unsigned getExtendedVectorNumElements() const LLVM_READONLY;
432 unsigned getExtendedSizeInBits() const LLVM_READONLY;
437 #endif // LLVM_CODEGEN_VALUETYPES_H
EVT getRoundIntegerType(LLVMContext &Context) const
Rounds the bit-width of the given integer EVT up to the nearest power of two (and at least to eight)...
bool is16BitVector() const
Return true if this is a 16-bit vector type.
bool is32BitVector() const
Return true if this is a 32-bit vector type.
static MVT getIntegerVT(unsigned BitWidth)
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
static MVT getVectorVT(MVT VT, unsigned NumElements)
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
bool is512BitVector() const
Return true if this is a 512-bit vector type.
static MVT getFloatingPointVT(unsigned BitWidth)
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
unsigned getSizeInBits() const
bool is32BitVector() const
Return true if this is a 32-bit vector type.
bool is2048BitVector() const
Return true if this is a 2048-bit vector type.
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
bool isVector() const
Return true if this is a vector value type.
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
bool isRound() const
Return true if the size is a power-of-two number of bytes.
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
bool isInteger() const
Return true if this is an integer or a vector integer type.
EVT getVectorElementType() const
Given a vector type, return the type of each element.
A meaningless but well-behaved order, useful for constructing containers.
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT...
bool operator()(EVT L, EVT R) const
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
bool isScalableVector() const
Return true if this is a vector value type where the runtime length is machine dependent.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
unsigned getScalarSizeInBits() const
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
unsigned getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool is256BitVector() const
Return true if this is a 256-bit vector type.
unsigned getVectorNumElements() const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
bool isVector() const
Return true if this is a vector value type.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
MVT::ElementCount getVectorElementCount() const
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
bool is16BitVector() const
Return true if this is a 16-bit vector type.
bool isOverloaded() const
Return true if this is an overloaded type for TableGen.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool operator==(EVT VT) const
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
MVT::ElementCount getVectorElementCount() const
EVT widenIntegerVectorElementType(LLVMContext &Context) const
Return a VT for an integer vector type with the size of the elements doubled.
static EVT getVectorVT(LLVMContext &Context, EVT VT, MVT::ElementCount EC)
Returns the EVT that represents a vector EC.Min elements in length, where each element is of type VT...
bool is256BitVector() const
Return true if this is a 256-bit vector type.
bool operator!=(EVT VT) const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
intptr_t getRawBits() const
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
EVT getPow2VectorType(LLVMContext &Context) const
Widens the length of the given vector EVT up to the nearest power of 2 and returns that type...
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool isByteSized() const
Return true if the bit size is a multiple of 8.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
bool is2048BitVector() const
Return true if this is a 1024-bit vector type.
EVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type...
MVT getVectorElementType() const
bool is512BitVector() const
Return true if this is a 512-bit vector type.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
constexpr EVT(MVT::SimpleValueType SVT)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.