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);
430 EVT getExtendedVectorElementType()
const;
437 #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.
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
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.
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.
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.
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
MVT::ElementCount getVectorElementCount() const
bool is64BitVector() const
Return true if this is a 64-bit vector type.
unsigned getSizeInBits() const
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.
unsigned getScalarSizeInBits() const
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
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.
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.
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)...
unsigned getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
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.
bool is256BitVector() const
Return true if this is a 256-bit vector type.
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...
MVT::ElementCount getVectorElementCount() const
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.
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())
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).
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...