@@ -814,7 +814,9 @@ class AArch64Operand : public MCParsedAsmOperand {
814
814
return (Val >= 0 && Val < 64 );
815
815
}
816
816
817
- template <int Width> bool isSImm () const { return isSImmScaled<Width, 1 >(); }
817
+ template <int Width> bool isSImm () const {
818
+ return bool (isSImmScaled<Width, 1 >());
819
+ }
818
820
819
821
template <int Bits, int Scale> DiagnosticPredicate isSImmScaled () const {
820
822
return isImmScaled<Bits, Scale>(true );
@@ -824,7 +826,7 @@ class AArch64Operand : public MCParsedAsmOperand {
824
826
DiagnosticPredicate isUImmScaled () const {
825
827
if (IsRange && isImmRange () &&
826
828
(getLastImmVal () != getFirstImmVal () + Offset))
827
- return DiagnosticPredicateTy ::NoMatch;
829
+ return DiagnosticPredicate ::NoMatch;
828
830
829
831
return isImmScaled<Bits, Scale, IsRange>(false );
830
832
}
@@ -833,15 +835,15 @@ class AArch64Operand : public MCParsedAsmOperand {
833
835
DiagnosticPredicate isImmScaled (bool Signed) const {
834
836
if ((!isImm () && !isImmRange ()) || (isImm () && IsRange) ||
835
837
(isImmRange () && !IsRange))
836
- return DiagnosticPredicateTy ::NoMatch;
838
+ return DiagnosticPredicate ::NoMatch;
837
839
838
840
int64_t Val;
839
841
if (isImmRange ())
840
842
Val = getFirstImmVal ();
841
843
else {
842
844
const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(getImm ());
843
845
if (!MCE)
844
- return DiagnosticPredicateTy ::NoMatch;
846
+ return DiagnosticPredicate ::NoMatch;
845
847
Val = MCE->getValue ();
846
848
}
847
849
@@ -856,33 +858,33 @@ class AArch64Operand : public MCParsedAsmOperand {
856
858
}
857
859
858
860
if (Val >= MinVal && Val <= MaxVal && (Val % Scale) == 0 )
859
- return DiagnosticPredicateTy ::Match;
861
+ return DiagnosticPredicate ::Match;
860
862
861
- return DiagnosticPredicateTy ::NearMatch;
863
+ return DiagnosticPredicate ::NearMatch;
862
864
}
863
865
864
866
DiagnosticPredicate isSVEPattern () const {
865
867
if (!isImm ())
866
- return DiagnosticPredicateTy ::NoMatch;
868
+ return DiagnosticPredicate ::NoMatch;
867
869
auto *MCE = dyn_cast<MCConstantExpr>(getImm ());
868
870
if (!MCE)
869
- return DiagnosticPredicateTy ::NoMatch;
871
+ return DiagnosticPredicate ::NoMatch;
870
872
int64_t Val = MCE->getValue ();
871
873
if (Val >= 0 && Val < 32 )
872
- return DiagnosticPredicateTy ::Match;
873
- return DiagnosticPredicateTy ::NearMatch;
874
+ return DiagnosticPredicate ::Match;
875
+ return DiagnosticPredicate ::NearMatch;
874
876
}
875
877
876
878
DiagnosticPredicate isSVEVecLenSpecifier () const {
877
879
if (!isImm ())
878
- return DiagnosticPredicateTy ::NoMatch;
880
+ return DiagnosticPredicate ::NoMatch;
879
881
auto *MCE = dyn_cast<MCConstantExpr>(getImm ());
880
882
if (!MCE)
881
- return DiagnosticPredicateTy ::NoMatch;
883
+ return DiagnosticPredicate ::NoMatch;
882
884
int64_t Val = MCE->getValue ();
883
885
if (Val >= 0 && Val <= 1 )
884
- return DiagnosticPredicateTy ::Match;
885
- return DiagnosticPredicateTy ::NearMatch;
886
+ return DiagnosticPredicate ::Match;
887
+ return DiagnosticPredicate ::NearMatch;
886
888
}
887
889
888
890
bool isSymbolicUImm12Offset (const MCExpr *Expr) const {
@@ -1057,41 +1059,41 @@ class AArch64Operand : public MCParsedAsmOperand {
1057
1059
template <typename T>
1058
1060
DiagnosticPredicate isSVECpyImm () const {
1059
1061
if (!isShiftedImm () && (!isImm () || !isa<MCConstantExpr>(getImm ())))
1060
- return DiagnosticPredicateTy ::NoMatch;
1062
+ return DiagnosticPredicate ::NoMatch;
1061
1063
1062
1064
bool IsByte = std::is_same<int8_t , std::make_signed_t <T>>::value ||
1063
1065
std::is_same<int8_t , T>::value;
1064
1066
if (auto ShiftedImm = getShiftedVal<8 >())
1065
1067
if (!(IsByte && ShiftedImm->second ) &&
1066
1068
AArch64_AM::isSVECpyImm<T>(uint64_t (ShiftedImm->first )
1067
1069
<< ShiftedImm->second ))
1068
- return DiagnosticPredicateTy ::Match;
1070
+ return DiagnosticPredicate ::Match;
1069
1071
1070
- return DiagnosticPredicateTy ::NearMatch;
1072
+ return DiagnosticPredicate ::NearMatch;
1071
1073
}
1072
1074
1073
1075
// Unsigned value in the range 0 to 255. For element widths of
1074
1076
// 16 bits or higher it may also be a signed multiple of 256 in the
1075
1077
// range 0 to 65280.
1076
1078
template <typename T> DiagnosticPredicate isSVEAddSubImm () const {
1077
1079
if (!isShiftedImm () && (!isImm () || !isa<MCConstantExpr>(getImm ())))
1078
- return DiagnosticPredicateTy ::NoMatch;
1080
+ return DiagnosticPredicate ::NoMatch;
1079
1081
1080
1082
bool IsByte = std::is_same<int8_t , std::make_signed_t <T>>::value ||
1081
1083
std::is_same<int8_t , T>::value;
1082
1084
if (auto ShiftedImm = getShiftedVal<8 >())
1083
1085
if (!(IsByte && ShiftedImm->second ) &&
1084
1086
AArch64_AM::isSVEAddSubImm<T>(ShiftedImm->first
1085
1087
<< ShiftedImm->second ))
1086
- return DiagnosticPredicateTy ::Match;
1088
+ return DiagnosticPredicate ::Match;
1087
1089
1088
- return DiagnosticPredicateTy ::NearMatch;
1090
+ return DiagnosticPredicate ::NearMatch;
1089
1091
}
1090
1092
1091
1093
template <typename T> DiagnosticPredicate isSVEPreferredLogicalImm () const {
1092
1094
if (isLogicalImm<T>() && !isSVECpyImm<T>())
1093
- return DiagnosticPredicateTy ::Match;
1094
- return DiagnosticPredicateTy ::NoMatch;
1095
+ return DiagnosticPredicate ::Match;
1096
+ return DiagnosticPredicate ::NoMatch;
1095
1097
}
1096
1098
1097
1099
bool isCondCode () const { return Kind == k_CondCode; }
@@ -1319,48 +1321,48 @@ class AArch64Operand : public MCParsedAsmOperand {
1319
1321
template <int ElementWidth, unsigned Class>
1320
1322
DiagnosticPredicate isSVEPredicateVectorRegOfWidth () const {
1321
1323
if (Kind != k_Register || Reg.Kind != RegKind::SVEPredicateVector)
1322
- return DiagnosticPredicateTy ::NoMatch;
1324
+ return DiagnosticPredicate ::NoMatch;
1323
1325
1324
1326
if (isSVEVectorReg<Class>() && (Reg.ElementWidth == ElementWidth))
1325
- return DiagnosticPredicateTy ::Match;
1327
+ return DiagnosticPredicate ::Match;
1326
1328
1327
- return DiagnosticPredicateTy ::NearMatch;
1329
+ return DiagnosticPredicate ::NearMatch;
1328
1330
}
1329
1331
1330
1332
template <int ElementWidth, unsigned Class>
1331
1333
DiagnosticPredicate isSVEPredicateOrPredicateAsCounterRegOfWidth () const {
1332
1334
if (Kind != k_Register || (Reg.Kind != RegKind::SVEPredicateAsCounter &&
1333
1335
Reg.Kind != RegKind::SVEPredicateVector))
1334
- return DiagnosticPredicateTy ::NoMatch;
1336
+ return DiagnosticPredicate ::NoMatch;
1335
1337
1336
1338
if ((isSVEPredicateAsCounterReg<Class>() ||
1337
1339
isSVEPredicateVectorRegOfWidth<ElementWidth, Class>()) &&
1338
1340
Reg.ElementWidth == ElementWidth)
1339
- return DiagnosticPredicateTy ::Match;
1341
+ return DiagnosticPredicate ::Match;
1340
1342
1341
- return DiagnosticPredicateTy ::NearMatch;
1343
+ return DiagnosticPredicate ::NearMatch;
1342
1344
}
1343
1345
1344
1346
template <int ElementWidth, unsigned Class>
1345
1347
DiagnosticPredicate isSVEPredicateAsCounterRegOfWidth () const {
1346
1348
if (Kind != k_Register || Reg.Kind != RegKind::SVEPredicateAsCounter)
1347
- return DiagnosticPredicateTy ::NoMatch;
1349
+ return DiagnosticPredicate ::NoMatch;
1348
1350
1349
1351
if (isSVEPredicateAsCounterReg<Class>() && (Reg.ElementWidth == ElementWidth))
1350
- return DiagnosticPredicateTy ::Match;
1352
+ return DiagnosticPredicate ::Match;
1351
1353
1352
- return DiagnosticPredicateTy ::NearMatch;
1354
+ return DiagnosticPredicate ::NearMatch;
1353
1355
}
1354
1356
1355
1357
template <int ElementWidth, unsigned Class>
1356
1358
DiagnosticPredicate isSVEDataVectorRegOfWidth () const {
1357
1359
if (Kind != k_Register || Reg.Kind != RegKind::SVEDataVector)
1358
- return DiagnosticPredicateTy ::NoMatch;
1360
+ return DiagnosticPredicate ::NoMatch;
1359
1361
1360
1362
if (isSVEVectorReg<Class>() && Reg.ElementWidth == ElementWidth)
1361
- return DiagnosticPredicateTy ::Match;
1363
+ return DiagnosticPredicate ::Match;
1362
1364
1363
- return DiagnosticPredicateTy ::NearMatch;
1365
+ return DiagnosticPredicate ::NearMatch;
1364
1366
}
1365
1367
1366
1368
template <int ElementWidth, unsigned Class,
@@ -1369,7 +1371,7 @@ class AArch64Operand : public MCParsedAsmOperand {
1369
1371
DiagnosticPredicate isSVEDataVectorRegWithShiftExtend () const {
1370
1372
auto VectorMatch = isSVEDataVectorRegOfWidth<ElementWidth, Class>();
1371
1373
if (!VectorMatch.isMatch ())
1372
- return DiagnosticPredicateTy ::NoMatch;
1374
+ return DiagnosticPredicate ::NoMatch;
1373
1375
1374
1376
// Give a more specific diagnostic when the user has explicitly typed in
1375
1377
// a shift-amount that does not match what is expected, but for which
@@ -1378,12 +1380,12 @@ class AArch64Operand : public MCParsedAsmOperand {
1378
1380
if (!MatchShift && (ShiftExtendTy == AArch64_AM::UXTW ||
1379
1381
ShiftExtendTy == AArch64_AM::SXTW) &&
1380
1382
!ShiftWidthAlwaysSame && hasShiftExtendAmount () && ShiftWidth == 8 )
1381
- return DiagnosticPredicateTy ::NoMatch;
1383
+ return DiagnosticPredicate ::NoMatch;
1382
1384
1383
1385
if (MatchShift && ShiftExtendTy == getShiftExtendType ())
1384
- return DiagnosticPredicateTy ::Match;
1386
+ return DiagnosticPredicate ::Match;
1385
1387
1386
- return DiagnosticPredicateTy ::NearMatch;
1388
+ return DiagnosticPredicate ::NearMatch;
1387
1389
}
1388
1390
1389
1391
bool isGPR32as64 () const {
@@ -1420,15 +1422,17 @@ class AArch64Operand : public MCParsedAsmOperand {
1420
1422
1421
1423
template <int64_t Angle, int64_t Remainder>
1422
1424
DiagnosticPredicate isComplexRotation () const {
1423
- if (!isImm ()) return DiagnosticPredicateTy::NoMatch;
1425
+ if (!isImm ())
1426
+ return DiagnosticPredicate::NoMatch;
1424
1427
1425
1428
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm ());
1426
- if (!CE) return DiagnosticPredicateTy::NoMatch;
1429
+ if (!CE)
1430
+ return DiagnosticPredicate::NoMatch;
1427
1431
uint64_t Value = CE->getValue ();
1428
1432
1429
1433
if (Value % Angle == Remainder && Value <= 270 )
1430
- return DiagnosticPredicateTy ::Match;
1431
- return DiagnosticPredicateTy ::NearMatch;
1434
+ return DiagnosticPredicate ::Match;
1435
+ return DiagnosticPredicate ::NearMatch;
1432
1436
}
1433
1437
1434
1438
template <unsigned RegClassID> bool isGPR64 () const {
@@ -1439,12 +1443,12 @@ class AArch64Operand : public MCParsedAsmOperand {
1439
1443
template <unsigned RegClassID, int ExtWidth>
1440
1444
DiagnosticPredicate isGPR64WithShiftExtend () const {
1441
1445
if (Kind != k_Register || Reg.Kind != RegKind::Scalar)
1442
- return DiagnosticPredicateTy ::NoMatch;
1446
+ return DiagnosticPredicate ::NoMatch;
1443
1447
1444
1448
if (isGPR64<RegClassID>() && getShiftExtendType () == AArch64_AM::LSL &&
1445
1449
getShiftExtendAmount () == Log2_32 (ExtWidth / 8 ))
1446
- return DiagnosticPredicateTy ::Match;
1447
- return DiagnosticPredicateTy ::NearMatch;
1450
+ return DiagnosticPredicate ::Match;
1451
+ return DiagnosticPredicate ::NearMatch;
1448
1452
}
1449
1453
1450
1454
// / Is this a vector list with the type implicit (presumably attached to the
@@ -1479,10 +1483,10 @@ class AArch64Operand : public MCParsedAsmOperand {
1479
1483
bool Res =
1480
1484
isTypedVectorList<VectorKind, NumRegs, NumElements, ElementWidth>();
1481
1485
if (!Res)
1482
- return DiagnosticPredicateTy ::NoMatch;
1486
+ return DiagnosticPredicate ::NoMatch;
1483
1487
if (!AArch64MCRegisterClasses[RegClass].contains (VectorList.RegNum ))
1484
- return DiagnosticPredicateTy ::NearMatch;
1485
- return DiagnosticPredicateTy ::Match;
1488
+ return DiagnosticPredicate ::NearMatch;
1489
+ return DiagnosticPredicate ::Match;
1486
1490
}
1487
1491
1488
1492
template <RegKind VectorKind, unsigned NumRegs, unsigned Stride,
@@ -1491,21 +1495,21 @@ class AArch64Operand : public MCParsedAsmOperand {
1491
1495
bool Res = isTypedVectorList<VectorKind, NumRegs, /* NumElements*/ 0 ,
1492
1496
ElementWidth, Stride>();
1493
1497
if (!Res)
1494
- return DiagnosticPredicateTy ::NoMatch;
1498
+ return DiagnosticPredicate ::NoMatch;
1495
1499
if ((VectorList.RegNum < (AArch64::Z0 + Stride)) ||
1496
1500
((VectorList.RegNum >= AArch64::Z16) &&
1497
1501
(VectorList.RegNum < (AArch64::Z16 + Stride))))
1498
- return DiagnosticPredicateTy ::Match;
1499
- return DiagnosticPredicateTy ::NoMatch;
1502
+ return DiagnosticPredicate ::Match;
1503
+ return DiagnosticPredicate ::NoMatch;
1500
1504
}
1501
1505
1502
1506
template <int Min, int Max>
1503
1507
DiagnosticPredicate isVectorIndex () const {
1504
1508
if (Kind != k_VectorIndex)
1505
- return DiagnosticPredicateTy ::NoMatch;
1509
+ return DiagnosticPredicate ::NoMatch;
1506
1510
if (VectorIndex.Val >= Min && VectorIndex.Val <= Max)
1507
- return DiagnosticPredicateTy ::Match;
1508
- return DiagnosticPredicateTy ::NearMatch;
1511
+ return DiagnosticPredicate ::Match;
1512
+ return DiagnosticPredicate ::NearMatch;
1509
1513
}
1510
1514
1511
1515
bool isToken () const override { return Kind == k_Token; }
@@ -1531,7 +1535,7 @@ class AArch64Operand : public MCParsedAsmOperand {
1531
1535
1532
1536
template <unsigned ImmEnum> DiagnosticPredicate isExactFPImm () const {
1533
1537
if (Kind != k_FPImm)
1534
- return DiagnosticPredicateTy ::NoMatch;
1538
+ return DiagnosticPredicate ::NoMatch;
1535
1539
1536
1540
if (getFPImmIsExact ()) {
1537
1541
// Lookup the immediate from table of supported immediates.
@@ -1546,19 +1550,19 @@ class AArch64Operand : public MCParsedAsmOperand {
1546
1550
llvm_unreachable (" FP immediate is not exact" );
1547
1551
1548
1552
if (getFPImm ().bitwiseIsEqual (RealVal))
1549
- return DiagnosticPredicateTy ::Match;
1553
+ return DiagnosticPredicate ::Match;
1550
1554
}
1551
1555
1552
- return DiagnosticPredicateTy ::NearMatch;
1556
+ return DiagnosticPredicate ::NearMatch;
1553
1557
}
1554
1558
1555
1559
template <unsigned ImmA, unsigned ImmB>
1556
1560
DiagnosticPredicate isExactFPImm () const {
1557
- DiagnosticPredicate Res = DiagnosticPredicateTy ::NoMatch;
1561
+ DiagnosticPredicate Res = DiagnosticPredicate ::NoMatch;
1558
1562
if ((Res = isExactFPImm<ImmA>()))
1559
- return DiagnosticPredicateTy ::Match;
1563
+ return DiagnosticPredicate ::Match;
1560
1564
if ((Res = isExactFPImm<ImmB>()))
1561
- return DiagnosticPredicateTy ::Match;
1565
+ return DiagnosticPredicate ::Match;
1562
1566
return Res;
1563
1567
}
1564
1568
@@ -1741,12 +1745,12 @@ class AArch64Operand : public MCParsedAsmOperand {
1741
1745
template <MatrixKind Kind, unsigned EltSize, unsigned RegClass>
1742
1746
DiagnosticPredicate isMatrixRegOperand () const {
1743
1747
if (!isMatrix ())
1744
- return DiagnosticPredicateTy ::NoMatch;
1748
+ return DiagnosticPredicate ::NoMatch;
1745
1749
if (getMatrixKind () != Kind ||
1746
1750
!AArch64MCRegisterClasses[RegClass].contains (getMatrixReg ()) ||
1747
1751
EltSize != getMatrixElementWidth ())
1748
- return DiagnosticPredicateTy ::NearMatch;
1749
- return DiagnosticPredicateTy ::Match;
1752
+ return DiagnosticPredicate ::NearMatch;
1753
+ return DiagnosticPredicate ::Match;
1750
1754
}
1751
1755
1752
1756
bool isPAuthPCRelLabel16Operand () const {
0 commit comments