Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/MachineValueType.h
Line
Count
Source (jump to first uncovered line)
1
//===- Support/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
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_SUPPORT_MACHINEVALUETYPE_H
15
#define LLVM_SUPPORT_MACHINEVALUETYPE_H
16
17
#include "llvm/ADT/iterator_range.h"
18
#include "llvm/Support/ErrorHandling.h"
19
#include "llvm/Support/MathExtras.h"
20
#include <cassert>
21
22
namespace llvm {
23
24
  class Type;
25
26
  /// Machine Value Type. Every type that is supported natively by some
27
  /// processor targeted by LLVM occurs here. This means that any legal value
28
  /// type can be represented by an MVT.
29
  class MVT {
30
  public:
31
    enum SimpleValueType : uint8_t {
32
      // Simple value types that aren't explicitly part of this enumeration
33
      // are considered extended value types.
34
      INVALID_SIMPLE_VALUE_TYPE = 0,
35
36
      // If you change this numbering, you must change the values in
37
      // ValueTypes.td as well!
38
      Other          =   1,   // This is a non-standard value
39
      i1             =   2,   // This is a 1 bit integer value
40
      i8             =   3,   // This is an 8 bit integer value
41
      i16            =   4,   // This is a 16 bit integer value
42
      i32            =   5,   // This is a 32 bit integer value
43
      i64            =   6,   // This is a 64 bit integer value
44
      i128           =   7,   // This is a 128 bit integer value
45
46
      FIRST_INTEGER_VALUETYPE = i1,
47
      LAST_INTEGER_VALUETYPE  = i128,
48
49
      f16            =   8,   // This is a 16 bit floating point value
50
      f32            =   9,   // This is a 32 bit floating point value
51
      f64            =  10,   // This is a 64 bit floating point value
52
      f80            =  11,   // This is a 80 bit floating point value
53
      f128           =  12,   // This is a 128 bit floating point value
54
      ppcf128        =  13,   // This is a PPC 128-bit floating point value
55
56
      FIRST_FP_VALUETYPE = f16,
57
      LAST_FP_VALUETYPE  = ppcf128,
58
59
      v1i1           =  14,   //    1 x i1
60
      v2i1           =  15,   //    2 x i1
61
      v4i1           =  16,   //    4 x i1
62
      v8i1           =  17,   //    8 x i1
63
      v16i1          =  18,   //   16 x i1
64
      v32i1          =  19,   //   32 x i1
65
      v64i1          =  20,   //   64 x i1
66
      v128i1         =  21,   //  128 x i1
67
      v512i1         =  22,   //  512 x i1
68
      v1024i1        =  23,   // 1024 x i1
69
70
      v1i8           =  24,   //  1 x i8
71
      v2i8           =  25,   //  2 x i8
72
      v4i8           =  26,   //  4 x i8
73
      v8i8           =  27,   //  8 x i8
74
      v16i8          =  28,   // 16 x i8
75
      v32i8          =  29,   // 32 x i8
76
      v64i8          =  30,   // 64 x i8
77
      v128i8         =  31,   //128 x i8
78
      v256i8         =  32,   //256 x i8
79
80
      v1i16          =  33,   //  1 x i16
81
      v2i16          =  34,   //  2 x i16
82
      v4i16          =  35,   //  4 x i16
83
      v8i16          =  36,   //  8 x i16
84
      v16i16         =  37,   // 16 x i16
85
      v32i16         =  38,   // 32 x i16
86
      v64i16         =  39,   // 64 x i16
87
      v128i16        =  40,   //128 x i16
88
89
      v1i32          =  41,   //    1 x i32
90
      v2i32          =  42,   //    2 x i32
91
      v3i32          =  43,   //    3 x i32
92
      v4i32          =  44,   //    4 x i32
93
      v5i32          =  45,   //    5 x i32
94
      v8i32          =  46,   //    8 x i32
95
      v16i32         =  47,   //   16 x i32
96
      v32i32         =  48,   //   32 x i32
97
      v64i32         =  49,   //   64 x i32
98
      v128i32        =  50,   //  128 x i32
99
      v256i32        =  51,   //  256 x i32
100
      v512i32        =  52,   //  512 x i32
101
      v1024i32       =  53,   // 1024 x i32
102
      v2048i32       =  54,   // 2048 x i32
103
104
      v1i64          =  55,   //  1 x i64
105
      v2i64          =  56,   //  2 x i64
106
      v4i64          =  57,   //  4 x i64
107
      v8i64          =  58,   //  8 x i64
108
      v16i64         =  59,   // 16 x i64
109
      v32i64         =  60,   // 32 x i64
110
111
      v1i128         =  61,   //  1 x i128
112
113
      // Scalable integer types
114
      nxv1i1         =  62,   // n x  1 x i1
115
      nxv2i1         =  63,   // n x  2 x i1
116
      nxv4i1         =  64,   // n x  4 x i1
117
      nxv8i1         =  65,   // n x  8 x i1
118
      nxv16i1        =  66,   // n x 16 x i1
119
      nxv32i1        =  67,   // n x 32 x i1
120
121
      nxv1i8         =  68,   // n x  1 x i8
122
      nxv2i8         =  69,   // n x  2 x i8
123
      nxv4i8         =  70,   // n x  4 x i8
124
      nxv8i8         =  71,   // n x  8 x i8
125
      nxv16i8        =  72,   // n x 16 x i8
126
      nxv32i8        =  73,   // n x 32 x i8
127
128
      nxv1i16        =  74,   // n x  1 x i16
129
      nxv2i16        =  75,   // n x  2 x i16
130
      nxv4i16        =  76,   // n x  4 x i16
131
      nxv8i16        =  77,   // n x  8 x i16
132
      nxv16i16       =  78,   // n x 16 x i16
133
      nxv32i16       =  79,   // n x 32 x i16
134
135
      nxv1i32        =  80,   // n x  1 x i32
136
      nxv2i32        =  81,   // n x  2 x i32
137
      nxv4i32        =  82,   // n x  4 x i32
138
      nxv8i32        =  83,   // n x  8 x i32
139
      nxv16i32       =  84,   // n x 16 x i32
140
      nxv32i32       =  85,   // n x 32 x i32
141
142
      nxv1i64        =  86,   // n x  1 x i64
143
      nxv2i64        =  87,   // n x  2 x i64
144
      nxv4i64        =  88,   // n x  4 x i64
145
      nxv8i64        =  89,   // n x  8 x i64
146
      nxv16i64       =  90,   // n x 16 x i64
147
      nxv32i64       =  91,   // n x 32 x i64
148
149
      FIRST_INTEGER_VECTOR_VALUETYPE = v1i1,
150
      LAST_INTEGER_VECTOR_VALUETYPE = nxv32i64,
151
152
      FIRST_INTEGER_SCALABLE_VALUETYPE = nxv1i1,
153
      LAST_INTEGER_SCALABLE_VALUETYPE = nxv32i64,
154
155
      v2f16          =  92,   //    2 x f16
156
      v4f16          =  93,   //    4 x f16
157
      v8f16          =  94,   //    8 x f16
158
      v1f32          =  95,   //    1 x f32
159
      v2f32          =  96,   //    2 x f32
160
      v3f32          =  97,   //    3 x f32
161
      v4f32          =  98,   //    4 x f32
162
      v5f32          =  99,   //    5 x f32
163
      v8f32          =  100,  //    8 x f32
164
      v16f32         =  101,  //   16 x f32
165
      v32f32         =  102,  //   32 x f32
166
      v64f32         =  103,  //   64 x f32
167
      v128f32        =  104,  //  128 x f32
168
      v256f32        =  105,  //  256 x f32
169
      v512f32        =  106,  //  512 x f32
170
      v1024f32       =  107,  // 1024 x f32
171
      v2048f32       =  108,  // 2048 x f32
172
      v1f64          =  109,  //    1 x f64
173
      v2f64          =  110,  //    2 x f64
174
      v4f64          =  111,  //    4 x f64
175
      v8f64          =  112,  //    8 x f64
176
177
      nxv2f16        =  113,  // n x  2 x f16
178
      nxv4f16        =  114,  // n x  4 x f16
179
      nxv8f16        =  115,  // n x  8 x f16
180
      nxv1f32        =  116,  // n x  1 x f32
181
      nxv2f32        =  117,  // n x  2 x f32
182
      nxv4f32        =  118,  // n x  4 x f32
183
      nxv8f32        =  119,  // n x  8 x f32
184
      nxv16f32       =  120,  // n x 16 x f32
185
      nxv1f64        =  121,  // n x  1 x f64
186
      nxv2f64        =  122,  // n x  2 x f64
187
      nxv4f64        =  123,  // n x  4 x f64
188
      nxv8f64        =  124,  // n x  8 x f64
189
190
      FIRST_FP_VECTOR_VALUETYPE = v2f16,
191
      LAST_FP_VECTOR_VALUETYPE = nxv8f64,
192
193
      FIRST_FP_SCALABLE_VALUETYPE = nxv2f16,
194
      LAST_FP_SCALABLE_VALUETYPE = nxv8f64,
195
196
      FIRST_VECTOR_VALUETYPE = v1i1,
197
      LAST_VECTOR_VALUETYPE  = nxv8f64,
198
199
      x86mmx         =  125,   // This is an X86 MMX value
200
201
      Glue           =  126,   // This glues nodes together during pre-RA sched
202
203
      isVoid         =  127,   // This has no value
204
205
      Untyped        =  128,   // This value takes a register, but has
206
                               // unspecified type.  The register class
207
                               // will be determined by the opcode.
208
209
      exnref         =  129,   // WebAssembly's exnref type
210
211
      FIRST_VALUETYPE = 1,     // This is always the beginning of the list.
212
      LAST_VALUETYPE =  130,   // This always remains at the end of the list.
213
214
      // This is the current maximum for LAST_VALUETYPE.
215
      // MVT::MAX_ALLOWED_VALUETYPE is used for asserts and to size bit vectors
216
      // This value must be a multiple of 32.
217
      MAX_ALLOWED_VALUETYPE = 160,
218
219
      // A value of type llvm::TokenTy
220
      token          = 248,
221
222
      // This is MDNode or MDString.
223
      Metadata       = 249,
224
225
      // An int value the size of the pointer of the current
226
      // target to any address space. This must only be used internal to
227
      // tblgen. Other than for overloading, we treat iPTRAny the same as iPTR.
228
      iPTRAny        = 250,
229
230
      // A vector with any length and element size. This is used
231
      // for intrinsics that have overloadings based on vector types.
232
      // This is only for tblgen's consumption!
233
      vAny           = 251,
234
235
      // Any floating-point or vector floating-point value. This is used
236
      // for intrinsics that have overloadings based on floating-point types.
237
      // This is only for tblgen's consumption!
238
      fAny           = 252,
239
240
      // An integer or vector integer value of any bit width. This is
241
      // used for intrinsics that have overloadings based on integer bit widths.
242
      // This is only for tblgen's consumption!
243
      iAny           = 253,
244
245
      // An int value the size of the pointer of the current
246
      // target.  This should only be used internal to tblgen!
247
      iPTR           = 254,
248
249
      // Any type. This is used for intrinsics that have overloadings.
250
      // This is only for tblgen's consumption!
251
      Any            = 255
252
    };
253
254
    SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE;
255
256
    // A class to represent the number of elements in a vector
257
    //
258
    // For fixed-length vectors, the total number of elements is equal to 'Min'
259
    // For scalable vectors, the total number of elements is a multiple of 'Min'
260
    class ElementCount {
261
    public:
262
      unsigned Min;
263
      bool Scalable;
264
265
      ElementCount(unsigned Min, bool Scalable)
266
372k
      : Min(Min), Scalable(Scalable) {}
267
268
      ElementCount operator*(unsigned RHS) {
269
        return { Min * RHS, Scalable };
270
      }
271
272
0
      ElementCount& operator*=(unsigned RHS) {
273
0
        Min *= RHS;
274
0
        return *this;
275
0
      }
276
277
183k
      ElementCount operator/(unsigned RHS) {
278
183k
        return { Min / RHS, Scalable };
279
183k
      }
280
281
0
      ElementCount& operator/=(unsigned RHS) {
282
0
        Min /= RHS;
283
0
        return *this;
284
0
      }
285
286
0
      bool operator==(const ElementCount& RHS) {
287
0
        return Min == RHS.Min && Scalable == RHS.Scalable;
288
0
      }
289
    };
290
291
54.3M
    constexpr MVT() = default;
292
4.48G
    constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {}
293
294
3.23k
    bool operator>(const MVT& S)  const { return SimpleTy >  S.SimpleTy; }
295
1.46M
    bool operator<(const MVT& S)  const { return SimpleTy <  S.SimpleTy; }
296
1.44G
    bool operator==(const MVT& S) const { return SimpleTy == S.SimpleTy; }
297
388M
    bool operator!=(const MVT& S) const { return SimpleTy != S.SimpleTy; }
298
4.42k
    bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; }
299
5.00k
    bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; }
300
301
    /// Return true if this is a valid simple valuetype.
302
3.74M
    bool isValid() const {
303
3.74M
      return (SimpleTy >= MVT::FIRST_VALUETYPE &&
304
3.74M
              
SimpleTy < MVT::LAST_VALUETYPE3.52M
);
305
3.74M
    }
306
307
    /// Return true if this is a FP or a vector FP type.
308
24.6M
    bool isFloatingPoint() const {
309
24.6M
      return ((SimpleTy >= MVT::FIRST_FP_VALUETYPE &&
310
24.6M
               
SimpleTy <= MVT::LAST_FP_VALUETYPE6.46M
) ||
311
24.6M
              
(23.6M
SimpleTy >= MVT::FIRST_FP_VECTOR_VALUETYPE23.6M
&&
312
23.6M
               
SimpleTy <= MVT::LAST_FP_VECTOR_VALUETYPE1.54M
));
313
24.6M
    }
314
315
    /// Return true if this is an integer or a vector integer type.
316
44.7M
    bool isInteger() const {
317
44.7M
      return ((SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
318
44.7M
               
SimpleTy <= MVT::LAST_INTEGER_VALUETYPE44.7M
) ||
319
44.7M
              
(14.7M
SimpleTy >= MVT::FIRST_INTEGER_VECTOR_VALUETYPE14.7M
&&
320
14.7M
               
SimpleTy <= MVT::LAST_INTEGER_VECTOR_VALUETYPE13.5M
));
321
44.7M
    }
322
323
    /// Return true if this is an integer, not including vectors.
324
8.39M
    bool isScalarInteger() const {
325
8.39M
      return (SimpleTy >= MVT::FIRST_INTEGER_VALUETYPE &&
326
8.39M
              SimpleTy <= MVT::LAST_INTEGER_VALUETYPE);
327
8.39M
    }
328
329
    /// Return true if this is a vector value type.
330
457M
    bool isVector() const {
331
457M
      return (SimpleTy >= MVT::FIRST_VECTOR_VALUETYPE &&
332
457M
              
SimpleTy <= MVT::LAST_VECTOR_VALUETYPE179M
);
333
457M
    }
334
335
    /// Return true if this is a vector value type where the
336
    /// runtime length is machine dependent
337
6.38M
    bool isScalableVector() const {
338
6.38M
      return ((SimpleTy >= MVT::FIRST_INTEGER_SCALABLE_VALUETYPE &&
339
6.38M
               
SimpleTy <= MVT::LAST_INTEGER_SCALABLE_VALUETYPE2.70M
) ||
340
6.38M
              
(5.80M
SimpleTy >= MVT::FIRST_FP_SCALABLE_VALUETYPE5.80M
&&
341
5.80M
               
SimpleTy <= MVT::LAST_FP_SCALABLE_VALUETYPE659k
));
342
6.38M
    }
343
344
    /// Return true if this is a 16-bit vector type.
345
0
    bool is16BitVector() const {
346
0
      return (SimpleTy == MVT::v2i8  || SimpleTy == MVT::v1i16 ||
347
0
              SimpleTy == MVT::v16i1);
348
0
    }
349
350
    /// Return true if this is a 32-bit vector type.
351
1.18k
    bool is32BitVector() const {
352
1.18k
      return (SimpleTy == MVT::v32i1 || SimpleTy == MVT::v4i8  ||
353
1.18k
              SimpleTy == MVT::v2i16 || SimpleTy == MVT::v1i32 ||
354
1.18k
              SimpleTy == MVT::v2f16 || SimpleTy == MVT::v1f32);
355
1.18k
    }
356
357
    /// Return true if this is a 64-bit vector type.
358
16.9k
    bool is64BitVector() const {
359
16.9k
      return (SimpleTy == MVT::v64i1 || SimpleTy == MVT::v8i8  ||
360
16.9k
              
SimpleTy == MVT::v4i1616.1k
||
SimpleTy == MVT::v2i3214.6k
||
361
16.9k
              
SimpleTy == MVT::v1i6412.7k
||
SimpleTy == MVT::v4f1612.4k
||
362
16.9k
              
SimpleTy == MVT::v2f3212.1k
||
SimpleTy == MVT::v1f6412.1k
);
363
16.9k
    }
364
365
    /// Return true if this is a 128-bit vector type.
366
3.18M
    bool is128BitVector() const {
367
3.18M
      return (SimpleTy == MVT::v128i1 || SimpleTy == MVT::v16i8  ||
368
3.18M
              
SimpleTy == MVT::v8i162.90M
||
SimpleTy == MVT::v4i322.66M
||
369
3.18M
              
SimpleTy == MVT::v2i642.41M
||
SimpleTy == MVT::v1i1282.27M
||
370
3.18M
              
SimpleTy == MVT::v8f162.27M
||
SimpleTy == MVT::v4f322.27M
||
371
3.18M
              
SimpleTy == MVT::v2f642.20M
);
372
3.18M
    }
373
374
    /// Return true if this is a 256-bit vector type.
375
4.33M
    bool is256BitVector() const {
376
4.33M
      return (SimpleTy == MVT::v8f32 || 
SimpleTy == MVT::v4f644.29M
||
377
4.33M
              
SimpleTy == MVT::v32i84.26M
||
SimpleTy == MVT::v16i164.11M
||
378
4.33M
              
SimpleTy == MVT::v8i323.97M
||
SimpleTy == MVT::v4i643.87M
);
379
4.33M
    }
380
381
    /// Return true if this is a 512-bit vector type.
382
1.93M
    bool is512BitVector() const {
383
1.93M
      return (SimpleTy == MVT::v16f32 || 
SimpleTy == MVT::v8f641.92M
||
384
1.93M
              
SimpleTy == MVT::v512i11.92M
||
SimpleTy == MVT::v64i81.92M
||
385
1.93M
              
SimpleTy == MVT::v32i161.90M
||
SimpleTy == MVT::v16i321.89M
||
386
1.93M
              
SimpleTy == MVT::v8i641.88M
);
387
1.93M
    }
388
389
    /// Return true if this is a 1024-bit vector type.
390
0
    bool is1024BitVector() const {
391
0
      return (SimpleTy == MVT::v1024i1 || SimpleTy == MVT::v128i8 ||
392
0
              SimpleTy == MVT::v64i16  || SimpleTy == MVT::v32i32 ||
393
0
              SimpleTy == MVT::v16i64);
394
0
    }
395
396
    /// Return true if this is a 2048-bit vector type.
397
0
    bool is2048BitVector() const {
398
0
      return (SimpleTy == MVT::v256i8 || SimpleTy == MVT::v128i16 ||
399
0
              SimpleTy == MVT::v64i32 || SimpleTy == MVT::v32i64);
400
0
    }
401
402
    /// Return true if this is an overloaded type for TableGen.
403
    bool isOverloaded() const {
404
      return (SimpleTy==MVT::Any  ||
405
              SimpleTy==MVT::iAny || SimpleTy==MVT::fAny ||
406
              SimpleTy==MVT::vAny || SimpleTy==MVT::iPTRAny);
407
    }
408
409
    /// Returns true if the given vector is a power of 2.
410
9.38M
    bool isPow2VectorType() const {
411
9.38M
      unsigned NElts = getVectorNumElements();
412
9.38M
      return !(NElts & (NElts - 1));
413
9.38M
    }
414
415
    /// Widens the length of the given vector MVT up to the nearest power of 2
416
    /// and returns that type.
417
5.13M
    MVT getPow2VectorType() const {
418
5.13M
      if (isPow2VectorType())
419
5.00M
        return *this;
420
130k
421
130k
      unsigned NElts = getVectorNumElements();
422
130k
      unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
423
130k
      return MVT::getVectorVT(getVectorElementType(), Pow2NElts);
424
130k
    }
425
426
    /// If this is a vector, return the element type, otherwise return this.
427
107M
    MVT getScalarType() const {
428
107M
      return isVector() ? 
getVectorElementType()104M
:
*this2.83M
;
429
107M
    }
430
431
747M
    MVT getVectorElementType() const {
432
747M
      switch (SimpleTy) {
433
747M
      default:
434
0
        llvm_unreachable("Not a vector MVT!");
435
747M
      case v1i1:
436
82.6M
      case v2i1:
437
82.6M
      case v4i1:
438
82.6M
      case v8i1:
439
82.6M
      case v16i1:
440
82.6M
      case v32i1:
441
82.6M
      case v64i1:
442
82.6M
      case v128i1:
443
82.6M
      case v512i1:
444
82.6M
      case v1024i1:
445
82.6M
      case nxv1i1:
446
82.6M
      case nxv2i1:
447
82.6M
      case nxv4i1:
448
82.6M
      case nxv8i1:
449
82.6M
      case nxv16i1:
450
82.6M
      case nxv32i1: return i1;
451
92.0M
      case v1i8:
452
92.0M
      case v2i8:
453
92.0M
      case v4i8:
454
92.0M
      case v8i8:
455
92.0M
      case v16i8:
456
92.0M
      case v32i8:
457
92.0M
      case v64i8:
458
92.0M
      case v128i8:
459
92.0M
      case v256i8:
460
92.0M
      case nxv1i8:
461
92.0M
      case nxv2i8:
462
92.0M
      case nxv4i8:
463
92.0M
      case nxv8i8:
464
92.0M
      case nxv16i8:
465
92.0M
      case nxv32i8: return i8;
466
92.6M
      case v1i16:
467
92.6M
      case v2i16:
468
92.6M
      case v4i16:
469
92.6M
      case v8i16:
470
92.6M
      case v16i16:
471
92.6M
      case v32i16:
472
92.6M
      case v64i16:
473
92.6M
      case v128i16:
474
92.6M
      case nxv1i16:
475
92.6M
      case nxv2i16:
476
92.6M
      case nxv4i16:
477
92.6M
      case nxv8i16:
478
92.6M
      case nxv16i16:
479
92.6M
      case nxv32i16: return i16;
480
141M
      case v1i32:
481
141M
      case v2i32:
482
141M
      case v3i32:
483
141M
      case v4i32:
484
141M
      case v5i32:
485
141M
      case v8i32:
486
141M
      case v16i32:
487
141M
      case v32i32:
488
141M
      case v64i32:
489
141M
      case v128i32:
490
141M
      case v256i32:
491
141M
      case v512i32:
492
141M
      case v1024i32:
493
141M
      case v2048i32:
494
141M
      case nxv1i32:
495
141M
      case nxv2i32:
496
141M
      case nxv4i32:
497
141M
      case nxv8i32:
498
141M
      case nxv16i32:
499
141M
      case nxv32i32: return i32;
500
141M
      case v1i64:
501
97.0M
      case v2i64:
502
97.0M
      case v4i64:
503
97.0M
      case v8i64:
504
97.0M
      case v16i64:
505
97.0M
      case v32i64:
506
97.0M
      case nxv1i64:
507
97.0M
      case nxv2i64:
508
97.0M
      case nxv4i64:
509
97.0M
      case nxv8i64:
510
97.0M
      case nxv16i64:
511
97.0M
      case nxv32i64: return i64;
512
97.0M
      
case v1i128: return i1286.62M
;
513
97.0M
      case v2f16:
514
41.3M
      case v4f16:
515
41.3M
      case v8f16:
516
41.3M
      case nxv2f16:
517
41.3M
      case nxv4f16:
518
41.3M
      case nxv8f16: return f16;
519
133M
      case v1f32:
520
133M
      case v2f32:
521
133M
      case v3f32:
522
133M
      case v4f32:
523
133M
      case v5f32:
524
133M
      case v8f32:
525
133M
      case v16f32:
526
133M
      case v32f32:
527
133M
      case v64f32:
528
133M
      case v128f32:
529
133M
      case v256f32:
530
133M
      case v512f32:
531
133M
      case v1024f32:
532
133M
      case v2048f32:
533
133M
      case nxv1f32:
534
133M
      case nxv2f32:
535
133M
      case nxv4f32:
536
133M
      case nxv8f32:
537
133M
      case nxv16f32: return f32;
538
133M
      case v1f64:
539
60.7M
      case v2f64:
540
60.7M
      case v4f64:
541
60.7M
      case v8f64:
542
60.7M
      case nxv1f64:
543
60.7M
      case nxv2f64:
544
60.7M
      case nxv4f64:
545
60.7M
      case nxv8f64: return f64;
546
747M
      }
547
747M
    }
548
549
143M
    unsigned getVectorNumElements() const {
550
143M
      switch (SimpleTy) {
551
143M
      default:
552
0
        llvm_unreachable("Not a vector MVT!");
553
143M
      case v2048i32:
554
2.39M
      case v2048f32: return 2048;
555
2.83M
      case v1024i1:
556
2.83M
      case v1024i32:
557
2.83M
      case v1024f32: return 1024;
558
2.83M
      case v512i1:
559
2.67M
      case v512i32:
560
2.67M
      case v512f32: return 512;
561
2.95M
      case v256i8:
562
2.95M
      case v256i32:
563
2.95M
      case v256f32: return 256;
564
4.39M
      case v128i1:
565
4.39M
      case v128i8:
566
4.39M
      case v128i16:
567
4.39M
      case v128i32:
568
4.39M
      case v128f32: return 128;
569
4.73M
      case v64i1:
570
4.73M
      case v64i8:
571
4.73M
      case v64i16:
572
4.73M
      case v64i32:
573
4.73M
      case v64f32: return 64;
574
16.3M
      case v32i1:
575
16.3M
      case v32i8:
576
16.3M
      case v32i16:
577
16.3M
      case v32i32:
578
16.3M
      case v32i64:
579
16.3M
      case v32f32:
580
16.3M
      case nxv32i1:
581
16.3M
      case nxv32i8:
582
16.3M
      case nxv32i16:
583
16.3M
      case nxv32i32:
584
16.3M
      case nxv32i64: return 32;
585
20.1M
      case v16i1:
586
20.1M
      case v16i8:
587
20.1M
      case v16i16:
588
20.1M
      case v16i32:
589
20.1M
      case v16i64:
590
20.1M
      case v16f32:
591
20.1M
      case nxv16i1:
592
20.1M
      case nxv16i8:
593
20.1M
      case nxv16i16:
594
20.1M
      case nxv16i32:
595
20.1M
      case nxv16i64:
596
20.1M
      case nxv16f32: return 16;
597
21.5M
      case v8i1:
598
21.5M
      case v8i8:
599
21.5M
      case v8i16:
600
21.5M
      case v8i32:
601
21.5M
      case v8i64:
602
21.5M
      case v8f16:
603
21.5M
      case v8f32:
604
21.5M
      case v8f64:
605
21.5M
      case nxv8i1:
606
21.5M
      case nxv8i8:
607
21.5M
      case nxv8i16:
608
21.5M
      case nxv8i32:
609
21.5M
      case nxv8i64:
610
21.5M
      case nxv8f16:
611
21.5M
      case nxv8f32:
612
21.5M
      case nxv8f64: return 8;
613
21.5M
      case v5i32:
614
1.52M
      case v5f32: return 5;
615
24.1M
      case v4i1:
616
24.1M
      case v4i8:
617
24.1M
      case v4i16:
618
24.1M
      case v4i32:
619
24.1M
      case v4i64:
620
24.1M
      case v4f16:
621
24.1M
      case v4f32:
622
24.1M
      case v4f64:
623
24.1M
      case nxv4i1:
624
24.1M
      case nxv4i8:
625
24.1M
      case nxv4i16:
626
24.1M
      case nxv4i32:
627
24.1M
      case nxv4i64:
628
24.1M
      case nxv4f16:
629
24.1M
      case nxv4f32:
630
24.1M
      case nxv4f64: return 4;
631
24.1M
      case v3i32:
632
1.39M
      case v3f32: return 3;
633
22.2M
      case v2i1:
634
22.2M
      case v2i8:
635
22.2M
      case v2i16:
636
22.2M
      case v2i32:
637
22.2M
      case v2i64:
638
22.2M
      case v2f16:
639
22.2M
      case v2f32:
640
22.2M
      case v2f64:
641
22.2M
      case nxv2i1:
642
22.2M
      case nxv2i8:
643
22.2M
      case nxv2i16:
644
22.2M
      case nxv2i32:
645
22.2M
      case nxv2i64:
646
22.2M
      case nxv2f16:
647
22.2M
      case nxv2f32:
648
22.2M
      case nxv2f64: return 2;
649
22.2M
      case v1i1:
650
15.7M
      case v1i8:
651
15.7M
      case v1i16:
652
15.7M
      case v1i32:
653
15.7M
      case v1i64:
654
15.7M
      case v1i128:
655
15.7M
      case v1f32:
656
15.7M
      case v1f64:
657
15.7M
      case nxv1i1:
658
15.7M
      case nxv1i8:
659
15.7M
      case nxv1i16:
660
15.7M
      case nxv1i32:
661
15.7M
      case nxv1i64:
662
15.7M
      case nxv1f32:
663
15.7M
      case nxv1f64: return 1;
664
143M
      }
665
143M
    }
666
667
182k
    MVT::ElementCount getVectorElementCount() const {
668
182k
      return { getVectorNumElements(), isScalableVector() };
669
182k
    }
670
671
480M
    unsigned getSizeInBits() const {
672
480M
      switch (SimpleTy) {
673
480M
      default:
674
0
        llvm_unreachable("getSizeInBits called on extended MVT.");
675
480M
      case Other:
676
0
        llvm_unreachable("Value type is non-standard value, Other.");
677
480M
      case iPTR:
678
0
        llvm_unreachable("Value type size is target-dependent. Ask TLI.");
679
480M
      case iPTRAny:
680
0
      case iAny:
681
0
      case fAny:
682
0
      case vAny:
683
0
      case Any:
684
0
        llvm_unreachable("Value type is overloaded.");
685
0
      case token:
686
0
        llvm_unreachable("Token type is a sentinel that cannot be used "
687
0
                         "in codegen and has no size");
688
0
      case Metadata:
689
0
        llvm_unreachable("Value type is metadata.");
690
48.4M
      case i1:
691
48.4M
      case v1i1:
692
48.4M
      case nxv1i1: return 1;
693
48.4M
      case v2i1:
694
248k
      case nxv2i1: return 2;
695
248k
      case v4i1:
696
211k
      case nxv4i1: return 4;
697
61.2M
      case i8  :
698
61.2M
      case v1i8:
699
61.2M
      case v8i1:
700
61.2M
      case nxv1i8:
701
61.2M
      case nxv8i1: return 8;
702
61.2M
      case i16 :
703
50.9M
      case f16:
704
50.9M
      case v16i1:
705
50.9M
      case v2i8:
706
50.9M
      case v1i16:
707
50.9M
      case nxv16i1:
708
50.9M
      case nxv2i8:
709
50.9M
      case nxv1i16: return 16;
710
129M
      case f32 :
711
129M
      case i32 :
712
129M
      case v32i1:
713
129M
      case v4i8:
714
129M
      case v2i16:
715
129M
      case v2f16:
716
129M
      case v1f32:
717
129M
      case v1i32:
718
129M
      case nxv32i1:
719
129M
      case nxv4i8:
720
129M
      case nxv2i16:
721
129M
      case nxv1i32:
722
129M
      case nxv2f16:
723
129M
      case nxv1f32: return 32;
724
129M
      case x86mmx:
725
125M
      case f64 :
726
125M
      case i64 :
727
125M
      case v64i1:
728
125M
      case v8i8:
729
125M
      case v4i16:
730
125M
      case v2i32:
731
125M
      case v1i64:
732
125M
      case v4f16:
733
125M
      case v2f32:
734
125M
      case v1f64:
735
125M
      case nxv8i8:
736
125M
      case nxv4i16:
737
125M
      case nxv2i32:
738
125M
      case nxv1i64:
739
125M
      case nxv4f16:
740
125M
      case nxv2f32:
741
125M
      case nxv1f64: return 64;
742
125M
      
case f80 : return 802.02M
;
743
125M
      case v3i32:
744
263k
      case v3f32: return 96;
745
52.7M
      case f128:
746
52.7M
      case ppcf128:
747
52.7M
      case i128:
748
52.7M
      case v128i1:
749
52.7M
      case v16i8:
750
52.7M
      case v8i16:
751
52.7M
      case v4i32:
752
52.7M
      case v2i64:
753
52.7M
      case v1i128:
754
52.7M
      case v8f16:
755
52.7M
      case v4f32:
756
52.7M
      case v2f64:
757
52.7M
      case nxv16i8:
758
52.7M
      case nxv8i16:
759
52.7M
      case nxv4i32:
760
52.7M
      case nxv2i64:
761
52.7M
      case nxv8f16:
762
52.7M
      case nxv4f32:
763
52.7M
      case nxv2f64: return 128;
764
52.7M
      case v5i32:
765
209k
      case v5f32: return 160;
766
6.37M
      case v32i8:
767
6.37M
      case v16i16:
768
6.37M
      case v8i32:
769
6.37M
      case v4i64:
770
6.37M
      case v8f32:
771
6.37M
      case v4f64:
772
6.37M
      case nxv32i8:
773
6.37M
      case nxv16i16:
774
6.37M
      case nxv8i32:
775
6.37M
      case nxv4i64:
776
6.37M
      case nxv8f32:
777
6.37M
      case nxv4f64: return 256;
778
6.37M
      case v512i1:
779
2.08M
      case v64i8:
780
2.08M
      case v32i16:
781
2.08M
      case v16i32:
782
2.08M
      case v8i64:
783
2.08M
      case v16f32:
784
2.08M
      case v8f64:
785
2.08M
      case nxv32i16:
786
2.08M
      case nxv16i32:
787
2.08M
      case nxv8i64:
788
2.08M
      case nxv16f32:
789
2.08M
      case nxv8f64: return 512;
790
2.08M
      case v1024i1:
791
133k
      case v128i8:
792
133k
      case v64i16:
793
133k
      case v32i32:
794
133k
      case v16i64:
795
133k
      case v32f32:
796
133k
      case nxv32i32:
797
133k
      case nxv16i64: return 1024;
798
133k
      case v256i8:
799
73.1k
      case v128i16:
800
73.1k
      case v64i32:
801
73.1k
      case v32i64:
802
73.1k
      case v64f32:
803
73.1k
      case nxv32i64: return 2048;
804
73.1k
      case v128i32:
805
15.3k
      case v128f32:  return 4096;
806
15.3k
      case v256i32:
807
12.6k
      case v256f32:  return 8192;
808
12.6k
      case v512i32:
809
12.6k
      case v512f32:  return 16384;
810
12.6k
      case v1024i32:
811
12.6k
      case v1024f32:  return 32768;
812
12.6k
      case v2048i32:
813
12.6k
      case v2048f32:  return 65536;
814
12.6k
      
case exnref: return 06
; // opaque type
815
480M
      }
816
480M
    }
817
818
107M
    unsigned getScalarSizeInBits() const {
819
107M
      return getScalarType().getSizeInBits();
820
107M
    }
821
822
    /// Return the number of bytes overwritten by a store of the specified value
823
    /// type.
824
647k
    unsigned getStoreSize() const {
825
647k
      return (getSizeInBits() + 7) / 8;
826
647k
    }
827
828
    /// Return the number of bits overwritten by a store of the specified value
829
    /// type.
830
34
    unsigned getStoreSizeInBits() const {
831
34
      return getStoreSize() * 8;
832
34
    }
833
834
    /// Return true if this has more bits than VT.
835
1.08k
    bool bitsGT(MVT VT) const {
836
1.08k
      return getSizeInBits() > VT.getSizeInBits();
837
1.08k
    }
838
839
    /// Return true if this has no less bits than VT.
840
114
    bool bitsGE(MVT VT) const {
841
114
      return getSizeInBits() >= VT.getSizeInBits();
842
114
    }
843
844
    /// Return true if this has less bits than VT.
845
2.27k
    bool bitsLT(MVT VT) const {
846
2.27k
      return getSizeInBits() < VT.getSizeInBits();
847
2.27k
    }
848
849
    /// Return true if this has no more bits than VT.
850
290k
    bool bitsLE(MVT VT) const {
851
290k
      return getSizeInBits() <= VT.getSizeInBits();
852
290k
    }
853
854
29.3k
    static MVT getFloatingPointVT(unsigned BitWidth) {
855
29.3k
      switch (BitWidth) {
856
29.3k
      default:
857
0
        llvm_unreachable("Bad bit width!");
858
29.3k
      case 16:
859
2
        return MVT::f16;
860
29.3k
      case 32:
861
14.5k
        return MVT::f32;
862
29.3k
      case 64:
863
14.7k
        return MVT::f64;
864
29.3k
      case 80:
865
0
        return MVT::f80;
866
29.3k
      case 128:
867
0
        return MVT::f128;
868
29.3k
      }
869
29.3k
    }
870
871
88.7M
    static MVT getIntegerVT(unsigned BitWidth) {
872
88.7M
      switch (BitWidth) {
873
88.7M
      default:
874
768k
        return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
875
88.7M
      case 1:
876
5.84M
        return MVT::i1;
877
88.7M
      case 8:
878
4.03M
        return MVT::i8;
879
88.7M
      case 16:
880
1.88M
        return MVT::i16;
881
88.7M
      case 32:
882
22.2M
        return MVT::i32;
883
88.7M
      case 64:
884
53.1M
        return MVT::i64;
885
88.7M
      case 128:
886
777k
        return MVT::i128;
887
88.7M
      }
888
88.7M
    }
889
890
32.4M
    static MVT getVectorVT(MVT VT, unsigned NumElements) {
891
32.4M
      switch (VT.SimpleTy) {
892
32.4M
      default:
893
35.2k
        break;
894
32.4M
      case MVT::i1:
895
4.05M
        if (NumElements == 1)    
return MVT::v1i1719k
;
896
3.33M
        if (NumElements == 2)    
return MVT::v2i1731k
;
897
2.60M
        if (NumElements == 4)    
return MVT::v4i1581k
;
898
2.02M
        if (NumElements == 8)    
return MVT::v8i1512k
;
899
1.51M
        if (NumElements == 16)   
return MVT::v16i1468k
;
900
1.04M
        if (NumElements == 32)   
return MVT::v32i1356k
;
901
687k
        if (NumElements == 64)   
return MVT::v64i1251k
;
902
436k
        if (NumElements == 128)  
return MVT::v128i1163k
;
903
272k
        if (NumElements == 512)  
return MVT::v512i1109k
;
904
162k
        if (NumElements == 1024) 
return MVT::v1024i153.2k
;
905
109k
        break;
906
3.46M
      case MVT::i8:
907
3.46M
        if (NumElements == 1)   
return MVT::v1i8509k
;
908
2.95M
        if (NumElements == 2)   
return MVT::v2i8456k
;
909
2.49M
        if (NumElements == 4)   
return MVT::v4i8360k
;
910
2.13M
        if (NumElements == 8)   
return MVT::v8i8358k
;
911
1.77M
        if (NumElements == 16)  
return MVT::v16i8888k
;
912
890k
        if (NumElements == 32)  
return MVT::v32i8409k
;
913
481k
        if (NumElements == 64)  
return MVT::v64i8214k
;
914
267k
        if (NumElements == 128) 
return MVT::v128i8119k
;
915
147k
        if (NumElements == 256) 
return MVT::v256i857.2k
;
916
89.9k
        break;
917
3.09M
      case MVT::i16:
918
3.09M
        if (NumElements == 1)   
return MVT::v1i16416k
;
919
2.67M
        if (NumElements == 2)   
return MVT::v2i16395k
;
920
2.28M
        if (NumElements == 4)   
return MVT::v4i16412k
;
921
1.86M
        if (NumElements == 8)   
return MVT::v8i16931k
;
922
936k
        if (NumElements == 16)  
return MVT::v16i16493k
;
923
443k
        if (NumElements == 32)  
return MVT::v32i16264k
;
924
178k
        if (NumElements == 64)  
return MVT::v64i16113k
;
925
64.8k
        if (NumElements == 128) 
return MVT::v128i1653.2k
;
926
11.5k
        break;
927
8.23M
      case MVT::i32:
928
8.23M
        if (NumElements == 1)    
return MVT::v1i32659k
;
929
7.57M
        if (NumElements == 2)    
return MVT::v2i321.99M
;
930
5.57M
        if (NumElements == 3)    
return MVT::v3i3273.5k
;
931
5.50M
        if (NumElements == 4)    
return MVT::v4i322.13M
;
932
3.37M
        if (NumElements == 5)    
return MVT::v5i321.82k
;
933
3.37M
        if (NumElements == 8)    
return MVT::v8i32993k
;
934
2.38M
        if (NumElements == 16)   
return MVT::v16i32739k
;
935
1.64M
        if (NumElements == 32)   
return MVT::v32i32455k
;
936
1.18M
        if (NumElements == 64)   
return MVT::v64i32332k
;
937
853k
        if (NumElements == 128)  
return MVT::v128i32272k
;
938
580k
        if (NumElements == 256)  
return MVT::v256i32219k
;
939
360k
        if (NumElements == 512)  
return MVT::v512i32166k
;
940
194k
        if (NumElements == 1024) 
return MVT::v1024i32112k
;
941
81.4k
        if (NumElements == 2048) 
return MVT::v2048i3254.2k
;
942
27.1k
        break;
943
4.72M
      case MVT::i64:
944
4.72M
        if (NumElements == 1)  
return MVT::v1i64374k
;
945
4.34M
        if (NumElements == 2)  
return MVT::v2i642.66M
;
946
1.68M
        if (NumElements == 4)  
return MVT::v4i64866k
;
947
817k
        if (NumElements == 8)  
return MVT::v8i64439k
;
948
378k
        if (NumElements == 16) 
return MVT::v16i64241k
;
949
137k
        if (NumElements == 32) 
return MVT::v32i64109k
;
950
28.3k
        break;
951
86.9k
      case MVT::i128:
952
86.9k
        if (NumElements == 1)  
return MVT::v1i12868.7k
;
953
18.2k
        break;
954
1.26M
      case MVT::f16:
955
1.26M
        if (NumElements == 2)  
return MVT::v2f16353k
;
956
909k
        if (NumElements == 4)  
return MVT::v4f16283k
;
957
625k
        if (NumElements == 8)  
return MVT::v8f16180k
;
958
445k
        break;
959
5.42M
      case MVT::f32:
960
5.42M
        if (NumElements == 1)    
return MVT::v1f32495k
;
961
4.93M
        if (NumElements == 2)    
return MVT::v2f32843k
;
962
4.09M
        if (NumElements == 3)    
return MVT::v3f323.70k
;
963
4.08M
        if (NumElements == 4)    
return MVT::v4f321.28M
;
964
2.79M
        if (NumElements == 5)    
return MVT::v5f32650
;
965
2.79M
        if (NumElements == 8)    
return MVT::v8f32691k
;
966
2.10M
        if (NumElements == 16)   
return MVT::v16f32566k
;
967
1.53M
        if (NumElements == 32)   
return MVT::v32f32383k
;
968
1.15M
        if (NumElements == 64)   
return MVT::v64f32327k
;
969
827k
        if (NumElements == 128)  
return MVT::v128f32273k
;
970
553k
        if (NumElements == 256)  
return MVT::v256f32219k
;
971
334k
        if (NumElements == 512)  
return MVT::v512f32166k
;
972
168k
        if (NumElements == 1024) 
return MVT::v1024f32112k
;
973
55.5k
        if (NumElements == 2048) 
return MVT::v2048f3253.9k
;
974
1.56k
        break;
975
2.11M
      case MVT::f64:
976
2.11M
        if (NumElements == 1)  
return MVT::v1f64237k
;
977
1.87M
        if (NumElements == 2)  
return MVT::v2f641.25M
;
978
619k
        if (NumElements == 4)  
return MVT::v4f64344k
;
979
274k
        if (NumElements == 8)  
return MVT::v8f64183k
;
980
91.3k
        break;
981
858k
      }
982
858k
      return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
983
858k
    }
984
985
9
    static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
986
9
      switch(VT.SimpleTy) {
987
9
        default:
988
0
          break;
989
9
        case MVT::i1:
990
0
          if (NumElements == 1)  return MVT::nxv1i1;
991
0
          if (NumElements == 2)  return MVT::nxv2i1;
992
0
          if (NumElements == 4)  return MVT::nxv4i1;
993
0
          if (NumElements == 8)  return MVT::nxv8i1;
994
0
          if (NumElements == 16) return MVT::nxv16i1;
995
0
          if (NumElements == 32) return MVT::nxv32i1;
996
0
          break;
997
0
        case MVT::i8:
998
0
          if (NumElements == 1)  return MVT::nxv1i8;
999
0
          if (NumElements == 2)  return MVT::nxv2i8;
1000
0
          if (NumElements == 4)  return MVT::nxv4i8;
1001
0
          if (NumElements == 8)  return MVT::nxv8i8;
1002
0
          if (NumElements == 16) return MVT::nxv16i8;
1003
0
          if (NumElements == 32) return MVT::nxv32i8;
1004
0
          break;
1005
0
        case MVT::i16:
1006
0
          if (NumElements == 1)  return MVT::nxv1i16;
1007
0
          if (NumElements == 2)  return MVT::nxv2i16;
1008
0
          if (NumElements == 4)  return MVT::nxv4i16;
1009
0
          if (NumElements == 8)  return MVT::nxv8i16;
1010
0
          if (NumElements == 16) return MVT::nxv16i16;
1011
0
          if (NumElements == 32) return MVT::nxv32i16;
1012
0
          break;
1013
3
        case MVT::i32:
1014
3
          if (NumElements == 1)  
return MVT::nxv1i320
;
1015
3
          if (NumElements == 2)  
return MVT::nxv2i322
;
1016
1
          if (NumElements == 4)  return MVT::nxv4i32;
1017
0
          if (NumElements == 8)  return MVT::nxv8i32;
1018
0
          if (NumElements == 16) return MVT::nxv16i32;
1019
0
          if (NumElements == 32) return MVT::nxv32i32;
1020
0
          break;
1021
5
        case MVT::i64:
1022
5
          if (NumElements == 1)  
return MVT::nxv1i641
;
1023
4
          if (NumElements == 2)  
return MVT::nxv2i643
;
1024
1
          if (NumElements == 4)  return MVT::nxv4i64;
1025
0
          if (NumElements == 8)  return MVT::nxv8i64;
1026
0
          if (NumElements == 16) return MVT::nxv16i64;
1027
0
          if (NumElements == 32) return MVT::nxv32i64;
1028
0
          break;
1029
0
        case MVT::f16:
1030
0
          if (NumElements == 2)  return MVT::nxv2f16;
1031
0
          if (NumElements == 4)  return MVT::nxv4f16;
1032
0
          if (NumElements == 8)  return MVT::nxv8f16;
1033
0
          break;
1034
0
        case MVT::f32:
1035
0
          if (NumElements == 1)  return MVT::nxv1f32;
1036
0
          if (NumElements == 2)  return MVT::nxv2f32;
1037
0
          if (NumElements == 4)  return MVT::nxv4f32;
1038
0
          if (NumElements == 8)  return MVT::nxv8f32;
1039
0
          if (NumElements == 16) return MVT::nxv16f32;
1040
0
          break;
1041
1
        case MVT::f64:
1042
1
          if (NumElements == 1)  
return MVT::nxv1f640
;
1043
1
          if (NumElements == 2)  return MVT::nxv2f64;
1044
0
          if (NumElements == 4)  return MVT::nxv4f64;
1045
0
          if (NumElements == 8)  return MVT::nxv8f64;
1046
0
          break;
1047
0
      }
1048
0
      return (MVT::SimpleValueType)(MVT::INVALID_SIMPLE_VALUE_TYPE);
1049
0
    }
1050
1051
9.75M
    static MVT getVectorVT(MVT VT, unsigned NumElements, bool IsScalable) {
1052
9.75M
      if (IsScalable)
1053
2
        return getScalableVectorVT(VT, NumElements);
1054
9.75M
      return getVectorVT(VT, NumElements);
1055
9.75M
    }
1056
1057
189k
    static MVT getVectorVT(MVT VT, MVT::ElementCount EC) {
1058
189k
      if (EC.Scalable)
1059
7
        return getScalableVectorVT(VT, EC.Min);
1060
189k
      return getVectorVT(VT, EC.Min);
1061
189k
    }
1062
1063
    /// Return the value type corresponding to the specified type.  This returns
1064
    /// all pointers as iPTR.  If HandleUnknown is true, unknown types are
1065
    /// returned as Other, otherwise they are invalid.
1066
    static MVT getVT(Type *Ty, bool HandleUnknown = false);
1067
1068
  private:
1069
    /// A simple iterator over the MVT::SimpleValueType enum.
1070
    struct mvt_iterator {
1071
      SimpleValueType VT;
1072
1073
14.9M
      mvt_iterator(SimpleValueType VT) : VT(VT) {}
1074
1075
858M
      MVT operator*() const { return VT; }
1076
866M
      bool operator!=(const mvt_iterator &LHS) const { return VT != LHS.VT; }
1077
1078
858M
      mvt_iterator& operator++() {
1079
858M
        VT = (MVT::SimpleValueType)((int)VT + 1);
1080
858M
        assert((int)VT <= MVT::MAX_ALLOWED_VALUETYPE &&
1081
858M
               "MVT iterator overflowed.");
1082
858M
        return *this;
1083
858M
      }
1084
    };
1085
1086
    /// A range of the MVT::SimpleValueType enum.
1087
    using mvt_range = iterator_range<mvt_iterator>;
1088
1089
  public:
1090
    /// SimpleValueType Iteration
1091
    /// @{
1092
3.06M
    static mvt_range all_valuetypes() {
1093
3.06M
      return mvt_range(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE);
1094
3.06M
    }
1095
1096
106k
    static mvt_range integer_valuetypes() {
1097
106k
      return mvt_range(MVT::FIRST_INTEGER_VALUETYPE,
1098
106k
                       (MVT::SimpleValueType)(MVT::LAST_INTEGER_VALUETYPE + 1));
1099
106k
    }
1100
1101
102k
    static mvt_range fp_valuetypes() {
1102
102k
      return mvt_range(MVT::FIRST_FP_VALUETYPE,
1103
102k
                       (MVT::SimpleValueType)(MVT::LAST_FP_VALUETYPE + 1));
1104
102k
    }
1105
1106
4.10M
    static mvt_range vector_valuetypes() {
1107
4.10M
      return mvt_range(MVT::FIRST_VECTOR_VALUETYPE,
1108
4.10M
                       (MVT::SimpleValueType)(MVT::LAST_VECTOR_VALUETYPE + 1));
1109
4.10M
    }
1110
1111
77.4k
    static mvt_range integer_vector_valuetypes() {
1112
77.4k
      return mvt_range(
1113
77.4k
          MVT::FIRST_INTEGER_VECTOR_VALUETYPE,
1114
77.4k
          (MVT::SimpleValueType)(MVT::LAST_INTEGER_VECTOR_VALUETYPE + 1));
1115
77.4k
    }
1116
1117
20.5k
    static mvt_range fp_vector_valuetypes() {
1118
20.5k
      return mvt_range(
1119
20.5k
          MVT::FIRST_FP_VECTOR_VALUETYPE,
1120
20.5k
          (MVT::SimpleValueType)(MVT::LAST_FP_VECTOR_VALUETYPE + 1));
1121
20.5k
    }
1122
1123
    static mvt_range integer_scalable_vector_valuetypes() {
1124
      return mvt_range(MVT::FIRST_INTEGER_SCALABLE_VALUETYPE,
1125
              (MVT::SimpleValueType)(MVT::LAST_INTEGER_SCALABLE_VALUETYPE + 1));
1126
    }
1127
1128
    static mvt_range fp_scalable_vector_valuetypes() {
1129
      return mvt_range(MVT::FIRST_FP_SCALABLE_VALUETYPE,
1130
                   (MVT::SimpleValueType)(MVT::LAST_FP_SCALABLE_VALUETYPE + 1));
1131
    }
1132
    /// @}
1133
  };
1134
1135
} // end namespace llvm
1136
1137
#endif // LLVM_CODEGEN_MACHINEVALUETYPE_H