@@ -513,53 +513,56 @@ std::string SVEType::builtin_str() const {
513
513
}
514
514
515
515
std::string SVEType::str () const {
516
- if (isPredicatePattern ())
517
- return " enum svpattern" ;
516
+ std::string TypeStr;
518
517
519
- if (isPrefetchOp ())
518
+ switch (Kind) {
519
+ case TypeKind::PrefetchOp:
520
520
return " enum svprfop" ;
521
-
522
- if (isFpm ())
523
- return " fpm_t" ;
524
-
525
- std::string S;
526
- if (isVoid ())
527
- S += " void" ;
528
- else {
529
- if (isScalableVector () || isSvcount ())
530
- S += " sv" ;
531
-
532
- if (isFloat ())
533
- S += " float" ;
534
- else if (isSvcount ())
535
- S += " count" ;
536
- else if (isPredicate ())
537
- S += " bool" ;
538
- else if (isBFloat ())
539
- S += " bfloat" ;
540
- else if (isMFloat ())
541
- S += " mfloat" ;
542
- else if (isSignedInteger ())
543
- S += " int" ;
544
- else if (isUnsignedInteger ())
545
- S += " uint" ;
546
-
547
- if (!isPredicate () && !isSvcount ())
548
- S += utostr (ElementBitwidth);
549
- if (isFixedLengthVector ())
550
- S += " x" + utostr (getNumElements ());
551
- if (NumVectors > 1 )
552
- S += " x" + utostr (NumVectors);
553
- if (!isScalarPredicate ())
554
- S += " _t" ;
521
+ case TypeKind::PredicatePattern:
522
+ return " enum svpattern" ;
523
+ case TypeKind::Fpm:
524
+ TypeStr += " fpm" ;
525
+ break ;
526
+ case TypeKind::Void:
527
+ TypeStr += " void" ;
528
+ break ;
529
+ case TypeKind::Float:
530
+ TypeStr += " float" + llvm::utostr (ElementBitwidth);
531
+ break ;
532
+ case TypeKind::Svcount:
533
+ TypeStr += " svcount" ;
534
+ break ;
535
+ case TypeKind::Predicate:
536
+ TypeStr += " bool" ;
537
+ break ;
538
+ case TypeKind::BFloat16:
539
+ TypeStr += " bfloat16" ;
540
+ break ;
541
+ case TypeKind::MFloat8:
542
+ TypeStr += " mfloat8" ;
543
+ break ;
544
+ case TypeKind::SInt:
545
+ TypeStr += " int" + llvm::utostr (ElementBitwidth);
546
+ break ;
547
+ case TypeKind::UInt:
548
+ TypeStr += " uint" + llvm::utostr (ElementBitwidth);
555
549
}
556
550
557
- if (Constant )
558
- S += " const " ;
559
- if (Pointer )
560
- S + = " * " ;
551
+ if (isFixedLengthVector () )
552
+ TypeStr += " x " + llvm::utostr ( getNumElements ()) ;
553
+ else if (isScalableVector () )
554
+ TypeStr = " sv " + TypeStr ;
561
555
562
- return S;
556
+ if (NumVectors > 1 )
557
+ TypeStr += " x" + llvm::utostr (NumVectors);
558
+ if (!isScalarPredicate () && !isVoid ())
559
+ TypeStr += " _t" ;
560
+ if (isConstant ())
561
+ TypeStr += " const" ;
562
+ if (isPointer ())
563
+ TypeStr += " *" ;
564
+
565
+ return TypeStr;
563
566
}
564
567
565
568
void SVEType::applyTypespec (StringRef TS) {
0 commit comments