LLVM 22.0.0git
MachineValueType.h
Go to the documentation of this file.
1//===- CodeGenTypes/MachineValueType.h - Machine-Level 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 machine-level target independent types which
10// legal values in the code generator use.
11//
12// Constants and properties are defined in ValueTypes.td.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_CODEGEN_MACHINEVALUETYPE_H
17#define LLVM_CODEGEN_MACHINEVALUETYPE_H
18
19#include "llvm/ADT/Sequence.h"
24#include <cassert>
25#include <cstdint>
26
27namespace llvm {
28
29 class Type;
30 struct fltSemantics;
31 class raw_ostream;
32
33 /// Machine Value Type. Every type that is supported natively by some
34 /// processor targeted by LLVM occurs here. This means that any legal value
35 /// type can be represented by an MVT.
36 class MVT {
37 public:
39 // Simple value types that aren't explicitly part of this enumeration
40 // are considered extended value types.
42
43#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
44 Ty = n,
45#define GET_VT_RANGES
46#include "llvm/CodeGen/GenVT.inc"
47#undef GET_VT_ATTR
48#undef GET_VT_RANGES
49
50 VALUETYPE_SIZE = LAST_VALUETYPE + 1,
51 };
52
53 static_assert(FIRST_VALUETYPE > 0);
54 static_assert(LAST_VALUETYPE < token);
55
57
58 constexpr MVT() = default;
59 constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {}
60
61 bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; }
62 bool operator<(const MVT& S) const { return SimpleTy < S.SimpleTy; }
63 bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; }
64 bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; }
65 bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; }
66 bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
67
68 /// Support for debugging, callable in GDB: VT.dump()
69 LLVM_ABI void dump() const;
70
71 /// Implement operator<<.
72 LLVM_ABI void print(raw_ostream &OS) const;
73
74 /// Return true if this is a valid simple valuetype.
75 bool isValid() const {
76 return (SimpleTy >= MVT::FIRST_VALUETYPE &&
77 SimpleTy <= MVT::LAST_VALUETYPE);
78 }
79
80 /// Return true if this is a FP or a vector FP type.
81 bool isFloatingPoint() const {
82 return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
83 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
84 (SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE &&
85 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) ||
86 (SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE &&
87 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE));
88 }
89
90 /// Return true if this is an integer or a vector integer type.
91 bool isInteger() const {
92 return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
93 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
94 (SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE &&
95 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) ||
96 (SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE &&
97 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE));
98 }
99
100 /// Return true if this is an integer, not including vectors.
101 bool isScalarInteger() const {
102 return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
103 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
104 }
105
106 /// Return true if this is a vector value type.
107 bool isVector() const {
108 return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
109 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
110 }
111
112 /// Return true if this is a vector value type where the
113 /// runtime length is machine dependent
114 bool isScalableVector() const {
115 return (SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE &&
116 SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE);
117 }
118
119 /// Return true if this is a RISCV vector tuple type where the
120 /// runtime length is machine dependent
121 bool isRISCVVectorTuple() const {
122 return (SimpleTy >= MVT::FIRST_RISCV_VECTOR_TUPLE_VALUETYPE &&
123 SimpleTy <= MVT::LAST_RISCV_VECTOR_TUPLE_VALUETYPE);
124 }
125
126 /// Return true if this is a custom target type that has a scalable size.
128 return SimpleTy == MVT::aarch64svcount || isRISCVVectorTuple();
129 }
130
131 /// Return true if the type is a scalable type.
132 bool isScalableVT() const {
134 }
135
136 bool isFixedLengthVector() const {
137 return (SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE &&
138 SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE);
139 }
140
141 /// Return true if this is a 16-bit vector type.
142 bool is16BitVector() const {
143 return (isFixedLengthVector() && getFixedSizeInBits() == 16);
144 }
145
146 /// Return true if this is a 32-bit vector type.
147 bool is32BitVector() const {
148 return (isFixedLengthVector() && getFixedSizeInBits() == 32);
149 }
150
151 /// Return true if this is a 64-bit vector type.
152 bool is64BitVector() const {
153 return (isFixedLengthVector() && getFixedSizeInBits() == 64);
154 }
155
156 /// Return true if this is a 128-bit vector type.
157 bool is128BitVector() const {
158 return (isFixedLengthVector() && getFixedSizeInBits() == 128);
159 }
160
161 /// Return true if this is a 256-bit vector type.
162 bool is256BitVector() const {
163 return (isFixedLengthVector() && getFixedSizeInBits() == 256);
164 }
165
166 /// Return true if this is a 512-bit vector type.
167 bool is512BitVector() const {
168 return (isFixedLengthVector() && getFixedSizeInBits() == 512);
169 }
170
171 /// Return true if this is a 1024-bit vector type.
172 bool is1024BitVector() const {
173 return (isFixedLengthVector() && getFixedSizeInBits() == 1024);
174 }
175
176 /// Return true if this is a 2048-bit vector type.
177 bool is2048BitVector() const {
178 return (isFixedLengthVector() && getFixedSizeInBits() == 2048);
179 }
180
181 /// Return true if this is a CHERI capability type.
182 bool isCheriCapability() const {
183 return (SimpleTy >= MVT::FIRST_CHERI_CAPABILITY_VALUETYPE) &&
184 (SimpleTy <= MVT::LAST_CHERI_CAPABILITY_VALUETYPE);
185 }
186
187 /// Return true if this is an overloaded type for TableGen.
188 bool isOverloaded() const {
189 switch (SimpleTy) {
190#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
191 case Ty: \
192 return Any;
193#include "llvm/CodeGen/GenVT.inc"
194#undef GET_VT_ATTR
195 default:
196 return false;
197 }
198 }
199
200 /// Return a vector with the same number of elements as this vector, but
201 /// with the element type converted to an integer type with the same
202 /// bitwidth.
204 MVT EltTy = getVectorElementType();
205 MVT IntTy = MVT::getIntegerVT(EltTy.getSizeInBits());
208 "Simple vector VT not representable by simple integer vector VT!");
209 return VecTy;
210 }
211
212 /// Return a VT for a vector type whose attributes match ourselves
213 /// with the exception of the element type that is chosen by the caller.
217 "Simple vector VT not representable by simple integer vector VT!");
218 return VecTy;
219 }
220
221 /// Return the type converted to an equivalently sized integer or vector
222 /// with integer element type. Similar to changeVectorElementTypeToInteger,
223 /// but also handles scalars.
229
230 /// Return a VT for a vector type with the same element type but
231 /// half the number of elements.
233 MVT EltVT = getVectorElementType();
234 auto EltCnt = getVectorElementCount();
235 assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
236 return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
237 }
238
239 // Return a VT for a vector type with the same element type but
240 // double the number of elements.
242 MVT EltVT = getVectorElementType();
243 auto EltCnt = getVectorElementCount();
244 return MVT::getVectorVT(EltVT, EltCnt * 2);
245 }
246
247 /// Returns true if the given vector is a power of 2.
248 bool isPow2VectorType() const {
249 unsigned NElts = getVectorMinNumElements();
250 return !(NElts & (NElts - 1));
251 }
252
253 /// Widens the length of the given vector MVT up to the nearest power of 2
254 /// and returns that type.
256 if (isPow2VectorType())
257 return *this;
258
260 unsigned NewMinCount = 1 << Log2_32_Ceil(NElts.getKnownMinValue());
261 NElts = ElementCount::get(NewMinCount, NElts.isScalable());
262 return MVT::getVectorVT(getVectorElementType(), NElts);
263 }
264
265 /// If this is a vector, return the element type, otherwise return this.
267 return isVector() ? getVectorElementType() : *this;
268 }
269
271 assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
272 static constexpr SimpleValueType EltTyTable[] = {
273#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
274 EltTy,
275#include "llvm/CodeGen/GenVT.inc"
276#undef GET_VT_ATTR
277 };
278 SimpleValueType VT = EltTyTable[SimpleTy - FIRST_VALUETYPE];
279 assert(VT != INVALID_SIMPLE_VALUE_TYPE && "Not a vector MVT!");
280 return VT;
281 }
282
283 /// Given a vector type, return the minimum number of elements it contains.
284 unsigned getVectorMinNumElements() const {
285 assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
286 static constexpr uint16_t NElemTable[] = {
287#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
288 NElem,
289#include "llvm/CodeGen/GenVT.inc"
290#undef GET_VT_ATTR
291 };
292 unsigned NElem = NElemTable[SimpleTy - FIRST_VALUETYPE];
293 assert(NElem != 0 && "Not a vector MVT!");
294 return NElem;
295 }
296
300
301 unsigned getVectorNumElements() const {
302 if (isScalableVector())
304 "Possible incorrect use of MVT::getVectorNumElements() for "
305 "scalable vector. Scalable flag may be dropped, use "
306 "MVT::getVectorElementCount() instead");
308 }
309
310 /// Returns the size of the specified MVT in bits.
311 ///
312 /// If the value type is a scalable vector type, the scalable property will
313 /// be set and the runtime size will be a positive integer multiple of the
314 /// base size.
316 static constexpr TypeSize SizeTable[] = {
317#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
318 TypeSize(Sz, Sc || Tup || Ty == aarch64svcount /* FIXME: Not in the td. \
319 */),
320#include "llvm/CodeGen/GenVT.inc"
321#undef GET_VT_ATTR
322 };
323
324 switch (SimpleTy) {
326 llvm_unreachable("getSizeInBits called on extended MVT.");
327 case Other:
328 llvm_unreachable("Value type is non-standard value, Other.");
329 case iPTR:
330 llvm_unreachable("Value type size is target-dependent. Ask TLI.");
331 case pAny:
332 case iAny:
333 case fAny:
334 case vAny:
335 case Any:
336 llvm_unreachable("Value type is overloaded.");
337 case token:
338 llvm_unreachable("Token type is a sentinel that cannot be used "
339 "in codegen and has no size");
340 case Metadata:
341 llvm_unreachable("Value type is metadata.");
342 default:
343 assert(SimpleTy < VALUETYPE_SIZE && "Unexpected value type!");
344 return SizeTable[SimpleTy - FIRST_VALUETYPE];
345 }
346 }
347
348 /// Return the size of the specified fixed width value type in bits. The
349 /// function will assert if the type is scalable.
351 return getSizeInBits().getFixedValue();
352 }
356 }
357
358 /// Return the number of bytes overwritten by a store of the specified value
359 /// type.
360 ///
361 /// If the value type is a scalable vector type, the scalable property will
362 /// be set and the runtime size will be a positive integer multiple of the
363 /// base size.
364 TypeSize getStoreSize() const {
365 TypeSize BaseSize = getSizeInBits();
366 return {(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};
367 }
368
369 // Return the number of bytes overwritten by a store of this value type or
370 // this value type's element type in the case of a vector.
373 }
374
375 /// Return the number of bits 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 return getStoreSize() * 8;
383 }
384
385 /// Returns true if the number of bits for the type is a multiple of an
386 /// 8-bit byte.
387 bool isByteSized() const { return getSizeInBits().isKnownMultipleOf(8); }
388
389 /// Return true if we know at compile time this has more bits than VT.
390 bool knownBitsGT(MVT VT) const {
392 }
393
394 /// Return true if we know at compile time this has more than or the same
395 /// bits as VT.
396 bool knownBitsGE(MVT VT) const {
398 }
399
400 /// Return true if we know at compile time this has fewer bits than VT.
401 bool knownBitsLT(MVT VT) const {
403 }
404
405 /// Return true if we know at compile time this has fewer than or the same
406 /// bits as VT.
407 bool knownBitsLE(MVT VT) const {
409 }
410
411 /// Return true if this has more bits than VT.
412 bool bitsGT(MVT VT) const {
414 "Comparison between scalable and fixed types");
415 return knownBitsGT(VT);
416 }
417
418 /// Return true if this has no less bits than VT.
419 bool bitsGE(MVT VT) const {
421 "Comparison between scalable and fixed types");
422 return knownBitsGE(VT);
423 }
424
425 /// Return true if this has less bits than VT.
426 bool bitsLT(MVT VT) const {
428 "Comparison between scalable and fixed types");
429 return knownBitsLT(VT);
430 }
431
432 /// Return true if this has no more bits than VT.
433 bool bitsLE(MVT VT) const {
435 "Comparison between scalable and fixed types");
436 return knownBitsLE(VT);
437 }
439 static MVT getFloatingPointVT(unsigned BitWidth) {
440#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
441 if (FP == 3 && sz == BitWidth) \
442 return Ty;
443#include "llvm/CodeGen/GenVT.inc"
444#undef GET_VT_ATTR
445
446 llvm_unreachable("Bad bit width!");
447 }
449 static MVT getIntegerVT(unsigned BitWidth) {
450#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
451 if (Int == 3 && sz == BitWidth) \
452 return Ty;
453#include "llvm/CodeGen/GenVT.inc"
454#undef GET_VT_ATTR
455
457 }
459 static MVT getVectorVT(MVT VT, unsigned NumElements) {
460#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
461 if (!Sc && !Tup && VT.SimpleTy == ElTy && NumElements == nElem) \
462 return Ty;
463#include "llvm/CodeGen/GenVT.inc"
464#undef GET_VT_VECATTR
465
467 }
469 static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
470#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
471 if (Sc && VT.SimpleTy == ElTy && NumElements == nElem) \
472 return Ty;
473#include "llvm/CodeGen/GenVT.inc"
474#undef GET_VT_VECATTR
475
477 }
479 static MVT getRISCVVectorTupleVT(unsigned Sz, unsigned NFields) {
480#define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, nElem, EltTy) \
481 if (Tup && sz == Sz && NF == NFields) \
482 return Ty;
483#include "llvm/CodeGen/GenVT.inc"
484#undef GET_VT_ATTR
485
486 llvm_unreachable("Invalid RISCV vector tuple type");
487 }
488
489 /// Given a RISC-V vector tuple type, return the num_fields.
490 unsigned getRISCVVectorTupleNumFields() const {
491 assert(isRISCVVectorTuple() && SimpleTy >= FIRST_VALUETYPE &&
492 SimpleTy <= LAST_VALUETYPE);
493 static constexpr uint8_t NFTable[] = {
494#define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
495 NF,
496#include "llvm/CodeGen/GenVT.inc"
497#undef GET_VT_ATTR
498 };
499 return NFTable[SimpleTy - FIRST_VALUETYPE];
500 }
502 static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) {
503 if (IsScalable)
504 return getScalableVectorVT(VT, NumElements);
505 return getVectorVT(VT, NumElements);
506 }
508 static MVT getVectorVT(MVT VT, ElementCount EC) {
509 if (EC.isScalable())
510 return getScalableVectorVT(VT, EC.getKnownMinValue());
511 return getVectorVT(VT, EC.getKnownMinValue());
512 }
513
514 /// Return the value type corresponding to the specified type.
515 /// If HandleUnknown is true, unknown types are returned as Other,
516 /// otherwise they are invalid.
517 /// NB: This includes pointer types, which require a DataLayout to convert
518 /// to a concrete value type.
519 LLVM_ABI static MVT getVT(Type *Ty, bool HandleUnknown = false);
520
521 /// Returns an APFloat semantics tag appropriate for the value type. If this
522 /// is a vector type, the element semantics are returned.
524
525 public:
526 /// SimpleValueType Iteration
527 /// @{
528 static auto all_valuetypes() {
529 return enum_seq_inclusive(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE,
531 }
533 static auto integer_valuetypes() {
534 return enum_seq_inclusive(MVT::FIRST_INTEGER_VALUETYPE,
535 MVT::LAST_INTEGER_VALUETYPE,
537 }
539 static auto fp_valuetypes() {
540 return enum_seq_inclusive(MVT::FIRST_FP_VALUETYPE, MVT::LAST_FP_VALUETYPE,
542 }
544 static auto vector_valuetypes() {
545 return enum_seq_inclusive(MVT::FIRST_VECTOR_VALUETYPE,
546 MVT::LAST_VECTOR_VALUETYPE,
548 }
550 static auto fixedlen_vector_valuetypes() {
551 return enum_seq_inclusive(MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE,
552 MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
554 }
556 static auto scalable_vector_valuetypes() {
557 return enum_seq_inclusive(MVT::FIRST_SCALABLE_VECTOR_VALUETYPE,
558 MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
560 }
563 return enum_seq_inclusive(MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
564 MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
566 }
568 static auto fp_fixedlen_vector_valuetypes() {
569 return enum_seq_inclusive(MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE,
570 MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
572 }
575 return enum_seq_inclusive(MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
576 MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
578 }
580 static auto fp_scalable_vector_valuetypes() {
581 return enum_seq_inclusive(MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE,
582 MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE,
584 }
585 /// @}
586 };
588 inline raw_ostream &operator<<(raw_ostream &OS, const MVT &VT) {
589 VT.print(OS);
590 return OS;
591 }
592
593} // end namespace llvm
594
595#endif // LLVM_CODEGEN_MACHINEVALUETYPE_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition Compiler.h:213
Provides some synthesis utilities to produce sequences of values.
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition TypeSize.h:315
Machine Value Type.
LLVM_ABI void dump() const
Support for debugging, callable in GDB: VT.dump()
static MVT getFloatingPointVT(unsigned BitWidth)
bool isByteSized() const
Returns true if the number of bits for the type is a multiple of an 8-bit byte.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
bool knownBitsGT(MVT VT) const
Return true if we know at compile time this has more bits than VT.
@ INVALID_SIMPLE_VALUE_TYPE
static auto integer_fixedlen_vector_valuetypes()
unsigned getVectorMinNumElements() const
Given a vector type, return the minimum number of elements it contains.
bool isRISCVVectorTuple() const
Return true if this is a RISCV vector tuple type where the runtime length is machine dependent.
bool operator>(const MVT &S) const
SimpleValueType SimpleTy
bool isOverloaded() const
Return true if this is an overloaded type for TableGen.
bool isScalableTargetExtVT() const
Return true if this is a custom target type that has a scalable size.
uint64_t getScalarSizeInBits() const
MVT changeVectorElementType(MVT EltVT) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element type...
bool operator<=(const MVT &S) const
constexpr MVT()=default
bool bitsLE(MVT VT) const
Return true if this has no more bits than VT.
unsigned getVectorNumElements() const
bool knownBitsLT(MVT VT) const
Return true if we know at compile time this has fewer bits than VT.
static MVT getRISCVVectorTupleVT(unsigned Sz, unsigned NFields)
bool isVector() const
Return true if this is a vector value type.
bool isInteger() const
Return true if this is an integer or a vector integer type.
bool isScalableVector() const
Return true if this is a vector value type where the runtime length is machine dependent.
static MVT getScalableVectorVT(MVT VT, unsigned NumElements)
bool is16BitVector() const
Return true if this is a 16-bit vector type.
bool is32BitVector() const
Return true if this is a 32-bit vector type.
unsigned getRISCVVectorTupleNumFields() const
Given a RISC-V vector tuple type, return the num_fields.
MVT changeTypeToInteger()
Return the type converted to an equivalently sized integer or vector with integer element type.
static LLVM_ABI MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
bool isScalableVT() const
Return true if the type is a scalable type.
bool bitsLT(MVT VT) const
Return true if this has less bits than VT.
static auto all_valuetypes()
SimpleValueType Iteration.
bool operator<(const MVT &S) const
bool is512BitVector() const
Return true if this is a 512-bit vector type.
bool operator==(const MVT &S) const
static auto integer_valuetypes()
bool is1024BitVector() const
Return true if this is a 1024-bit vector type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool isPow2VectorType() const
Returns true if the given vector is a power of 2.
uint64_t getScalarStoreSize() const
static auto scalable_vector_valuetypes()
static auto fixedlen_vector_valuetypes()
uint64_t getFixedSizeInBits() const
Return the size of the specified fixed width value type in bits.
LLVM_ABI const fltSemantics & getFltSemantics() const
Returns an APFloat semantics tag appropriate for the value type.
bool bitsGT(MVT VT) const
Return true if this has more bits than VT.
bool isFixedLengthVector() const
static auto vector_valuetypes()
bool is256BitVector() const
Return true if this is a 256-bit vector type.
ElementCount getVectorElementCount() const
bool isCheriCapability() const
Return true if this is a CHERI capability type.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
bool bitsGE(MVT VT) const
Return true if this has no less bits than VT.
bool isScalarInteger() const
Return true if this is an integer, not including vectors.
TypeSize getStoreSizeInBits() const
Return the number of bits overwritten by a store of the specified value type.
static MVT getVectorVT(MVT VT, unsigned NumElements)
bool knownBitsGE(MVT VT) const
Return true if we know at compile time this has more than or the same bits as VT.
static auto fp_scalable_vector_valuetypes()
MVT getVectorElementType() const
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
bool operator>=(const MVT &S) const
bool isValid() const
Return true if this is a valid simple valuetype.
static MVT getIntegerVT(unsigned BitWidth)
MVT getDoubleNumVectorElementsVT() const
static auto fp_valuetypes()
MVT getHalfNumVectorElementsVT() const
Return a VT for a vector type with the same element type but half the number of elements.
bool knownBitsLE(MVT VT) const
Return true if we know at compile time this has fewer than or the same bits as VT.
bool operator!=(const MVT &S) const
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
static auto integer_scalable_vector_valuetypes()
LLVM_ABI void print(raw_ostream &OS) const
Implement operator<<.
bool is64BitVector() const
Return true if this is a 64-bit vector type.
MVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
MVT getPow2VectorType() const
Widens the length of the given vector MVT up to the nearest power of 2 and returns that type.
static auto fp_fixedlen_vector_valuetypes()
constexpr MVT(SimpleValueType SVT)
bool is2048BitVector() const
Return true if this is a 2048-bit vector type.
Root of the metadata hierarchy.
Definition Metadata.h:63
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:181
constexpr ScalarTy getFixedValue() const
Definition TypeSize.h:200
static constexpr bool isKnownLE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition TypeSize.h:230
static constexpr bool isKnownLT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition TypeSize.h:216
constexpr bool isScalable() const
Returns whether the quantity is scaled by a runtime quantity (vscale).
Definition TypeSize.h:169
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition TypeSize.h:166
static constexpr bool isKnownGT(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition TypeSize.h:223
static constexpr bool isKnownGE(const FixedOrScalableQuantity &LHS, const FixedOrScalableQuantity &RHS)
Definition TypeSize.h:237
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
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:355
auto enum_seq_inclusive(EnumT Begin, EnumT End)
Iterate over an enum type from Begin to End inclusive.
Definition Sequence.h:364
constexpr force_iteration_on_noniterable_enum_t force_iteration_on_noniterable_enum
Definition Sequence.h:108
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
Definition Error.cpp:177
@ Other
Any other memory.
Definition ModRef.h:68
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr unsigned BitWidth