27 #ifndef LLVM_CODEGEN_GLOBALISEL_LOWLEVELTYPE_H
28 #define LLVM_CODEGEN_GLOBALISEL_LOWLEVELTYPE_H
52 assert(SizeInBits > 0 &&
"invalid scalar size");
63 static LLT vector(uint16_t NumElements,
unsigned ScalarSizeInBits) {
64 assert(NumElements > 1 &&
"invalid number of vector elements");
65 return LLT{
Vector, NumElements, ScalarSizeInBits};
70 assert(NumElements > 1 &&
"invalid number of vector elements");
75 explicit LLT(
TypeKind Kind, uint16_t NumElements,
unsigned SizeInBits)
76 : SizeInBits(SizeInBits), ElementsOrAddrSpace(NumElements), Kind(Kind) {
78 "invalid number of vector elements");
81 explicit LLT() : SizeInBits(0), ElementsOrAddrSpace(0), Kind(
Invalid) {}
99 assert(
isVector() &&
"cannot get number of elements on scalar/aggregate");
100 return ElementsOrAddrSpace;
107 return SizeInBits * ElementsOrAddrSpace;
116 return ElementsOrAddrSpace;
121 assert(
isVector() &&
"cannot get element type of scalar/aggregate");
122 return scalar(SizeInBits);
131 return LLT{Kind, ElementsOrAddrSpace, SizeInBits / 2};
139 return LLT{Kind, ElementsOrAddrSpace, SizeInBits * 2};
148 "cannot half odd vector");
149 if (ElementsOrAddrSpace == 2)
150 return scalar(SizeInBits);
152 return LLT{
Vector,
static_cast<uint16_t
>(ElementsOrAddrSpace / 2),
162 return LLT{
Vector,
static_cast<uint16_t
>(ElementsOrAddrSpace * 2),
169 return Kind == RHS.Kind && SizeInBits == RHS.SizeInBits &&
170 ElementsOrAddrSpace == RHS.ElementsOrAddrSpace;
178 uint16_t ElementsOrAddrSpace;
195 uint64_t Val = ((uint64_t)Ty.SizeInBits << 32) |
196 ((uint64_t)Ty.ElementsOrAddrSpace << 16) | (uint64_t)Ty.Kind;
A parsed version of the target data layout string in and methods for querying it. ...
LLT doubleElements() const
Get a low-level type with twice the size of the original, by doubling the number of vector elements o...
static LLT vector(uint16_t NumElements, LLT ScalarTy)
Get a low-level vector of some number of elements and element type.
bool operator!=(const LLT &RHS) const
unsigned getScalarSizeInBits() const
unsigned getAddressSpace() const
bool operator==(const LLT &RHS) const
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
LLT doubleScalarSize() const
Get a low-level type with twice the size of the original, by doubling the size of the scalar type inv...
LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeInBits)
MVT - Machine Value Type.
The instances of the Type class are immutable: once they are created, they are never changed...
static bool isEqual(const LLT &LHS, const LLT &RHS)
static LLT getTombstoneKey()
uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
static unsigned getHashValue(const LLT &Ty)
LLT getElementType() const
Returns the vector's element type. Only valid for vector types.
LLT halfScalarSize() const
Get a low-level type with half the size of the original, by halving the size of the scalar type invol...
LLT halfElements() const
Get a low-level type with half the size of the original, by halving the number of vector elements of ...
void print(raw_ostream &OS) const
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static LLT pointer(uint16_t AddressSpace, unsigned SizeInBits)
Get a low-level pointer in the given address space (defaulting to 0).
This class implements an extremely fast bulk output stream that can only output to a stream...
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
static LLT vector(uint16_t NumElements, unsigned ScalarSizeInBits)
Get a low-level vector of some number of elements and element width.