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