LLVM 18.0.0git
ValueTypes.h
Go to the documentation of this file.
1//===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the set of low-level target independent types which various
10// values in the code generator are. This allows the target specific behavior
11// of instructions to be described to target independent passes.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CODEGEN_VALUETYPES_H
16#define LLVM_CODEGEN_VALUETYPES_H
17
22#include <cassert>
23#include <cstdint>
24#include <string>
25
26namespace llvm {
27
28 class LLVMContext;
29 class Type;
30
31 /// Extended Value Type. Capable of holding value types which are not native
32 /// for any processor (such as the i12345 type), as well as the types an MVT
33 /// can represent.
34 struct EVT {
35 private:
37 Type *LLVMTy = nullptr;
38
39 public:
40 constexpr EVT() = default;
41 constexpr EVT(MVT::SimpleValueType SVT) : V(SVT) {}
42 constexpr EVT(MVT S) : V(S) {}
43
44 bool operator==(EVT VT) const {
45 return !(*this != VT);
46 }
47 bool operator!=(EVT VT) const {
48 if (V.SimpleTy != VT.V.SimpleTy)
49 return true;
50 if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
51 return LLVMTy != VT.LLVMTy;
52 return false;
53 }
54
55 /// Returns the EVT that represents a floating-point type with the given
56 /// number of bits. There are two floating-point types with 128 bits - this
57 /// returns f128 rather than ppcf128.
58 static EVT getFloatingPointVT(unsigned BitWidth) {
60 }
61
62 /// Returns the EVT that represents an integer with the given number of
63 /// bits.
64 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
66 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
67 return M;
68 return getExtendedIntegerVT(Context, BitWidth);
69 }
70
71 /// Returns the EVT that represents a vector NumElements in length, where
72 /// each element is of type VT.
73 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements,
74 bool IsScalable = false) {
75 MVT M = MVT::getVectorVT(VT.V, NumElements, IsScalable);
76 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
77 return M;
78 return getExtendedVectorVT(Context, VT, NumElements, IsScalable);
79 }
80
81 /// Returns the EVT that represents a vector EC.Min elements in length,
82 /// where each element is of type VT.
83 static EVT getVectorVT(LLVMContext &Context, EVT VT, ElementCount EC) {
84 MVT M = MVT::getVectorVT(VT.V, EC);
85 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
86 return M;
87 return getExtendedVectorVT(Context, VT, EC);
88 }
89
90 /// Return a vector with the same number of elements as this vector, but
91 /// with the element type converted to an integer type with the same
92 /// bitwidth.
94 if (isSimple())
96 return changeExtendedVectorElementTypeToInteger();
97 }
98
99 /// Return a VT for a vector type whose attributes match ourselves
100 /// with the exception of the element type that is chosen by the caller.
102 if (isSimple()) {
103 assert(EltVT.isSimple() &&
104 "Can't change simple vector VT to have extended element VT");
106 }
107 return changeExtendedVectorElementType(EltVT);
108 }
109
110 /// Return the type converted to an equivalently sized integer or vector
111 /// with integer element type. Similar to changeVectorElementTypeToInteger,
112 /// but also handles scalars.
114 if (isVector())
116
117 if (isSimple())
119 return changeExtendedTypeToInteger();
120 }
121
122 /// Test if the given EVT has zero size, this will fail if called on a
123 /// scalable type
124 bool isZeroSized() const {
125 return getSizeInBits().isZero();
126 }
127
128 /// Test if the given EVT is simple (as opposed to being extended).
129 bool isSimple() const {
130 return V.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE;
131 }
132
133 /// Test if the given EVT is extended (as opposed to being simple).
134 bool isExtended() const {
135 return !isSimple();
136 }
137
138 /// Return true if this is a FP or a vector FP type.
139 bool isFloatingPoint() const {
140 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
141 }
142
143 /// Return true if this is an integer or a vector integer type.
144 bool isInteger() const {
145 return isSimple() ? V.isInteger() : isExtendedInteger();
146 }
147
148 /// Return true if this is an integer, but not a vector.
149 bool isScalarInteger() const {
150 return isSimple() ? V.isScalarInteger() : isExtendedScalarInteger();
151 }
152
153 /// Return true if this is a vector type where the runtime
154 /// length is machine dependent
156 return isSimple() && V.isScalableTargetExtVT();
157 }
158
159 /// Return true if this is a vector value type.
160 bool isVector() const {
161 return isSimple() ? V.isVector() : isExtendedVector();
162 }
163
164 /// Return true if this is a vector type where the runtime
165 /// length is machine dependent
166 bool isScalableVector() const {
167 return isSimple() ? V.isScalableVector() : isExtendedScalableVector();
168 }
169
170 bool isFixedLengthVector() const {
171 return isSimple() ? V.isFixedLengthVector()
172 : isExtendedFixedLengthVector();
173 }
174
175 /// Return true if the type is a scalable type.
176 bool isScalableVT() const {
178 }
179
180 /// Return true if this is a 16-bit vector type.
181 bool is16BitVector() const {
182 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
183 }
184
185 /// Return true if this is a 32-bit vector type.
186 bool is32BitVector() const {
187 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
188 }
189
190 /// Return true if this is a 64-bit vector type.
191 bool is64BitVector() const {
192 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
193 }
194
195 /// Return true if this is a 128-bit vector type.
196 bool is128BitVector() const {
197 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
198 }
199
200 /// Return true if this is a 256-bit vector type.
201 bool is256BitVector() const {
202 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
203 }
204
205 /// Return true if this is a 512-bit vector type.
206 bool is512BitVector() const {
207 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
208 }
209
210 /// Return true if this is a 1024-bit vector type.
211 bool is1024BitVector() const {
212 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
213 }
214
215 /// Return true if this is a 2048-bit vector type.
216 bool is2048BitVector() const {
217 return isSimple() ? V.is2048BitVector() : isExtended2048BitVector();
218 }
219
220 /// Return true if this is an overloaded type for TableGen.
221 bool isOverloaded() const {
222 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
223 }
224
225 /// Return true if the bit size is a multiple of 8.
226 bool isByteSized() const {
228 }
229
230 /// Return true if the size is a power-of-two number of bytes.
231 bool isRound() const {
232 if (isScalableVector())
233 return false;
234 unsigned BitSize = getSizeInBits();
235 return BitSize >= 8 && !(BitSize & (BitSize - 1));
236 }
237
238 /// Return true if this has the same number of bits as VT.
239 bool bitsEq(EVT VT) const {
240 if (EVT::operator==(VT)) return true;
241 return getSizeInBits() == VT.getSizeInBits();
242 }
243
244 /// Return true if we know at compile time this has more bits than VT.
245 bool knownBitsGT(EVT VT) const {
247 }
248
249 /// Return true if we know at compile time this has more than or the same
250 /// bits as VT.
251 bool knownBitsGE(EVT VT) const {
253 }
254
255 /// Return true if we know at compile time this has fewer bits than VT.
256 bool knownBitsLT(EVT VT) const {
258 }
259
260 /// Return true if we know at compile time this has fewer than or the same
261 /// bits as VT.
262 bool knownBitsLE(EVT VT) const {
264 }
265
266 /// Return true if this has more bits than VT.
267 bool bitsGT(EVT VT) const {
268 if (EVT::operator==(VT)) return false;
270 "Comparison between scalable and fixed types");
271 return knownBitsGT(VT);
272 }
273
274 /// Return true if this has no less bits than VT.
275 bool bitsGE(EVT VT) const {
276 if (EVT::operator==(VT)) return true;
278 "Comparison between scalable and fixed types");
279 return knownBitsGE(VT);
280 }
281
282 /// Return true if this has less bits than VT.
283 bool bitsLT(EVT VT) const {
284 if (EVT::operator==(VT)) return false;
286 "Comparison between scalable and fixed types");
287 return knownBitsLT(VT);
288 }
289
290 /// Return true if this has no more bits than VT.
291 bool bitsLE(EVT VT) const {
292 if (EVT::operator==(VT)) return true;
294 "Comparison between scalable and fixed types");
295 return knownBitsLE(VT);
296 }
297
298 /// Return the SimpleValueType held in the specified simple EVT.
299 MVT getSimpleVT() const {
300 assert(isSimple() && "Expected a SimpleValueType!");
301 return V;
302 }
303
304 /// If this is a vector type, return the element type, otherwise return
305 /// this.
307 return isVector() ? getVectorElementType() : *this;
308 }
309
310 /// Given a vector type, return the type of each element.
312 assert(isVector() && "Invalid vector type!");
313 if (isSimple())
314 return V.getVectorElementType();
315 return getExtendedVectorElementType();
316 }
317
318 /// Given a vector type, return the number of elements it contains.
319 unsigned getVectorNumElements() const {
320 assert(isVector() && "Invalid vector type!");
321
322 if (isScalableVector())
324 "Possible incorrect use of EVT::getVectorNumElements() for "
325 "scalable vector. Scalable flag may be dropped, use "
326 "EVT::getVectorElementCount() instead");
327
328 return isSimple() ? V.getVectorNumElements()
329 : getExtendedVectorNumElements();
330 }
331
332 // Given a (possibly scalable) vector type, return the ElementCount
334 assert((isVector()) && "Invalid vector type!");
335 if (isSimple())
336 return V.getVectorElementCount();
337
338 return getExtendedVectorElementCount();
339 }
340
341 /// Given a vector type, return the minimum number of elements it contains.
342 unsigned getVectorMinNumElements() const {
344 }
345
346 /// Return the size of the specified value type in bits.
347 ///
348 /// If the value type is a scalable vector type, the scalable property will
349 /// be set and the runtime size will be a positive integer multiple of the
350 /// base size.
352 if (isSimple())
353 return V.getSizeInBits();
354 return getExtendedSizeInBits();
355 }
356
357 /// Return the size of the specified fixed width value type in bits. The
358 /// function will assert if the type is scalable.
360 return getSizeInBits().getFixedValue();
361 }
362
365 }
366
367 /// Return the number of bytes overwritten by a store of the specified value
368 /// type.
369 ///
370 /// If the value type is a scalable vector type, the scalable property will
371 /// be set and the runtime size will be a positive integer multiple of the
372 /// base size.
374 TypeSize BaseSize = getSizeInBits();
375 return {(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};
376 }
377
378 // Return the number of bytes overwritten by a store of this value type or
379 // this value type's element type in the case of a vector.
382 }
383
384 /// Return the number of bits overwritten by a store of the specified value
385 /// type.
386 ///
387 /// If the value type is a scalable vector type, the scalable property will
388 /// be set and the runtime size will be a positive integer multiple of the
389 /// base size.
391 return getStoreSize() * 8;
392 }
393
394 /// Rounds the bit-width of the given integer EVT up to the nearest power of
395 /// two (and at least to eight), and returns the integer EVT with that
396 /// number of bits.
398 assert(isInteger() && !isVector() && "Invalid integer type!");
399 unsigned BitWidth = getSizeInBits();
400 if (BitWidth <= 8)
401 return EVT(MVT::i8);
403 }
404
405 /// Finds the smallest simple value type that is greater than or equal to
406 /// half the width of this EVT. If no simple value type can be found, an
407 /// extended integer value type of half the size (rounded up) is returned.
409 assert(isInteger() && !isVector() && "Invalid integer type!");
410 unsigned EVTSize = getSizeInBits();
411 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
412 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
413 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
414 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
415 return HalfVT;
416 }
417 return getIntegerVT(Context, (EVTSize + 1) / 2);
418 }
419
420 /// Return a VT for an integer vector type with the size of the
421 /// elements doubled. The typed returned may be an extended type.
423 EVT EltVT = getVectorElementType();
424 EltVT = EVT::getIntegerVT(Context, 2 * EltVT.getSizeInBits());
426 }
427
428 // Return a VT for a vector type with the same element type but
429 // half the number of elements. The type returned may be an
430 // extended type.
432 EVT EltVT = getVectorElementType();
433 auto EltCnt = getVectorElementCount();
434 assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
435 return EVT::getVectorVT(Context, EltVT, EltCnt.divideCoefficientBy(2));
436 }
437
438 // Return a VT for a vector type with the same element type but
439 // double the number of elements. The type returned may be an
440 // extended type.
442 EVT EltVT = getVectorElementType();
443 auto EltCnt = getVectorElementCount();
444 return EVT::getVectorVT(Context, EltVT, EltCnt * 2);
445 }
446
447 /// Returns true if the given vector is a power of 2.
448 bool isPow2VectorType() const {
449 unsigned NElts = getVectorMinNumElements();
450 return !(NElts & (NElts - 1));
451 }
452
453 /// Widens the length of the given vector EVT up to the nearest power of 2
454 /// and returns that type.
456 if (!isPow2VectorType()) {
458 unsigned NewMinCount = 1 << Log2_32_Ceil(NElts.getKnownMinValue());
459 NElts = ElementCount::get(NewMinCount, NElts.isScalable());
461 }
462 else {
463 return *this;
464 }
465 }
466
467 /// This function returns value type as a string, e.g. "i32".
468 std::string getEVTString() const;
469
470 /// Support for debugging, callable in GDB: VT.dump()
471 void dump() const;
472
473 /// Implement operator<<.
474 void print(raw_ostream &OS) const {
475 OS << getEVTString();
476 }
477
478 /// This method returns an LLVM type corresponding to the specified EVT.
479 /// For integer types, this returns an unsigned type. Note that this will
480 /// abort for types that cannot be represented.
481 Type *getTypeForEVT(LLVMContext &Context) const;
482
483 /// Return the value type corresponding to the specified type.
484 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
485 /// types are returned as Other, otherwise they are invalid.
486 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
487
488 intptr_t getRawBits() const {
489 if (isSimple())
490 return V.SimpleTy;
491 else
492 return (intptr_t)(LLVMTy);
493 }
494
495 /// A meaningless but well-behaved order, useful for constructing
496 /// containers.
498 bool operator()(EVT L, EVT R) const {
499 if (L.V.SimpleTy == R.V.SimpleTy)
500 return L.LLVMTy < R.LLVMTy;
501 else
502 return L.V.SimpleTy < R.V.SimpleTy;
503 }
504 };
505
506 private:
507 // Methods for handling the Extended-type case in functions above.
508 // These are all out-of-line to prevent users of this header file
509 // from having a dependency on Type.h.
510 EVT changeExtendedTypeToInteger() const;
511 EVT changeExtendedVectorElementType(EVT EltVT) const;
512 EVT changeExtendedVectorElementTypeToInteger() const;
513 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
514 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT, unsigned NumElements,
515 bool IsScalable);
516 static EVT getExtendedVectorVT(LLVMContext &Context, EVT VT,
517 ElementCount EC);
518 bool isExtendedFloatingPoint() const LLVM_READONLY;
519 bool isExtendedInteger() const LLVM_READONLY;
520 bool isExtendedScalarInteger() const LLVM_READONLY;
521 bool isExtendedVector() const LLVM_READONLY;
522 bool isExtended16BitVector() const LLVM_READONLY;
523 bool isExtended32BitVector() const LLVM_READONLY;
524 bool isExtended64BitVector() const LLVM_READONLY;
525 bool isExtended128BitVector() const LLVM_READONLY;
526 bool isExtended256BitVector() const LLVM_READONLY;
527 bool isExtended512BitVector() const LLVM_READONLY;
528 bool isExtended1024BitVector() const LLVM_READONLY;
529 bool isExtended2048BitVector() const LLVM_READONLY;
530 bool isExtendedFixedLengthVector() const LLVM_READONLY;
531 bool isExtendedScalableVector() const LLVM_READONLY;
532 EVT getExtendedVectorElementType() const;
533 unsigned getExtendedVectorNumElements() const LLVM_READONLY;
534 ElementCount getExtendedVectorElementCount() const LLVM_READONLY;
535 TypeSize getExtendedSizeInBits() const LLVM_READONLY;
536 };
537
539 V.print(OS);
540 return OS;
541 }
542} // end namespace llvm
543
544#endif // LLVM_CODEGEN_VALUETYPES_H
aarch64 promote const
always inline
RelocType Type
Definition: COFFYAML.cpp:391
#define LLVM_READONLY
Definition: Compiler.h:208
LLVMContext & Context
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition: TypeSize.h:297
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Machine Value Type.
static MVT getFloatingPointVT(unsigned BitWidth)
SimpleValueType SimpleTy
MVT changeVectorElementType(MVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
@ INVALID_SIMPLE_VALUE_TYPE
MVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type.
static MVT getVectorVT(MVT VT, unsigned NumElements)
static MVT getIntegerVT(unsigned BitWidth)
MVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
constexpr bool isKnownMultipleOf(ScalarTy RHS) const
This function tells the caller whether the element count is known at compile time to be a multiple of...
Definition: TypeSize.h:175
constexpr ScalarTy getFixedValue() const
Definition: TypeSize.h:182
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition: TypeSize.h:212
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition: TypeSize.h:198
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition: TypeSize.h:166
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition: TypeSize.h:163
constexpr bool isZero() const
Definition: TypeSize.h:151
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition: TypeSize.h:205
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition: TypeSize.h:219
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
Definition: MathExtras.h:326
T bit_ceil(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
Definition: bit.h:306
void reportInvalidSizeRequest(const char *Msg)
Reports a diagnostic message to indicate an invalid size request has been done on a scalable vector.
Definition: TypeSize.cpp:38
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:184
A meaningless but well-behaved order, useful for constructing containers.
Definition: ValueTypes.h:497
bool operator()(EVT L, EVT R) const
Definition: ValueTypes.h:498
Extended Value Type.
Definition: ValueTypes.h:34
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
Definition: ValueTypes.h:93
constexpr EVT()=default
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
Definition: ValueTypes.h:373
EVT getPow2VectorType(LLVMContext &Context) const
Widens the length of the given vector EVT up to the nearest power of 2 and returns that type.
Definition: ValueTypes.h:455
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
Definition: ValueTypes.h:129
constexpr EVT(MVT::SimpleValueType SVT)
Definition: ValueTypes.h:41
intptr_t getRawBits() const
Definition: ValueTypes.h:488
bool knownBitsLE(EVT VT) const
Return true if we know at compile time this has fewer than or the same bits as VT.
Definition: ValueTypes.h:262
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.
Definition: ValueTypes.h:73
EVT changeTypeToInteger() const
Return the type converted to an equivalently sized integer or vector with integer element type.
Definition: ValueTypes.h:113
uint64_t getScalarStoreSize() const
Definition: ValueTypes.h:380
bool isOverloaded() const
Return true if this is an overloaded type for TableGen.
Definition: ValueTypes.h:221
bool bitsGT(EVT VT) const
Return true if this has more bits than VT.
Definition: ValueTypes.h:267
bool bitsLT(EVT VT) const
Return true if this has less bits than VT.
Definition: ValueTypes.h:283
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Definition: ValueTypes.h:139
ElementCount getVectorElementCount() const
Definition: ValueTypes.h:333
EVT getDoubleNumVectorElementsVT(LLVMContext &Context) const
Definition: ValueTypes.h:441
bool is32BitVector() const
Return true if this is a 32-bit vector type.
Definition: ValueTypes.h:186
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:351
bool isByteSized() const
Return true if the bit size is a multiple of 8.
Definition: ValueTypes.h:226
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
Definition: ValueTypes.h:211
bool knownBitsGT(EVT VT) const
Return true if we know at compile time this has more bits than VT.
Definition: ValueTypes.h:245
unsigned getVectorMinNumElements() const
Given a vector type, return the minimum number of elements it contains.
Definition: ValueTypes.h:342
uint64_t getScalarSizeInBits() const
Definition: ValueTypes.h:363
EVT getHalfSizedIntegerVT(LLVMContext &Context) const
Finds the smallest simple value type that is greater than or equal to half the width of this EVT.
Definition: ValueTypes.h:408
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
Definition: ValueTypes.h:448
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
Definition: ValueTypes.cpp:616
TypeSize getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
Definition: ValueTypes.h:390
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Definition: ValueTypes.h:299
void dump() const
Support for debugging, callable in GDB: VT.dump()
Definition: ValueTypes.cpp:185
constexpr EVT(MVT S)
Definition: ValueTypes.h:42
bool is128BitVector() const
Return true if this is a 128-bit vector type.
Definition: ValueTypes.h:196
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
Definition: ValueTypes.h:64
bool is2048BitVector() const
Return true if this is a 2048-bit vector type.
Definition: ValueTypes.h:216
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
Definition: ValueTypes.h:359
EVT widenIntegerVectorElementType(LLVMContext &Context) const
Return a VT for an integer vector type with the size of the elements doubled.
Definition: ValueTypes.h:422
bool knownBitsLT(EVT VT) const
Return true if we know at compile time this has fewer bits than VT.
Definition: ValueTypes.h:256
bool isScalableVT() const
Return true if the type is a scalable type.
Definition: ValueTypes.h:176
bool is512BitVector() const
Return true if this is a 512-bit vector type.
Definition: ValueTypes.h:206
bool isFixedLengthVector() const
Definition: ValueTypes.h:170
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
Definition: ValueTypes.cpp:153
static EVT getFloatingPointVT(unsigned BitWidth)
Returns the EVT that represents a floating-point type with the given number of bits.
Definition: ValueTypes.h:58
bool operator!=(EVT VT) const
Definition: ValueTypes.h:47
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),...
Definition: ValueTypes.h:397
bool isVector() const
Return true if this is a vector value type.
Definition: ValueTypes.h:160
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Definition: ValueTypes.h:306
bool is16BitVector() const
Return true if this is a 16-bit vector type.
Definition: ValueTypes.h:181
bool bitsGE(EVT VT) const
Return true if this has no less bits than VT.
Definition: ValueTypes.h:275
bool is256BitVector() const
Return true if this is a 256-bit vector type.
Definition: ValueTypes.h:201
bool bitsEq(EVT VT) const
Return true if this has the same number of bits as VT.
Definition: ValueTypes.h:239
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Definition: ValueTypes.cpp:194
bool isRound() const
Return true if the size is a power-of-two number of bytes.
Definition: ValueTypes.h:231
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.
Definition: ValueTypes.h:83
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
Definition: ValueTypes.h:166
bool knownBitsGE(EVT VT) const
Return true if we know at compile time this has more than or the same bits as VT.
Definition: ValueTypes.h:251
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition: ValueTypes.h:311
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
Definition: ValueTypes.h:134
void print(raw_ostream &OS) const
Implement operator<<.
Definition: ValueTypes.h:474
bool isScalableTargetExtVT() const
Return true if this is a vector type where the runtime length is machine dependent.
Definition: ValueTypes.h:155
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
Definition: ValueTypes.h:149
EVT changeVectorElementType(EVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
Definition: ValueTypes.h:101
unsigned getVectorNumElements() const
Given a vector type, return the number of elements it contains.
Definition: ValueTypes.h:319
bool operator==(EVT VT) const
Definition: ValueTypes.h:44
bool isZeroSized() const
Test if the given EVT has zero size, this will fail if called on a scalable type.
Definition: ValueTypes.h:124
bool bitsLE(EVT VT) const
Return true if this has no more bits than VT.
Definition: ValueTypes.h:291
EVT getHalfNumVectorElementsVT(LLVMContext &Context) const
Definition: ValueTypes.h:431
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition: ValueTypes.h:144
bool is64BitVector() const
Return true if this is a 64-bit vector type.
Definition: ValueTypes.h:191