@@ -52,6 +52,7 @@ namespace {
5252class SVEType {
5353
5454 enum TypeKind {
55+ Invalid,
5556 Void,
5657 Float,
5758 SInt,
@@ -72,7 +73,7 @@ class SVEType {
7273 SVEType () : SVEType(" " , ' v' ) {}
7374
7475 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 ),
7677 DefaultType (false ), IsScalable(true ), Bitwidth(128 ),
7778 ElementBitwidth(~0U ), NumVectors(NumVectors) {
7879 if (!TS.empty ())
@@ -111,6 +112,7 @@ class SVEType {
111112 bool isPrefetchOp () const { return Kind == PrefetchOp; }
112113 bool isSvcount () const { return Kind == Svcount; }
113114 bool isFpm () const { return Kind == Fpm; }
115+ bool isInvalid () const { return Kind == Invalid; }
114116 unsigned getElementSizeInBits () const { return ElementBitwidth; }
115117 unsigned getNumVectors () const { return NumVectors; }
116118
@@ -445,6 +447,8 @@ std::string SVEType::builtinBaseType() const {
445447 case TypeKind::PrefetchOp:
446448 case TypeKind::PredicatePattern:
447449 return " i" ;
450+ case TypeKind::Fpm:
451+ return " Wi" ;
448452 case TypeKind::Predicate:
449453 return " b" ;
450454 case TypeKind::BFloat16:
@@ -482,6 +486,8 @@ std::string SVEType::builtinBaseType() const {
482486 default :
483487 llvm_unreachable (" Unhandled bitwidth!" );
484488 }
489+ case TypeKind::Invalid:
490+ llvm_unreachable (" Attempting to resolve builtin string from Invalid type!" );
485491 }
486492 llvm_unreachable (" Unhandled TypeKind!" );
487493}
@@ -547,6 +553,9 @@ std::string SVEType::str() const {
547553 break ;
548554 case TypeKind::UInt:
549555 TypeStr += " uint" + llvm::utostr (ElementBitwidth);
556+ break ;
557+ case TypeKind::Invalid:
558+ llvm_unreachable (" Attempting to resolve type name from Invalid type!" );
550559 }
551560
552561 if (isFixedLengthVector ())
@@ -570,27 +579,35 @@ void SVEType::applyTypespec(StringRef TS) {
570579 for (char I : TS) {
571580 switch (I) {
572581 case ' Q' :
582+ assert (Kind == Invalid && " Invalid use of modifer!" );
573583 Kind = Svcount;
574584 break ;
575585 case ' P' :
586+ assert (Kind == Invalid && " Invalid use of modifer!" );
576587 Kind = Predicate;
577588 break ;
578589 case ' U' :
590+ assert (Kind == Invalid && " Invalid use of modifer!" );
579591 Kind = UInt;
580592 break ;
581593 case ' c' :
594+ Kind = isInvalid () ? SInt : Kind;
582595 ElementBitwidth = 8 ;
583596 break ;
584597 case ' s' :
598+ Kind = isInvalid () ? SInt : Kind;
585599 ElementBitwidth = 16 ;
586600 break ;
587601 case ' i' :
602+ Kind = isInvalid () ? SInt : Kind;
588603 ElementBitwidth = 32 ;
589604 break ;
590605 case ' l' :
606+ Kind = isInvalid () ? SInt : Kind;
591607 ElementBitwidth = 64 ;
592608 break ;
593609 case ' q' :
610+ Kind = SInt;
594611 ElementBitwidth = 128 ;
595612 break ;
596613 case ' h' :
0 commit comments