LLVM 23.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, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) Ty,
44#define GET_VT_RANGES
45#include "llvm/CodeGen/GenVT.inc"
46#undef GET_VT_ATTR
47#undef GET_VT_RANGES
48
49 VALUETYPE_SIZE = LAST_VALUETYPE + 1,
50 };
51
52 static_assert(FIRST_VALUETYPE > 0);
53 static_assert(LAST_VALUETYPE < token);
54
56
57 constexpr MVT() = default;
58 constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {}
59
60 bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; }
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
67 /// Support for debugging, callable in GDB: VT.dump()
68 LLVM_ABI void dump() const;
69
70 /// Implement operator<<.
71 LLVM_ABI void print(raw_ostream &OS) const;
72
73 /// Return true if this is a valid simple valuetype.
74 bool isValid() const {
75 return (SimpleTy >= MVT::FIRST_VALUETYPE &&
76 SimpleTy <= MVT::LAST_VALUETYPE);
77 }
78
79 /// Return true if this is a FP or a vector FP type.
80 bool isFloatingPoint() const {
81 return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
82 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
83 (SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE &&
84 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) ||
85 (SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE &&
86 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE));
87 }
88
89 /// Return true if this is an integer or a vector integer type.
90 bool isInteger() const {
91 return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
92 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
93 (SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE &&
94 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) ||
95 (SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE &&
96 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE));
97 }
98
99 /// Return true if this is an integer, not including vectors.
100 bool isScalarInteger() const {
101 return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
102 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
103 }
104
105 /// Return true if this is a vector value type.
106 bool isVector() const {
107 return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
108 SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
109 }
110
111 /// Return true if this is a vector value type where the
112 /// runtime length is machine dependent
113 bool isScalableVector() const {
114 return (SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE &&
115 SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE);
116 }
117
118 /// Return true if this is a RISCV vector tuple type where the
119 /// runtime length is machine dependent
120 bool isRISCVVectorTuple() const {
121 return (SimpleTy >= MVT::FIRST_RISCV_VECTOR_TUPLE_VALUETYPE &&
122 SimpleTy <= MVT::LAST_RISCV_VECTOR_TUPLE_VALUETYPE);
123 }
124
125 /// Return true if this is a custom target type that has a scalable size.
127 return SimpleTy == MVT::aarch64svcount || isRISCVVectorTuple();
128 }
129
130 /// Return true if the type is a scalable type.
131 bool isScalableVT() const {
133 }
134
135 bool isFixedLengthVector() const {
136 return (SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE &&
137 SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE);
138 }
139
140 /// Return true if this is a 16-bit vector type.
141 bool is16BitVector() const {
142 return (isFixedLengthVector() && getFixedSizeInBits() == 16);
143 }
144
145 /// Return true if this is a 32-bit vector type.
146 bool is32BitVector() const {
147 return (isFixedLengthVector() && getFixedSizeInBits() == 32);
148 }
149
150 /// Return true if this is a 64-bit vector type.
151 bool is64BitVector() const {
152 return (isFixedLengthVector() && getFixedSizeInBits() == 64);
153 }
154
155 /// Return true if this is a 128-bit vector type.
156 bool is128BitVector() const {
157 return (isFixedLengthVector() && getFixedSizeInBits() == 128);
158 }
159
160 /// Return true if this is a 256-bit vector type.
161 bool is256BitVector() const {
162 return (isFixedLengthVector() && getFixedSizeInBits() == 256);
163 }
164
165 /// Return true if this is a 512-bit vector type.
166 bool is512BitVector() const {
167 return (isFixedLengthVector() && getFixedSizeInBits() == 512);
168 }
169
170 /// Return true if this is a 1024-bit vector type.
171 bool is1024BitVector() const {
172 return (isFixedLengthVector() && getFixedSizeInBits() == 1024);
173 }
174
175 /// Return true if this is a 2048-bit vector type.
176 bool is2048BitVector() const {
177 return (isFixedLengthVector() && getFixedSizeInBits() == 2048);
178 }
179
180 /// Return true if this is a CHERI capability type.
181 bool isCheriCapability() const {
182 return (SimpleTy >= MVT::FIRST_CHERI_CAPABILITY_VALUETYPE) &&
183 (SimpleTy <= MVT::LAST_CHERI_CAPABILITY_VALUETYPE);
184 }
185
186 /// Return true if this is an overloaded type for TableGen.
187 bool isOverloaded() const {
188 switch (SimpleTy) {
189#define GET_VT_ATTR(Ty, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
190 case Ty: \
191 return Any;
192#include "llvm/CodeGen/GenVT.inc"
193#undef GET_VT_ATTR
194 default:
195 return false;
196 }
197 }
198
199 /// Return a vector with the same number of elements as this vector, but
200 /// with the element type converted to an integer type with the same
201 /// bitwidth.
203 MVT EltTy = getVectorElementType();
207 "Simple vector VT not representable by simple integer vector VT!");
208 return VecTy;
209 }
210
211 /// Return a VT for a vector type whose attributes match ourselves
212 /// with the exception of the element type that is chosen by the caller.
216 "Simple vector VT not representable by simple integer vector VT!");
217 return VecTy;
218 }
219
220 /// Return a VT for a vector type whose attributes match ourselves with
221 /// the exception of the element count that is chosen by the caller.
223 assert(isVector() && "Not a vector MVT!");
225 }
226
227 /// Return the type converted to an equivalently sized integer or vector
228 /// with integer element type. Similar to changeVectorElementTypeToInteger,
229 /// but also handles scalars.
235
236 /// Return a VT for a vector type with the same element type but
237 /// half the number of elements.
239 MVT EltVT = getVectorElementType();
240 auto EltCnt = getVectorElementCount();
241 assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
242 return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
243 }
244
245 // Return a VT for a vector type with the same element type but
246 // double the number of elements.
248 MVT EltVT = getVectorElementType();
249 auto EltCnt = getVectorElementCount();
250 return MVT::getVectorVT(EltVT, EltCnt * 2);
251 }
252
253 /// Returns true if the given vector is a power of 2.
254 bool isPow2VectorType() const {
255 unsigned NElts = getVectorMinNumElements();
256 return !(NElts & (NElts - 1));
257 }
258
259 /// Widens the length of the given vector MVT up to the nearest power of 2
260 /// and returns that type.
262 if (isPow2VectorType())
263 return *this;
264
266 unsigned NewMinCount = 1 << Log2_32_Ceil(NElts.getKnownMinValue());
267 NElts = ElementCount::get(NewMinCount, NElts.isScalable());
268 return MVT::getVectorVT(getVectorElementType(), NElts);
269 }
270
271 /// If this is a vector, return the element type, otherwise return this.
273 return isVector() ? getVectorElementType() : *this;
274 }
275
277 assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
278 static constexpr SimpleValueType EltTyTable[] = {
279#define GET_VT_ATTR(Ty, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
280 EltTy,
281#include "llvm/CodeGen/GenVT.inc"
282#undef GET_VT_ATTR
283 };
284 SimpleValueType VT = EltTyTable[SimpleTy - FIRST_VALUETYPE];
285 assert(VT != INVALID_SIMPLE_VALUE_TYPE && "Not a vector MVT!");
286 return VT;
287 }
288
289 /// Given a vector type, return the minimum number of elements it contains.
290 unsigned getVectorMinNumElements() const {
291 assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
292 static constexpr uint16_t NElemTable[] = {
293#define GET_VT_ATTR(Ty, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
294 NElem,
295#include "llvm/CodeGen/GenVT.inc"
296#undef GET_VT_ATTR
297 };
298 unsigned NElem = NElemTable[SimpleTy - FIRST_VALUETYPE];
299 assert(NElem != 0 && "Not a vector MVT!");
300 return NElem;
301 }
302
306
307 unsigned getVectorNumElements() const {
308 if (isScalableVector())
310 "Possible incorrect use of MVT::getVectorNumElements() for "
311 "scalable vector. Scalable flag may be dropped, use "
312 "MVT::getVectorElementCount() instead");
314 }
315
316 /// Returns the size of the specified MVT in bits.
317 ///
318 /// If the value type is a scalable vector type, the scalable property will
319 /// be set and the runtime size will be a positive integer multiple of the
320 /// base size.
322 static constexpr TypeSize SizeTable[] = {
323#define GET_VT_ATTR(Ty, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
324 TypeSize(Sz, Sc || Tup || Ty == aarch64svcount /* FIXME: Not in the td. \
325 */),
326#include "llvm/CodeGen/GenVT.inc"
327#undef GET_VT_ATTR
328 };
329
330 switch (SimpleTy) {
332 llvm_unreachable("getSizeInBits called on extended MVT.");
333 case Other:
334 llvm_unreachable("Value type is non-standard value, Other.");
335 case iPTR:
336 llvm_unreachable("Value type size is target-dependent. Ask TLI.");
337 case pAny:
338 case iAny:
339 case fAny:
340 case vAny:
341 case Any:
342 llvm_unreachable("Value type is overloaded.");
343 case token:
344 llvm_unreachable("Token type is a sentinel that cannot be used "
345 "in codegen and has no size");
346 case Metadata:
347 llvm_unreachable("Value type is metadata.");
348 default:
349 assert(SimpleTy < VALUETYPE_SIZE && "Unexpected value type!");
350 return SizeTable[SimpleTy - FIRST_VALUETYPE];
351 }
352 }
353
354 /// Return the size of the specified fixed width value type in bits. The
355 /// function will assert if the type is scalable.
357 return getSizeInBits().getFixedValue();
358 }
362 }
363
364 /// Return the number of bytes overwritten by a store of the specified value
365 /// type.
366 ///
367 /// If the value type is a scalable vector type, the scalable property will
368 /// be set and the runtime size will be a positive integer multiple of the
369 /// base size.
370 TypeSize getStoreSize() const {
371 TypeSize BaseSize = getSizeInBits();
372 return {(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};
373 }
374
375 // Return the number of bytes overwritten by a store of this value type or
376 // this value type's element type in the case of a vector.
379 }
380
381 /// Return the number of bits overwritten by a store of the specified value
382 /// type.
383 ///
384 /// If the value type is a scalable vector type, the scalable property will
385 /// be set and the runtime size will be a positive integer multiple of the
386 /// base size.
388 return getStoreSize() * 8;
389 }
390
391 /// Returns true if the number of bits for the type is a multiple of an
392 /// 8-bit byte.
393 bool isByteSized() const { return getSizeInBits().isKnownMultipleOf(8); }
394
395 /// Return true if we know at compile time this has more bits than VT.
396 bool knownBitsGT(MVT VT) const {
398 }
399
400 /// Return true if we know at compile time this has more than or the same
401 /// bits as VT.
402 bool knownBitsGE(MVT VT) const {
404 }
405
406 /// Return true if we know at compile time this has fewer bits than VT.
407 bool knownBitsLT(MVT VT) const {
409 }
410
411 /// Return true if we know at compile time this has fewer than or the same
412 /// bits as VT.
413 bool knownBitsLE(MVT VT) const {
415 }
416
417 /// Return true if this has more bits than VT.
418 bool bitsGT(MVT VT) const {
420 "Comparison between scalable and fixed types");
421 return knownBitsGT(VT);
422 }
423
424 /// Return true if this has no less bits than VT.
425 bool bitsGE(MVT VT) const {
427 "Comparison between scalable and fixed types");
428 return knownBitsGE(VT);
429 }
430
431 /// Return true if this has less bits than VT.
432 bool bitsLT(MVT VT) const {
434 "Comparison between scalable and fixed types");
435 return knownBitsLT(VT);
436 }
437
438 /// Return true if this has no more bits than VT.
439 bool bitsLE(MVT VT) const {
441 "Comparison between scalable and fixed types");
442 return knownBitsLE(VT);
443 }
445 static MVT getFloatingPointVT(unsigned BitWidth) {
446#define GET_VT_ATTR(Ty, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
447 if (FP == 3 && sz == BitWidth) \
448 return Ty;
449#include "llvm/CodeGen/GenVT.inc"
450#undef GET_VT_ATTR
451
452 llvm_unreachable("Bad bit width!");
453 }
455 static MVT getIntegerVT(unsigned BitWidth) {
456#define GET_VT_ATTR(Ty, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
457 if (Int == 3 && sz == BitWidth) \
458 return Ty;
459#include "llvm/CodeGen/GenVT.inc"
460#undef GET_VT_ATTR
461
463 }
465 static MVT getVectorVT(MVT VT, unsigned NumElements) {
466#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
467 if (!Sc && !Tup && VT.SimpleTy == ElTy && NumElements == nElem) \
468 return Ty;
469#include "llvm/CodeGen/GenVT.inc"
470#undef GET_VT_VECATTR
471
473 }
475 static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
476#define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy) \
477 if (Sc && VT.SimpleTy == ElTy && NumElements == nElem) \
478 return Ty;
479#include "llvm/CodeGen/GenVT.inc"
480#undef GET_VT_VECATTR
481
483 }
485 static MVT getRISCVVectorTupleVT(unsigned Sz, unsigned NFields) {
486#define GET_VT_ATTR(Ty, sz, Any, Int, FP, Vec, Sc, Tup, NF, nElem, EltTy) \
487 if (Tup && sz == Sz && NF == NFields) \
488 return Ty;
489#include "llvm/CodeGen/GenVT.inc"
490#undef GET_VT_ATTR
491
492 llvm_unreachable("Invalid RISCV vector tuple type");
493 }
494
495 /// Given a RISC-V vector tuple type, return the num_fields.
496 unsigned getRISCVVectorTupleNumFields() const {
497 assert(isRISCVVectorTuple() && SimpleTy >= FIRST_VALUETYPE &&
498 SimpleTy <= LAST_VALUETYPE);
499 static constexpr uint8_t NFTable[] = {
500#define GET_VT_ATTR(Ty, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) NF,
501#include "llvm/CodeGen/GenVT.inc"
502#undef GET_VT_ATTR
503 };
504 return NFTable[SimpleTy - FIRST_VALUETYPE];
505 }
507 static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) {
508 if (IsScalable)
509 return getScalableVectorVT(VT, NumElements);
510 return getVectorVT(VT, NumElements);
511 }
513 static MVT getVectorVT(MVT VT, ElementCount EC) {
514 if (EC.isScalable())
515 return getScalableVectorVT(VT, EC.getKnownMinValue());
516 return getVectorVT(VT, EC.getKnownMinValue());
517 }
518
519 /// Return the value type corresponding to the specified type.
520 /// If HandleUnknown is true, unknown types are returned as Other,
521 /// otherwise they are invalid.
522 /// NB: This includes pointer types, which require a DataLayout to convert
523 /// to a concrete value type.
524 LLVM_ABI static MVT getVT(Type *Ty, bool HandleUnknown = false);
525
526 /// Returns an APFloat semantics tag appropriate for the value type. If this
527 /// is a vector type, the element semantics are returned.
529
530 public:
531 /// SimpleValueType Iteration
532 /// @{
533 static auto all_valuetypes() {
534 return enum_seq_inclusive(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE,
536 }
538 static auto integer_valuetypes() {
539 return enum_seq_inclusive(MVT::FIRST_INTEGER_VALUETYPE,
540 MVT::LAST_INTEGER_VALUETYPE,
542 }
544 static auto fp_valuetypes() {
545 return enum_seq_inclusive(MVT::FIRST_FP_VALUETYPE, MVT::LAST_FP_VALUETYPE,
547 }
549 static auto vector_valuetypes() {
550 return enum_seq_inclusive(MVT::FIRST_VECTOR_VALUETYPE,
551 MVT::LAST_VECTOR_VALUETYPE,
553 }
555 static auto fixedlen_vector_valuetypes() {
556 return enum_seq_inclusive(MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE,
557 MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
559 }
561 static auto scalable_vector_valuetypes() {
562 return enum_seq_inclusive(MVT::FIRST_SCALABLE_VECTOR_VALUETYPE,
563 MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
565 }
568 return enum_seq_inclusive(MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
569 MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
571 }
573 static auto fp_fixedlen_vector_valuetypes() {
574 return enum_seq_inclusive(MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE,
575 MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
577 }
580 return enum_seq_inclusive(MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
581 MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
583 }
585 static auto fp_scalable_vector_valuetypes() {
586 return enum_seq_inclusive(MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE,
587 MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE,
589 }
591 static auto cheri_capability_valuetypes() {
592 return enum_seq_inclusive(MVT::FIRST_CHERI_CAPABILITY_VALUETYPE,
593 MVT::LAST_CHERI_CAPABILITY_VALUETYPE,
595 }
596 /// @}
597 };
599 inline raw_ostream &operator<<(raw_ostream &OS, const MVT &VT) {
600 VT.print(OS);
601 return OS;
602 }
603
604} // end namespace llvm
605
606#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.
MVT changeVectorElementCount(ElementCount EC) const
Return a VT for a vector type whose attributes match ourselves with the exception of the element coun...
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<<.
static auto cheri_capability_valuetypes()
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:64
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:180
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:168
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
Definition TypeSize.h:165
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.
Definition Types.h:26
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:344
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:109
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
Definition Error.cpp:173
@ Other
Any other memory.
Definition ModRef.h:68
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
constexpr unsigned BitWidth