xref: /llvm-project/llvm/include/llvm/CodeGenTypes/MachineValueType.h (revision 206ee7191834186ae78bf57fcf21d29dd7ce24cf)
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"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/MathExtras.h"
22 #include "llvm/Support/TypeSize.h"
23 #include <cassert>
24 #include <cstdint>
25 
26 namespace llvm {
27 
28   class Type;
29   struct fltSemantics;
30   class raw_ostream;
31 
32   /// Machine Value Type. Every type that is supported natively by some
33   /// processor targeted by LLVM occurs here. This means that any legal value
34   /// type can be represented by an MVT.
35   class MVT {
36   public:
37     enum SimpleValueType : uint16_t {
38       // Simple value types that aren't explicitly part of this enumeration
39       // are considered extended value types.
40       INVALID_SIMPLE_VALUE_TYPE = 0,
41 
42 #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
43     Ty = n,
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 
55     SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE;
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     void dump() const;
69 
70     /// Implement operator<<.
71     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.
126     bool isScalableTargetExtVT() const {
127       return SimpleTy == MVT::aarch64svcount || isRISCVVectorTuple();
128     }
129 
130     /// Return true if the type is a scalable type.
131     bool isScalableVT() const {
132       return isScalableVector() || isScalableTargetExtVT();
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 an overloaded type for TableGen.
181     bool isOverloaded() const {
182       switch (SimpleTy) {
183 #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
184     case Ty:                                                                   \
185       return Any;
186 #include "llvm/CodeGen/GenVT.inc"
187 #undef GET_VT_ATTR
188       default:
189         return false;
190       }
191     }
192 
193     /// Return a vector with the same number of elements as this vector, but
194     /// with the element type converted to an integer type with the same
195     /// bitwidth.
196     MVT changeVectorElementTypeToInteger() const {
197       MVT EltTy = getVectorElementType();
198       MVT IntTy = MVT::getIntegerVT(EltTy.getSizeInBits());
199       MVT VecTy = MVT::getVectorVT(IntTy, getVectorElementCount());
200       assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
201              "Simple vector VT not representable by simple integer vector VT!");
202       return VecTy;
203     }
204 
205     /// Return a VT for a vector type whose attributes match ourselves
206     /// with the exception of the element type that is chosen by the caller.
207     MVT changeVectorElementType(MVT EltVT) const {
208       MVT VecTy = MVT::getVectorVT(EltVT, getVectorElementCount());
209       assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
210              "Simple vector VT not representable by simple integer vector VT!");
211       return VecTy;
212     }
213 
214     /// Return the type converted to an equivalently sized integer or vector
215     /// with integer element type. Similar to changeVectorElementTypeToInteger,
216     /// but also handles scalars.
217     MVT changeTypeToInteger() {
218       if (isVector())
219         return changeVectorElementTypeToInteger();
220       return MVT::getIntegerVT(getSizeInBits());
221     }
222 
223     /// Return a VT for a vector type with the same element type but
224     /// half the number of elements.
225     MVT getHalfNumVectorElementsVT() const {
226       MVT EltVT = getVectorElementType();
227       auto EltCnt = getVectorElementCount();
228       assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
229       return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
230     }
231 
232     // Return a VT for a vector type with the same element type but
233     // double the number of elements.
234     MVT getDoubleNumVectorElementsVT() const {
235       MVT EltVT = getVectorElementType();
236       auto EltCnt = getVectorElementCount();
237       return MVT::getVectorVT(EltVT, EltCnt * 2);
238     }
239 
240     /// Returns true if the given vector is a power of 2.
241     bool isPow2VectorType() const {
242       unsigned NElts = getVectorMinNumElements();
243       return !(NElts & (NElts - 1));
244     }
245 
246     /// Widens the length of the given vector MVT up to the nearest power of 2
247     /// and returns that type.
248     MVT getPow2VectorType() const {
249       if (isPow2VectorType())
250         return *this;
251 
252       ElementCount NElts = getVectorElementCount();
253       unsigned NewMinCount = 1 << Log2_32_Ceil(NElts.getKnownMinValue());
254       NElts = ElementCount::get(NewMinCount, NElts.isScalable());
255       return MVT::getVectorVT(getVectorElementType(), NElts);
256     }
257 
258     /// If this is a vector, return the element type, otherwise return this.
259     MVT getScalarType() const {
260       return isVector() ? getVectorElementType() : *this;
261     }
262 
263     MVT getVectorElementType() const {
264       assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
265       static constexpr SimpleValueType EltTyTable[] = {
266 #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
267     EltTy,
268 #include "llvm/CodeGen/GenVT.inc"
269 #undef GET_VT_ATTR
270       };
271       SimpleValueType VT = EltTyTable[SimpleTy - FIRST_VALUETYPE];
272       assert(VT != INVALID_SIMPLE_VALUE_TYPE && "Not a vector MVT!");
273       return VT;
274     }
275 
276     /// Given a vector type, return the minimum number of elements it contains.
277     unsigned getVectorMinNumElements() const {
278       assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
279       static constexpr uint16_t NElemTable[] = {
280 #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
281     NElem,
282 #include "llvm/CodeGen/GenVT.inc"
283 #undef GET_VT_ATTR
284       };
285       unsigned NElem = NElemTable[SimpleTy - FIRST_VALUETYPE];
286       assert(NElem != 0 && "Not a vector MVT!");
287       return NElem;
288     }
289 
290     ElementCount getVectorElementCount() const {
291       return ElementCount::get(getVectorMinNumElements(), isScalableVector());
292     }
293 
294     unsigned getVectorNumElements() const {
295       if (isScalableVector())
296         llvm::reportInvalidSizeRequest(
297             "Possible incorrect use of MVT::getVectorNumElements() for "
298             "scalable vector. Scalable flag may be dropped, use "
299             "MVT::getVectorElementCount() instead");
300       return getVectorMinNumElements();
301     }
302 
303     /// Returns the size of the specified MVT in bits.
304     ///
305     /// If the value type is a scalable vector type, the scalable property will
306     /// be set and the runtime size will be a positive integer multiple of the
307     /// base size.
308     TypeSize getSizeInBits() const {
309       static constexpr TypeSize SizeTable[] = {
310 #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
311     TypeSize(Sz, Sc || Tup || Ty == aarch64svcount /* FIXME: Not in the td.    \
312                                                     */),
313 #include "llvm/CodeGen/GenVT.inc"
314 #undef GET_VT_ATTR
315       };
316 
317       switch (SimpleTy) {
318       case INVALID_SIMPLE_VALUE_TYPE:
319         llvm_unreachable("getSizeInBits called on extended MVT.");
320       case Other:
321         llvm_unreachable("Value type is non-standard value, Other.");
322       case iPTR:
323         llvm_unreachable("Value type size is target-dependent. Ask TLI.");
324       case pAny:
325       case iAny:
326       case fAny:
327       case vAny:
328       case Any:
329         llvm_unreachable("Value type is overloaded.");
330       case token:
331         llvm_unreachable("Token type is a sentinel that cannot be used "
332                          "in codegen and has no size");
333       case Metadata:
334         llvm_unreachable("Value type is metadata.");
335       default:
336         assert(SimpleTy < VALUETYPE_SIZE && "Unexpected value type!");
337         return SizeTable[SimpleTy - FIRST_VALUETYPE];
338       }
339     }
340 
341     /// Return the size of the specified fixed width value type in bits. The
342     /// function will assert if the type is scalable.
343     uint64_t getFixedSizeInBits() const {
344       return getSizeInBits().getFixedValue();
345     }
346 
347     uint64_t getScalarSizeInBits() const {
348       return getScalarType().getSizeInBits().getFixedValue();
349     }
350 
351     /// Return the number of bytes overwritten by a store of the specified value
352     /// type.
353     ///
354     /// If the value type is a scalable vector type, the scalable property will
355     /// be set and the runtime size will be a positive integer multiple of the
356     /// base size.
357     TypeSize getStoreSize() const {
358       TypeSize BaseSize = getSizeInBits();
359       return {(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};
360     }
361 
362     // Return the number of bytes overwritten by a store of this value type or
363     // this value type's element type in the case of a vector.
364     uint64_t getScalarStoreSize() const {
365       return getScalarType().getStoreSize().getFixedValue();
366     }
367 
368     /// Return the number of bits overwritten by a store of the specified value
369     /// type.
370     ///
371     /// If the value type is a scalable vector type, the scalable property will
372     /// be set and the runtime size will be a positive integer multiple of the
373     /// base size.
374     TypeSize getStoreSizeInBits() const {
375       return getStoreSize() * 8;
376     }
377 
378     /// Returns true if the number of bits for the type is a multiple of an
379     /// 8-bit byte.
380     bool isByteSized() const { return getSizeInBits().isKnownMultipleOf(8); }
381 
382     /// Return true if we know at compile time this has more bits than VT.
383     bool knownBitsGT(MVT VT) const {
384       return TypeSize::isKnownGT(getSizeInBits(), VT.getSizeInBits());
385     }
386 
387     /// Return true if we know at compile time this has more than or the same
388     /// bits as VT.
389     bool knownBitsGE(MVT VT) const {
390       return TypeSize::isKnownGE(getSizeInBits(), VT.getSizeInBits());
391     }
392 
393     /// Return true if we know at compile time this has fewer bits than VT.
394     bool knownBitsLT(MVT VT) const {
395       return TypeSize::isKnownLT(getSizeInBits(), VT.getSizeInBits());
396     }
397 
398     /// Return true if we know at compile time this has fewer than or the same
399     /// bits as VT.
400     bool knownBitsLE(MVT VT) const {
401       return TypeSize::isKnownLE(getSizeInBits(), VT.getSizeInBits());
402     }
403 
404     /// Return true if this has more bits than VT.
405     bool bitsGT(MVT VT) const {
406       assert(isScalableVector() == VT.isScalableVector() &&
407              "Comparison between scalable and fixed types");
408       return knownBitsGT(VT);
409     }
410 
411     /// Return true if this has no less bits than VT.
412     bool bitsGE(MVT VT) const {
413       assert(isScalableVector() == VT.isScalableVector() &&
414              "Comparison between scalable and fixed types");
415       return knownBitsGE(VT);
416     }
417 
418     /// Return true if this has less bits than VT.
419     bool bitsLT(MVT VT) const {
420       assert(isScalableVector() == VT.isScalableVector() &&
421              "Comparison between scalable and fixed types");
422       return knownBitsLT(VT);
423     }
424 
425     /// Return true if this has no more bits than VT.
426     bool bitsLE(MVT VT) const {
427       assert(isScalableVector() == VT.isScalableVector() &&
428              "Comparison between scalable and fixed types");
429       return knownBitsLE(VT);
430     }
431 
432     static MVT getFloatingPointVT(unsigned BitWidth) {
433 #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
434     if (FP == 3 && sz == BitWidth)                                             \
435       return Ty;
436 #include "llvm/CodeGen/GenVT.inc"
437 #undef GET_VT_ATTR
438 
439       llvm_unreachable("Bad bit width!");
440     }
441 
442     static MVT getIntegerVT(unsigned BitWidth) {
443 #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
444     if (Int == 3 && sz == BitWidth)                                            \
445       return Ty;
446 #include "llvm/CodeGen/GenVT.inc"
447 #undef GET_VT_ATTR
448 
449       return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
450     }
451 
452     static MVT getVectorVT(MVT VT, unsigned NumElements) {
453 #define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy)                             \
454     if (!Sc && !Tup && VT.SimpleTy == ElTy && NumElements == nElem)            \
455       return Ty;
456 #include "llvm/CodeGen/GenVT.inc"
457 #undef GET_VT_VECATTR
458 
459       return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
460     }
461 
462     static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
463 #define GET_VT_VECATTR(Ty, Sc, Tup, nElem, ElTy)                             \
464     if (Sc && VT.SimpleTy == ElTy && NumElements == nElem)                     \
465       return Ty;
466 #include "llvm/CodeGen/GenVT.inc"
467 #undef GET_VT_VECATTR
468 
469       return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
470     }
471 
472     static MVT getRISCVVectorTupleVT(unsigned Sz, unsigned NFields) {
473 #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, nElem, EltTy) \
474     if (Tup && sz == Sz && NF == NFields)                                      \
475       return Ty;
476 #include "llvm/CodeGen/GenVT.inc"
477 #undef GET_VT_ATTR
478 
479       llvm_unreachable("Invalid RISCV vector tuple type");
480     }
481 
482     /// Given a RISC-V vector tuple type, return the num_fields.
483     unsigned getRISCVVectorTupleNumFields() const {
484       assert(isRISCVVectorTuple() && SimpleTy >= FIRST_VALUETYPE &&
485              SimpleTy <= LAST_VALUETYPE);
486       static constexpr uint8_t NFTable[] = {
487 #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy) \
488     NF,
489 #include "llvm/CodeGen/GenVT.inc"
490 #undef GET_VT_ATTR
491       };
492       return NFTable[SimpleTy - FIRST_VALUETYPE];
493     }
494 
495     static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) {
496       if (IsScalable)
497         return getScalableVectorVT(VT, NumElements);
498       return getVectorVT(VT, NumElements);
499     }
500 
501     static MVT getVectorVT(MVT VT, ElementCount EC) {
502       if (EC.isScalable())
503         return getScalableVectorVT(VT, EC.getKnownMinValue());
504       return getVectorVT(VT, EC.getKnownMinValue());
505     }
506 
507     /// Return the value type corresponding to the specified type.
508     /// If HandleUnknown is true, unknown types are returned as Other,
509     /// otherwise they are invalid.
510     /// NB: This includes pointer types, which require a DataLayout to convert
511     /// to a concrete value type.
512     static MVT getVT(Type *Ty, bool HandleUnknown = false);
513 
514     /// Returns an APFloat semantics tag appropriate for the value type. If this
515     /// is a vector type, the element semantics are returned.
516     const fltSemantics &getFltSemantics() const;
517 
518   public:
519     /// SimpleValueType Iteration
520     /// @{
521     static auto all_valuetypes() {
522       return enum_seq_inclusive(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE,
523                                 force_iteration_on_noniterable_enum);
524     }
525 
526     static auto integer_valuetypes() {
527       return enum_seq_inclusive(MVT::FIRST_INTEGER_VALUETYPE,
528                                 MVT::LAST_INTEGER_VALUETYPE,
529                                 force_iteration_on_noniterable_enum);
530     }
531 
532     static auto fp_valuetypes() {
533       return enum_seq_inclusive(MVT::FIRST_FP_VALUETYPE, MVT::LAST_FP_VALUETYPE,
534                                 force_iteration_on_noniterable_enum);
535     }
536 
537     static auto vector_valuetypes() {
538       return enum_seq_inclusive(MVT::FIRST_VECTOR_VALUETYPE,
539                                 MVT::LAST_VECTOR_VALUETYPE,
540                                 force_iteration_on_noniterable_enum);
541     }
542 
543     static auto fixedlen_vector_valuetypes() {
544       return enum_seq_inclusive(MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE,
545                                 MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
546                                 force_iteration_on_noniterable_enum);
547     }
548 
549     static auto scalable_vector_valuetypes() {
550       return enum_seq_inclusive(MVT::FIRST_SCALABLE_VECTOR_VALUETYPE,
551                                 MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
552                                 force_iteration_on_noniterable_enum);
553     }
554 
555     static auto integer_fixedlen_vector_valuetypes() {
556       return enum_seq_inclusive(MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
557                                 MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
558                                 force_iteration_on_noniterable_enum);
559     }
560 
561     static auto fp_fixedlen_vector_valuetypes() {
562       return enum_seq_inclusive(MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE,
563                                 MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
564                                 force_iteration_on_noniterable_enum);
565     }
566 
567     static auto integer_scalable_vector_valuetypes() {
568       return enum_seq_inclusive(MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
569                                 MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
570                                 force_iteration_on_noniterable_enum);
571     }
572 
573     static auto fp_scalable_vector_valuetypes() {
574       return enum_seq_inclusive(MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE,
575                                 MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE,
576                                 force_iteration_on_noniterable_enum);
577     }
578     /// @}
579   };
580 
581   inline raw_ostream &operator<<(raw_ostream &OS, const MVT &VT) {
582     VT.print(OS);
583     return OS;
584   }
585 
586 } // end namespace llvm
587 
588 #endif // LLVM_CODEGEN_MACHINEVALUETYPE_H
589