@@ -52,6 +52,7 @@ namespace {
52
52
class SVEType {
53
53
54
54
enum TypeKind {
55
+ Invalid,
55
56
Void,
56
57
Float,
57
58
SInt,
@@ -72,7 +73,7 @@ class SVEType {
72
73
SVEType () : SVEType(" " , ' v' ) {}
73
74
74
75
SVEType (StringRef TS, char CharMod, unsigned NumVectors = 1 )
75
- : Kind(SInt ), Immediate(false ), Constant(false ), Pointer(false ),
76
+ : Kind(Invalid ), Immediate(false ), Constant(false ), Pointer(false ),
76
77
DefaultType (false ), IsScalable(true ), Bitwidth(128 ),
77
78
ElementBitwidth(~0U ), NumVectors(NumVectors) {
78
79
if (!TS.empty ())
@@ -111,6 +112,7 @@ class SVEType {
111
112
bool isPrefetchOp () const { return Kind == PrefetchOp; }
112
113
bool isSvcount () const { return Kind == Svcount; }
113
114
bool isFpm () const { return Kind == Fpm; }
115
+ bool isInvalid () const { return Kind == Invalid; }
114
116
unsigned getElementSizeInBits () const { return ElementBitwidth; }
115
117
unsigned getNumVectors () const { return NumVectors; }
116
118
@@ -445,6 +447,8 @@ std::string SVEType::builtinBaseType() const {
445
447
case TypeKind::PrefetchOp:
446
448
case TypeKind::PredicatePattern:
447
449
return " i" ;
450
+ case TypeKind::Fpm:
451
+ return " Wi" ;
448
452
case TypeKind::Predicate:
449
453
return " b" ;
450
454
case TypeKind::BFloat16:
@@ -482,6 +486,8 @@ std::string SVEType::builtinBaseType() const {
482
486
default :
483
487
llvm_unreachable (" Unhandled bitwidth!" );
484
488
}
489
+ case TypeKind::Invalid:
490
+ llvm_unreachable (" Attempting to resolve builtin string from Invalid type!" );
485
491
}
486
492
llvm_unreachable (" Unhandled TypeKind!" );
487
493
}
@@ -547,6 +553,9 @@ std::string SVEType::str() const {
547
553
break ;
548
554
case TypeKind::UInt:
549
555
TypeStr += " uint" + llvm::utostr (ElementBitwidth);
556
+ break ;
557
+ case TypeKind::Invalid:
558
+ llvm_unreachable (" Attempting to resolve type name from Invalid type!" );
550
559
}
551
560
552
561
if (isFixedLengthVector ())
@@ -570,27 +579,35 @@ void SVEType::applyTypespec(StringRef TS) {
570
579
for (char I : TS) {
571
580
switch (I) {
572
581
case ' Q' :
582
+ assert (Kind == Invalid && " Invalid use of modifer!" );
573
583
Kind = Svcount;
574
584
break ;
575
585
case ' P' :
586
+ assert (Kind == Invalid && " Invalid use of modifer!" );
576
587
Kind = Predicate;
577
588
break ;
578
589
case ' U' :
590
+ assert (Kind == Invalid && " Invalid use of modifer!" );
579
591
Kind = UInt;
580
592
break ;
581
593
case ' c' :
594
+ Kind = isInvalid () ? SInt : Kind;
582
595
ElementBitwidth = 8 ;
583
596
break ;
584
597
case ' s' :
598
+ Kind = isInvalid () ? SInt : Kind;
585
599
ElementBitwidth = 16 ;
586
600
break ;
587
601
case ' i' :
602
+ Kind = isInvalid () ? SInt : Kind;
588
603
ElementBitwidth = 32 ;
589
604
break ;
590
605
case ' l' :
606
+ Kind = isInvalid () ? SInt : Kind;
591
607
ElementBitwidth = 64 ;
592
608
break ;
593
609
case ' q' :
610
+ Kind = SInt;
594
611
ElementBitwidth = 128 ;
595
612
break ;
596
613
case ' h' :
0 commit comments