15 #ifndef LLVM_CODEGEN_VALUETYPES_H 16 #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();
221 return BitSize >= 8 && !(BitSize & (BitSize - 1));
226 if (EVT::operator==(VT))
return true;
232 if (EVT::operator==(VT))
return false;
238 if (EVT::operator==(VT))
return true;
244 if (EVT::operator==(VT))
return false;
250 if (EVT::operator==(VT))
return true;
271 return getExtendedVectorElementType();
279 return getExtendedVectorNumElements();
289 "We don't support extended scalable types yet");
290 return {getExtendedVectorNumElements(),
false};
301 return getExtendedSizeInBits();
369 assert(!(EltCnt.Min & 1) &&
"Splitting vector, but not in half!");
376 return !(NElts & (NElts - 1));
418 return L.LLVMTy < R.LLVMTy;
428 EVT changeExtendedTypeToInteger()
const;
429 EVT changeExtendedVectorElementTypeToInteger()
const;
432 unsigned NumElements);
445 EVT getExtendedVectorElementType()
const;
452 #endif // LLVM_CODEGEN_VALUETYPES_H
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 isInteger() const
Return true if this is an integer or a vector integer type.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
ElementCount getVectorElementCount() const
This class represents lattice values for constants.
static MVT getVectorVT(MVT VT, unsigned NumElements)
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
bool operator==(EVT VT) const
bool isVector() const
Return true if this is a vector value type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
bool is256BitVector() const
Return true if this is a 256-bit vector type.
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
static MVT getFloatingPointVT(unsigned BitWidth)
unsigned getVectorNumElements() const
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
bool isInteger() const
Return true if this is an integer or a vector integer type.
static EVT getVectorVT(LLVMContext &Context, EVT VT, ElementCount EC)
Returns the EVT that represents a vector EC.Min elements in length, where each element is of type VT...
bool isByteSized() const
Return true if the bit size is a multiple of 8.
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 is16BitVector() const
Return true if this is a 16-bit vector type.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
bool operator!=(EVT VT) const
A meaningless but well-behaved order, useful for constructing containers.
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
bool is2048BitVector() const
Return true if this is a 2048-bit vector type.
bool is16BitVector() const
Return true if this is a 16-bit vector type.
MVT getVectorElementType() const
bool isScalableVector() const
Return true if this is a vector value type where the runtime length is machine dependent.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
bool operator()(EVT L, EVT R) 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 is512BitVector() const
Return true if this is a 512-bit vector type.
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
bool isRound() const
Return true if the size is a power-of-two number of bytes.
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
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.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
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)...
EVT getVectorElementType() const
Given a vector type, return the type of each element.
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
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, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT...
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
bool isOverloaded() const
Return true if this is an overloaded type for TableGen.
bool is32BitVector() const
Return true if this is a 32-bit vector type.
ElementCount getVectorElementCount() const
bool is256BitVector() const
Return true if this is a 256-bit vector type.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
bool isVector() const
Return true if this is a vector value type.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
uint64_t getKnownMinSize() const
bool is512BitVector() const
Return true if this is a 512-bit vector type.
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
TypeSize getScalarSizeInBits() const
EVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type...
intptr_t getRawBits() const
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
TypeSize getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
constexpr EVT(MVT::SimpleValueType SVT)
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT...