xref: /freebsd/contrib/llvm-project/llvm/include/llvm/CodeGenTypes/MachineValueType.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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    class raw_ostream;
30  
31    /// Machine Value Type. Every type that is supported natively by some
32    /// processor targeted by LLVM occurs here. This means that any legal value
33    /// type can be represented by an MVT.
34    class MVT {
35    public:
36      enum SimpleValueType : uint8_t {
37        // Simple value types that aren't explicitly part of this enumeration
38        // are considered extended value types.
39        INVALID_SIMPLE_VALUE_TYPE = 0,
40  
41  #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy) Ty = n,
42  #define GET_VT_RANGES
43  #include "llvm/CodeGen/GenVT.inc"
44  #undef GET_VT_ATTR
45  #undef GET_VT_RANGES
46  
47        VALUETYPE_SIZE = LAST_VALUETYPE + 1,
48      };
49  
50      static_assert(FIRST_VALUETYPE > 0);
51      static_assert(LAST_VALUETYPE < token);
52  
53      SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE;
54  
55      constexpr MVT() = default;
MVT(SimpleValueType SVT)56      constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {}
57  
58      bool operator>(const MVT& S)  const { return SimpleTy >  S.SimpleTy; }
59      bool operator<(const MVT& S)  const { return SimpleTy <  S.SimpleTy; }
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  
65      /// Support for debugging, callable in GDB: VT.dump()
66      void dump() const;
67  
68      /// Implement operator<<.
69      void print(raw_ostream &OS) const;
70  
71      /// Return true if this is a valid simple valuetype.
isValid()72      bool isValid() const {
73        return (SimpleTy >= MVT::FIRST_VALUETYPE &&
74                SimpleTy <= MVT::LAST_VALUETYPE);
75      }
76  
77      /// Return true if this is a FP or a vector FP type.
isFloatingPoint()78      bool isFloatingPoint() const {
79        return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
80                 SimpleTy <= MVT::LAST_FP_VALUETYPE) ||
81                (SimpleTy >= MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE &&
82                 SimpleTy <= MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE) ||
83                (SimpleTy >= MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE &&
84                 SimpleTy <= MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE));
85      }
86  
87      /// Return true if this is an integer or a vector integer type.
isInteger()88      bool isInteger() const {
89        return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
90                 SimpleTy <= MVT::LAST_INTEGER_VALUETYPE) ||
91                (SimpleTy >= MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE &&
92                 SimpleTy <= MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE) ||
93                (SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE &&
94                 SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE));
95      }
96  
97      /// Return true if this is an integer, not including vectors.
isScalarInteger()98      bool isScalarInteger() const {
99        return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
100                SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
101      }
102  
103      /// Return true if this is a vector value type.
isVector()104      bool isVector() const {
105        return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
106                SimpleTy <= MVT::LAST_VECTOR_VALUETYPE);
107      }
108  
109      /// Return true if this is a vector value type where the
110      /// runtime length is machine dependent
isScalableVector()111      bool isScalableVector() const {
112        return (SimpleTy >= MVT::FIRST_SCALABLE_VECTOR_VALUETYPE &&
113                SimpleTy <= MVT::LAST_SCALABLE_VECTOR_VALUETYPE);
114      }
115  
116      /// Return true if this is a custom target type that has a scalable size.
isScalableTargetExtVT()117      bool isScalableTargetExtVT() const {
118        return SimpleTy == MVT::aarch64svcount;
119      }
120  
121      /// Return true if the type is a scalable type.
isScalableVT()122      bool isScalableVT() const {
123        return isScalableVector() || isScalableTargetExtVT();
124      }
125  
isFixedLengthVector()126      bool isFixedLengthVector() const {
127        return (SimpleTy >= MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE &&
128                SimpleTy <= MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE);
129      }
130  
131      /// Return true if this is a 16-bit vector type.
is16BitVector()132      bool is16BitVector() const {
133        return (isFixedLengthVector() && getFixedSizeInBits() == 16);
134      }
135  
136      /// Return true if this is a 32-bit vector type.
is32BitVector()137      bool is32BitVector() const {
138        return (isFixedLengthVector() && getFixedSizeInBits() == 32);
139      }
140  
141      /// Return true if this is a 64-bit vector type.
is64BitVector()142      bool is64BitVector() const {
143        return (isFixedLengthVector() && getFixedSizeInBits() == 64);
144      }
145  
146      /// Return true if this is a 128-bit vector type.
is128BitVector()147      bool is128BitVector() const {
148        return (isFixedLengthVector() && getFixedSizeInBits() == 128);
149      }
150  
151      /// Return true if this is a 256-bit vector type.
is256BitVector()152      bool is256BitVector() const {
153        return (isFixedLengthVector() && getFixedSizeInBits() == 256);
154      }
155  
156      /// Return true if this is a 512-bit vector type.
is512BitVector()157      bool is512BitVector() const {
158        return (isFixedLengthVector() && getFixedSizeInBits() == 512);
159      }
160  
161      /// Return true if this is a 1024-bit vector type.
is1024BitVector()162      bool is1024BitVector() const {
163        return (isFixedLengthVector() && getFixedSizeInBits() == 1024);
164      }
165  
166      /// Return true if this is a 2048-bit vector type.
is2048BitVector()167      bool is2048BitVector() const {
168        return (isFixedLengthVector() && getFixedSizeInBits() == 2048);
169      }
170  
171      /// Return true if this is an overloaded type for TableGen.
isOverloaded()172      bool isOverloaded() const {
173        switch (SimpleTy) {
174  #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy)          \
175      case Ty:                                                                   \
176        return Any;
177  #include "llvm/CodeGen/GenVT.inc"
178  #undef GET_VT_ATTR
179        default:
180          return false;
181        }
182      }
183  
184      /// Return a vector with the same number of elements as this vector, but
185      /// with the element type converted to an integer type with the same
186      /// bitwidth.
changeVectorElementTypeToInteger()187      MVT changeVectorElementTypeToInteger() const {
188        MVT EltTy = getVectorElementType();
189        MVT IntTy = MVT::getIntegerVT(EltTy.getSizeInBits());
190        MVT VecTy = MVT::getVectorVT(IntTy, getVectorElementCount());
191        assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
192               "Simple vector VT not representable by simple integer vector VT!");
193        return VecTy;
194      }
195  
196      /// Return a VT for a vector type whose attributes match ourselves
197      /// with the exception of the element type that is chosen by the caller.
changeVectorElementType(MVT EltVT)198      MVT changeVectorElementType(MVT EltVT) const {
199        MVT VecTy = MVT::getVectorVT(EltVT, 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 the type converted to an equivalently sized integer or vector
206      /// with integer element type. Similar to changeVectorElementTypeToInteger,
207      /// but also handles scalars.
changeTypeToInteger()208      MVT changeTypeToInteger() {
209        if (isVector())
210          return changeVectorElementTypeToInteger();
211        return MVT::getIntegerVT(getSizeInBits());
212      }
213  
214      /// Return a VT for a vector type with the same element type but
215      /// half the number of elements.
getHalfNumVectorElementsVT()216      MVT getHalfNumVectorElementsVT() const {
217        MVT EltVT = getVectorElementType();
218        auto EltCnt = getVectorElementCount();
219        assert(EltCnt.isKnownEven() && "Splitting vector, but not in half!");
220        return getVectorVT(EltVT, EltCnt.divideCoefficientBy(2));
221      }
222  
223      // Return a VT for a vector type with the same element type but
224      // double the number of elements.
getDoubleNumVectorElementsVT()225      MVT getDoubleNumVectorElementsVT() const {
226        MVT EltVT = getVectorElementType();
227        auto EltCnt = getVectorElementCount();
228        return MVT::getVectorVT(EltVT, EltCnt * 2);
229      }
230  
231      /// Returns true if the given vector is a power of 2.
isPow2VectorType()232      bool isPow2VectorType() const {
233        unsigned NElts = getVectorMinNumElements();
234        return !(NElts & (NElts - 1));
235      }
236  
237      /// Widens the length of the given vector MVT up to the nearest power of 2
238      /// and returns that type.
getPow2VectorType()239      MVT getPow2VectorType() const {
240        if (isPow2VectorType())
241          return *this;
242  
243        ElementCount NElts = getVectorElementCount();
244        unsigned NewMinCount = 1 << Log2_32_Ceil(NElts.getKnownMinValue());
245        NElts = ElementCount::get(NewMinCount, NElts.isScalable());
246        return MVT::getVectorVT(getVectorElementType(), NElts);
247      }
248  
249      /// If this is a vector, return the element type, otherwise return this.
getScalarType()250      MVT getScalarType() const {
251        return isVector() ? getVectorElementType() : *this;
252      }
253  
getVectorElementType()254      MVT getVectorElementType() const {
255        assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
256        static constexpr SimpleValueType EltTyTable[] = {
257  #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy) EltTy,
258  #include "llvm/CodeGen/GenVT.inc"
259  #undef GET_VT_ATTR
260        };
261        SimpleValueType VT = EltTyTable[SimpleTy - FIRST_VALUETYPE];
262        assert(VT != INVALID_SIMPLE_VALUE_TYPE && "Not a vector MVT!");
263        return VT;
264      }
265  
266      /// Given a vector type, return the minimum number of elements it contains.
getVectorMinNumElements()267      unsigned getVectorMinNumElements() const {
268        assert(SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
269        static constexpr uint16_t NElemTable[] = {
270  #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy) NElem,
271  #include "llvm/CodeGen/GenVT.inc"
272  #undef GET_VT_ATTR
273        };
274        unsigned NElem = NElemTable[SimpleTy - FIRST_VALUETYPE];
275        assert(NElem != 0 && "Not a vector MVT!");
276        return NElem;
277      }
278  
getVectorElementCount()279      ElementCount getVectorElementCount() const {
280        return ElementCount::get(getVectorMinNumElements(), isScalableVector());
281      }
282  
getVectorNumElements()283      unsigned getVectorNumElements() const {
284        if (isScalableVector())
285          llvm::reportInvalidSizeRequest(
286              "Possible incorrect use of MVT::getVectorNumElements() for "
287              "scalable vector. Scalable flag may be dropped, use "
288              "MVT::getVectorElementCount() instead");
289        return getVectorMinNumElements();
290      }
291  
292      /// Returns the size of the specified MVT in bits.
293      ///
294      /// If the value type is a scalable vector type, the scalable property will
295      /// be set and the runtime size will be a positive integer multiple of the
296      /// base size.
getSizeInBits()297      TypeSize getSizeInBits() const {
298        static constexpr TypeSize SizeTable[] = {
299  #define GET_VT_ATTR(Ty, N, Sz, Any, Int, FP, Vec, Sc, NElem, EltTy)          \
300      TypeSize(Sz, Sc || Ty == aarch64svcount /* FIXME: Not in the td. */),
301  #include "llvm/CodeGen/GenVT.inc"
302  #undef GET_VT_ATTR
303        };
304  
305        switch (SimpleTy) {
306        case INVALID_SIMPLE_VALUE_TYPE:
307          llvm_unreachable("getSizeInBits called on extended MVT.");
308        case Other:
309          llvm_unreachable("Value type is non-standard value, Other.");
310        case iPTR:
311          llvm_unreachable("Value type size is target-dependent. Ask TLI.");
312        case iPTRAny:
313        case iAny:
314        case fAny:
315        case vAny:
316        case Any:
317          llvm_unreachable("Value type is overloaded.");
318        case token:
319          llvm_unreachable("Token type is a sentinel that cannot be used "
320                           "in codegen and has no size");
321        case Metadata:
322          llvm_unreachable("Value type is metadata.");
323        default:
324          assert(SimpleTy < VALUETYPE_SIZE && "Unexpected value type!");
325          return SizeTable[SimpleTy - FIRST_VALUETYPE];
326        }
327      }
328  
329      /// Return the size of the specified fixed width value type in bits. The
330      /// function will assert if the type is scalable.
getFixedSizeInBits()331      uint64_t getFixedSizeInBits() const {
332        return getSizeInBits().getFixedValue();
333      }
334  
getScalarSizeInBits()335      uint64_t getScalarSizeInBits() const {
336        return getScalarType().getSizeInBits().getFixedValue();
337      }
338  
339      /// Return the number of bytes overwritten by a store of the specified value
340      /// type.
341      ///
342      /// If the value type is a scalable vector type, the scalable property will
343      /// be set and the runtime size will be a positive integer multiple of the
344      /// base size.
getStoreSize()345      TypeSize getStoreSize() const {
346        TypeSize BaseSize = getSizeInBits();
347        return {(BaseSize.getKnownMinValue() + 7) / 8, BaseSize.isScalable()};
348      }
349  
350      // Return the number of bytes overwritten by a store of this value type or
351      // this value type's element type in the case of a vector.
getScalarStoreSize()352      uint64_t getScalarStoreSize() const {
353        return getScalarType().getStoreSize().getFixedValue();
354      }
355  
356      /// Return the number of bits overwritten by a store of the specified value
357      /// type.
358      ///
359      /// If the value type is a scalable vector type, the scalable property will
360      /// be set and the runtime size will be a positive integer multiple of the
361      /// base size.
getStoreSizeInBits()362      TypeSize getStoreSizeInBits() const {
363        return getStoreSize() * 8;
364      }
365  
366      /// Returns true if the number of bits for the type is a multiple of an
367      /// 8-bit byte.
isByteSized()368      bool isByteSized() const { return getSizeInBits().isKnownMultipleOf(8); }
369  
370      /// Return true if we know at compile time this has more bits than VT.
knownBitsGT(MVT VT)371      bool knownBitsGT(MVT VT) const {
372        return TypeSize::isKnownGT(getSizeInBits(), VT.getSizeInBits());
373      }
374  
375      /// Return true if we know at compile time this has more than or the same
376      /// bits as VT.
knownBitsGE(MVT VT)377      bool knownBitsGE(MVT VT) const {
378        return TypeSize::isKnownGE(getSizeInBits(), VT.getSizeInBits());
379      }
380  
381      /// Return true if we know at compile time this has fewer bits than VT.
knownBitsLT(MVT VT)382      bool knownBitsLT(MVT VT) const {
383        return TypeSize::isKnownLT(getSizeInBits(), VT.getSizeInBits());
384      }
385  
386      /// Return true if we know at compile time this has fewer than or the same
387      /// bits as VT.
knownBitsLE(MVT VT)388      bool knownBitsLE(MVT VT) const {
389        return TypeSize::isKnownLE(getSizeInBits(), VT.getSizeInBits());
390      }
391  
392      /// Return true if this has more bits than VT.
bitsGT(MVT VT)393      bool bitsGT(MVT VT) const {
394        assert(isScalableVector() == VT.isScalableVector() &&
395               "Comparison between scalable and fixed types");
396        return knownBitsGT(VT);
397      }
398  
399      /// Return true if this has no less bits than VT.
bitsGE(MVT VT)400      bool bitsGE(MVT VT) const {
401        assert(isScalableVector() == VT.isScalableVector() &&
402               "Comparison between scalable and fixed types");
403        return knownBitsGE(VT);
404      }
405  
406      /// Return true if this has less bits than VT.
bitsLT(MVT VT)407      bool bitsLT(MVT VT) const {
408        assert(isScalableVector() == VT.isScalableVector() &&
409               "Comparison between scalable and fixed types");
410        return knownBitsLT(VT);
411      }
412  
413      /// Return true if this has no more bits than VT.
bitsLE(MVT VT)414      bool bitsLE(MVT VT) const {
415        assert(isScalableVector() == VT.isScalableVector() &&
416               "Comparison between scalable and fixed types");
417        return knownBitsLE(VT);
418      }
419  
getFloatingPointVT(unsigned BitWidth)420      static MVT getFloatingPointVT(unsigned BitWidth) {
421  #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy)          \
422      if (FP == 3 && sz == BitWidth)                                             \
423        return Ty;
424  #include "llvm/CodeGen/GenVT.inc"
425  #undef GET_VT_ATTR
426  
427        llvm_unreachable("Bad bit width!");
428      }
429  
getIntegerVT(unsigned BitWidth)430      static MVT getIntegerVT(unsigned BitWidth) {
431  #define GET_VT_ATTR(Ty, n, sz, Any, Int, FP, Vec, Sc, NElem, EltTy)          \
432      if (Int == 3 && sz == BitWidth)                                            \
433        return Ty;
434  #include "llvm/CodeGen/GenVT.inc"
435  #undef GET_VT_ATTR
436  
437        return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
438      }
439  
getVectorVT(MVT VT,unsigned NumElements)440      static MVT getVectorVT(MVT VT, unsigned NumElements) {
441  #define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
442      if (!Sc && VT.SimpleTy == ElTy && NumElements == nElem)                    \
443        return Ty;
444  #include "llvm/CodeGen/GenVT.inc"
445  #undef GET_VT_VECATTR
446  
447        return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
448      }
449  
getScalableVectorVT(MVT VT,unsigned NumElements)450      static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
451  #define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
452      if (Sc && VT.SimpleTy == ElTy && NumElements == nElem)                     \
453        return Ty;
454  #include "llvm/CodeGen/GenVT.inc"
455  #undef GET_VT_VECATTR
456  
457        return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
458      }
459  
getVectorVT(MVT VT,unsigned NumElements,bool IsScalable)460      static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) {
461        if (IsScalable)
462          return getScalableVectorVT(VT, NumElements);
463        return getVectorVT(VT, NumElements);
464      }
465  
getVectorVT(MVT VT,ElementCount EC)466      static MVT getVectorVT(MVT VT, ElementCount EC) {
467        if (EC.isScalable())
468          return getScalableVectorVT(VT, EC.getKnownMinValue());
469        return getVectorVT(VT, EC.getKnownMinValue());
470      }
471  
472      /// Return the value type corresponding to the specified type.
473      /// If HandleUnknown is true, unknown types are returned as Other,
474      /// otherwise they are invalid.
475      /// NB: This includes pointer types, which require a DataLayout to convert
476      /// to a concrete value type.
477      static MVT getVT(Type *Ty, bool HandleUnknown = false);
478  
479    public:
480      /// SimpleValueType Iteration
481      /// @{
all_valuetypes()482      static auto all_valuetypes() {
483        return enum_seq_inclusive(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE,
484                                  force_iteration_on_noniterable_enum);
485      }
486  
integer_valuetypes()487      static auto integer_valuetypes() {
488        return enum_seq_inclusive(MVT::FIRST_INTEGER_VALUETYPE,
489                                  MVT::LAST_INTEGER_VALUETYPE,
490                                  force_iteration_on_noniterable_enum);
491      }
492  
fp_valuetypes()493      static auto fp_valuetypes() {
494        return enum_seq_inclusive(MVT::FIRST_FP_VALUETYPE, MVT::LAST_FP_VALUETYPE,
495                                  force_iteration_on_noniterable_enum);
496      }
497  
vector_valuetypes()498      static auto vector_valuetypes() {
499        return enum_seq_inclusive(MVT::FIRST_VECTOR_VALUETYPE,
500                                  MVT::LAST_VECTOR_VALUETYPE,
501                                  force_iteration_on_noniterable_enum);
502      }
503  
fixedlen_vector_valuetypes()504      static auto fixedlen_vector_valuetypes() {
505        return enum_seq_inclusive(MVT::FIRST_FIXEDLEN_VECTOR_VALUETYPE,
506                                  MVT::LAST_FIXEDLEN_VECTOR_VALUETYPE,
507                                  force_iteration_on_noniterable_enum);
508      }
509  
scalable_vector_valuetypes()510      static auto scalable_vector_valuetypes() {
511        return enum_seq_inclusive(MVT::FIRST_SCALABLE_VECTOR_VALUETYPE,
512                                  MVT::LAST_SCALABLE_VECTOR_VALUETYPE,
513                                  force_iteration_on_noniterable_enum);
514      }
515  
integer_fixedlen_vector_valuetypes()516      static auto integer_fixedlen_vector_valuetypes() {
517        return enum_seq_inclusive(MVT::FIRST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
518                                  MVT::LAST_INTEGER_FIXEDLEN_VECTOR_VALUETYPE,
519                                  force_iteration_on_noniterable_enum);
520      }
521  
fp_fixedlen_vector_valuetypes()522      static auto fp_fixedlen_vector_valuetypes() {
523        return enum_seq_inclusive(MVT::FIRST_FP_FIXEDLEN_VECTOR_VALUETYPE,
524                                  MVT::LAST_FP_FIXEDLEN_VECTOR_VALUETYPE,
525                                  force_iteration_on_noniterable_enum);
526      }
527  
integer_scalable_vector_valuetypes()528      static auto integer_scalable_vector_valuetypes() {
529        return enum_seq_inclusive(MVT::FIRST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
530                                  MVT::LAST_INTEGER_SCALABLE_VECTOR_VALUETYPE,
531                                  force_iteration_on_noniterable_enum);
532      }
533  
fp_scalable_vector_valuetypes()534      static auto fp_scalable_vector_valuetypes() {
535        return enum_seq_inclusive(MVT::FIRST_FP_SCALABLE_VECTOR_VALUETYPE,
536                                  MVT::LAST_FP_SCALABLE_VECTOR_VALUETYPE,
537                                  force_iteration_on_noniterable_enum);
538      }
539      /// @}
540    };
541  
542    inline raw_ostream &operator<<(raw_ostream &OS, const MVT &VT) {
543      VT.print(OS);
544      return OS;
545    }
546  
547  } // end namespace llvm
548  
549  #endif // LLVM_CODEGEN_MACHINEVALUETYPE_H
550