@@ -38,7 +38,7 @@ namespace llvm {
3838 // are considered extended value types.
3939 INVALID_SIMPLE_VALUE_TYPE = 0 ,
4040
41- #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
41+ #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
4242 Ty = n,
4343#define GET_VT_RANGES
4444#include " llvm/CodeGen/GenVT.inc"
@@ -179,7 +179,7 @@ namespace llvm {
179179 // / Return true if this is an overloaded type for TableGen.
180180 bool isOverloaded () const {
181181 switch (SimpleTy) {
182- #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
182+ #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
183183 case Ty: \
184184 return Any;
185185#include " llvm/CodeGen/GenVT.inc"
@@ -262,7 +262,7 @@ namespace llvm {
262262 MVT getVectorElementType () const {
263263 assert (SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
264264 static constexpr SimpleValueType EltTyTable[] = {
265- #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
265+ #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
266266 EltTy,
267267#include " llvm/CodeGen/GenVT.inc"
268268#undef GET_VT_ATTR
@@ -276,7 +276,7 @@ namespace llvm {
276276 unsigned getVectorMinNumElements () const {
277277 assert (SimpleTy >= FIRST_VALUETYPE && SimpleTy <= LAST_VALUETYPE);
278278 static constexpr uint16_t NElemTable[] = {
279- #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
279+ #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
280280 NElem,
281281#include " llvm/CodeGen/GenVT.inc"
282282#undef GET_VT_ATTR
@@ -306,7 +306,7 @@ namespace llvm {
306306 // / base size.
307307 TypeSize getSizeInBits () const {
308308 static constexpr TypeSize SizeTable[] = {
309- #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
309+ #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
310310 TypeSize (Sz, Sc || Ty == aarch64svcount /* FIXME: Not in the td. */ ),
311311#include " llvm/CodeGen/GenVT.inc"
312312#undef GET_VT_ATTR
@@ -428,7 +428,7 @@ namespace llvm {
428428 }
429429
430430 static MVT getFloatingPointVT (unsigned BitWidth) {
431- #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
431+ #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
432432 if (FP == 3 && sz == BitWidth) \
433433 return Ty;
434434#include " llvm/CodeGen/GenVT.inc"
@@ -438,7 +438,7 @@ namespace llvm {
438438 }
439439
440440 static MVT getIntegerVT (unsigned BitWidth) {
441- #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NElem, EltTy ) \
441+ #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
442442 if (Int == 3 && sz == BitWidth) \
443443 return Ty;
444444#include " llvm/CodeGen/GenVT.inc"
@@ -468,15 +468,28 @@ namespace llvm {
468468 }
469469
470470 static MVT getRISCVVectorTupleVT (unsigned Sz, unsigned NFields) {
471- #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, nElem, EltTy ) \
472- if (Tup && sz == Sz && nElem == NFields) \
471+ #define GET_VT_ATTR (Ty, n, sz, Any, Int, FP, Vec, Sc, Tup, NF, nElem, EltTy ) \
472+ if (Tup && sz == Sz && NF == NFields) \
473473 return Ty;
474474#include " llvm/CodeGen/GenVT.inc"
475475#undef GET_VT_ATTR
476476
477477 llvm_unreachable (" Invalid RISCV vector tuple type" );
478478 }
479479
480+ // / Given a RISC-V vector tuple type, return the num_fields.
481+ unsigned getRISCVVectorTupleNumFields () const {
482+ assert (isRISCVVectorTuple () && SimpleTy >= FIRST_VALUETYPE &&
483+ SimpleTy <= LAST_VALUETYPE);
484+ static constexpr uint16_t NFTable[] = {
485+ #define GET_VT_ATTR (Ty, N, Sz, Any, Int, FP, Vec, Sc, Tup, NF, NElem, EltTy ) \
486+ NF,
487+ #include " llvm/CodeGen/GenVT.inc"
488+ #undef GET_VT_ATTR
489+ };
490+ return NFTable[SimpleTy - FIRST_VALUETYPE];
491+ }
492+
480493 static MVT getVectorVT (MVT VT, unsigned NumElements, bool IsScalable) {
481494 if (IsScalable)
482495 return getScalableVectorVT (VT, NumElements);
0 commit comments