1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[NFC][AArch64] Capturing multiple feature requirements in AsmParser messages

This enables the capturing of multiple required features in the AArch64
AsmParser's SysAlias error messages.

Reviewed By: ostannard

Differential Revision: https://reviews.llvm.org/D92388
This commit is contained in:
Lucas Prates 2020-11-30 15:23:27 +00:00
parent 2f00dfdbd4
commit c036de1337
8 changed files with 89 additions and 90 deletions

View File

@ -2907,14 +2907,13 @@ static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
else if (FBS[AArch64::HasV8_6aOps])
Str += "ARMv8.6a";
else {
auto ext = std::find_if(std::begin(ExtensionMap),
std::end(ExtensionMap),
[&](const Extension& e)
SmallVector<std::string, 2> ExtMatches;
for (const auto& Ext : ExtensionMap) {
// Use & in case multiple features are enabled
{ return (FBS & e.Features) != FeatureBitset(); }
);
Str += ext != std::end(ExtensionMap) ? ext->Name : "(unknown)";
if ((FBS & Ext.Features) != FeatureBitset())
ExtMatches.push_back(Ext.Name);
}
Str += !ExtMatches.empty() ? llvm::join(ExtMatches, ", ") : "(unknown)";
}
}
@ -2959,7 +2958,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
if (!IC)
return TokError("invalid operand for IC instruction");
else if (!IC->haveFeatures(getSTI().getFeatureBits())) {
std::string Str("IC " + std::string(IC->Name) + " requires ");
std::string Str("IC " + std::string(IC->Name) + " requires: ");
setRequiredFeatureString(IC->getRequiredFeatures(), Str);
return TokError(Str.c_str());
}
@ -2969,7 +2968,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
if (!DC)
return TokError("invalid operand for DC instruction");
else if (!DC->haveFeatures(getSTI().getFeatureBits())) {
std::string Str("DC " + std::string(DC->Name) + " requires ");
std::string Str("DC " + std::string(DC->Name) + " requires: ");
setRequiredFeatureString(DC->getRequiredFeatures(), Str);
return TokError(Str.c_str());
}
@ -2979,7 +2978,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
if (!AT)
return TokError("invalid operand for AT instruction");
else if (!AT->haveFeatures(getSTI().getFeatureBits())) {
std::string Str("AT " + std::string(AT->Name) + " requires ");
std::string Str("AT " + std::string(AT->Name) + " requires: ");
setRequiredFeatureString(AT->getRequiredFeatures(), Str);
return TokError(Str.c_str());
}
@ -2989,7 +2988,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
if (!TLBI)
return TokError("invalid operand for TLBI instruction");
else if (!TLBI->haveFeatures(getSTI().getFeatureBits())) {
std::string Str("TLBI " + std::string(TLBI->Name) + " requires ");
std::string Str("TLBI " + std::string(TLBI->Name) + " requires: ");
setRequiredFeatureString(TLBI->getRequiredFeatures(), Str);
return TokError(Str.c_str());
}
@ -3000,7 +2999,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
return TokError("invalid operand for prediction restriction instruction");
else if (!PRCTX->haveFeatures(getSTI().getFeatureBits())) {
std::string Str(
Mnemonic.upper() + std::string(PRCTX->Name) + " requires ");
Mnemonic.upper() + std::string(PRCTX->Name) + " requires: ");
setRequiredFeatureString(PRCTX->getRequiredFeatures(), Str);
return TokError(Str.c_str());
}

View File

@ -7,5 +7,5 @@
at s1e1wp, x2
// CHECK: at s1e1rp, x1 // encoding: [0x01,0x79,0x08,0xd5]
// CHECK: at s1e1wp, x2 // encoding: [0x22,0x79,0x08,0xd5]
// ERROR: error: AT S1E1RP requires pan-rwv
// ERROR: error: AT S1E1WP requires pan-rwv
// ERROR: error: AT S1E1RP requires: pan-rwv
// ERROR: error: AT S1E1WP requires: pan-rwv

View File

@ -4,4 +4,4 @@
dc cvap, x7
// CHECK: dc cvap, x7 // encoding: [0x27,0x7c,0x0b,0xd5]
// ERROR: error: DC CVAP requires ccpp
// ERROR: error: DC CVAP requires: ccpp

View File

@ -48,55 +48,55 @@ tlbi vae1os, sp
//CHECK-ERROR-NEXT: tlbi vae1os, sp
//CHECK-ERROR-NEXT: ^
//CHECK-NO-V84: error: TLBI VMALLE1OS requires tlb-rmi
//CHECK-NO-V84: error: TLBI VMALLE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vmalle1os
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vae1os, xzr
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vae1os, x0
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI ASIDE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI ASIDE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi aside1os, x1
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAAE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAAE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vaae1os, x2
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VALE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VALE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vale1os, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAALE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAALE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vaale1os, x4
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI IPAS2E1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI IPAS2E1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ipas2e1os, x5
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI IPAS2LE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI IPAS2LE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ipas2le1os, x6
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAE2OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAE2OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vae2os, x7
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VALE2OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VALE2OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vale2os, x8
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VMALLS12E1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VMALLS12E1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vmalls12e1os
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VAE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VAE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vae3os, x9
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI VALE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI VALE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi vale3os, x10
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI ALLE2OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI ALLE2OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi alle2os
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI ALLE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI ALLE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi alle1os
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI ALLE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI ALLE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi alle3os
//CHECK-NO-V84-NEXT: ^
@ -171,96 +171,96 @@ tlbi rvae1, sp
//CHECK-ERROR-NEXT: tlbi rvae1, sp
//CHECK-ERROR-NEXT: ^
//CHECK-NO-V84: error: TLBI RVAE1 requires tlb-rmi
//CHECK-NO-V84: error: TLBI RVAE1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae1, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaae1, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE1 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale1, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaale1, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaae1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaale1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae1os, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAAE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaae1os, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale1os, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAALE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvaale1os, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2e1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2le1is, x3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2e1, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2le1, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2E1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2e1os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RIPAS2LE1OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi ripas2le1os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE2 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE2 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae2, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE2 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE2 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale2, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE2IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE2IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae2is, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE2IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE2IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale2is, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE2OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE2OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae2os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE2OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE2OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale2os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE3 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE3 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae3, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE3 requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE3 requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale3, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE3IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE3IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae3is, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE3IS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE3IS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale3is, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVAE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVAE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvae3os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale3os, X3
//CHECK-NO-V84-NEXT: ^
//CHECK-NO-V84-NEXT: error: TLBI RVALE3OS requires tlb-rmi
//CHECK-NO-V84-NEXT: error: TLBI RVALE3OS requires: tlb-rmi
//CHECK-NO-V84-NEXT: tlbi rvale3os, XZR
//CHECK-NO-V84-NEXT: ^

View File

@ -441,24 +441,24 @@ dc gzva, x17
// CHECK: dc cigdvac, x16 // encoding: [0xb0,0x7e,0x0b,0xd5]
// CHECK: dc gzva, x17 // encoding: [0x91,0x74,0x0b,0xd5]
// NOMTE: DC IGVAC requires mte
// NOMTE: DC IGSW requires mte
// NOMTE: DC CGSW requires mte
// NOMTE: DC CIGSW requires mte
// NOMTE: DC CGVAC requires mte
// NOMTE: DC CGVAP requires mte
// NOMTE: DC CGVADP requires mte
// NOMTE: DC CIGVAC requires mte
// NOMTE: DC GVA requires mte
// NOMTE: DC IGDVAC requires mte
// NOMTE: DC IGDSW requires mte
// NOMTE: DC CGDSW requires mte
// NOMTE: DC CIGDSW requires mte
// NOMTE: DC CGDVAC requires mte
// NOMTE: DC CGDVAP requires mte
// NOMTE: DC CGDVADP requires mte
// NOMTE: DC CIGDVAC requires mte
// NOMTE: DC GZVA requires mte
// NOMTE: DC IGVAC requires: mte
// NOMTE: DC IGSW requires: mte
// NOMTE: DC CGSW requires: mte
// NOMTE: DC CIGSW requires: mte
// NOMTE: DC CGVAC requires: mte
// NOMTE: DC CGVAP requires: mte
// NOMTE: DC CGVADP requires: mte
// NOMTE: DC CIGVAC requires: mte
// NOMTE: DC GVA requires: mte
// NOMTE: DC IGDVAC requires: mte
// NOMTE: DC IGDSW requires: mte
// NOMTE: DC CGDSW requires: mte
// NOMTE: DC CIGDSW requires: mte
// NOMTE: DC CGDVAC requires: mte
// NOMTE: DC CGDVAP requires: mte
// NOMTE: DC CGDVADP requires: mte
// NOMTE: DC CIGDVAC requires: mte
// NOMTE: DC GZVA requires: mte
mrs x0, tco
mrs x1, gcr_el1

View File

@ -4,4 +4,4 @@
dc cvadp, x7
// CHECK: dc cvadp, x7 // encoding: [0x27,0x7d,0x0b,0xd5]
// NOCCDP: error: DC CVADP requires ccdp
// NOCCDP: error: DC CVADP requires: ccdp

View File

@ -10,9 +10,9 @@ cpp rctx, x2
// CHECK: dvp rctx, x1 // encoding: [0xa1,0x73,0x0b,0xd5]
// CHECK: cpp rctx, x2 // encoding: [0xe2,0x73,0x0b,0xd5]
// NOPREDCTRL: CFPRCTX requires predres
// NOPREDCTRL: CFPRCTX requires: predres
// NOPREDCTRL-NEXT: cfp
// NOPREDCTRL: DVPRCTX requires predres
// NOPREDCTRL: DVPRCTX requires: predres
// NOPREDCTRL-NEXT: dvp
// NOPREDCTRL: CPPRCTX requires predres
// NOPREDCTRL: CPPRCTX requires: predres
// NOPREDCTRL-NEXT: cpp

View File

@ -51,12 +51,12 @@ casa w5, w7, [x20]
.arch_extension nopredres
cfp rctx, x0
// CHECK: error: CFPRCTX requires predres
// CHECK: error: CFPRCTX requires: predres
// CHECK-NEXT: cfp rctx, x0
.arch_extension noccdp
dc cvadp, x7
// CHECK: error: DC CVADP requires ccdp
// CHECK: error: DC CVADP requires: ccdp
// CHECK-NEXT: dc cvadp, x7
.arch_extension nomte
@ -66,17 +66,17 @@ irg x0, x1
.arch_extension notlb-rmi
tlbi vmalle1os
// CHECK: error: TLBI VMALLE1OS requires tlb-rmi
// CHECK: error: TLBI VMALLE1OS requires: tlb-rmi
// CHECK-NEXT: tlbi vmalle1os
.arch_extension nopan-rwv
at s1e1wp, x2
// CHECK: error: AT S1E1WP requires pan-rwv
// CHECK: error: AT S1E1WP requires: pan-rwv
// CHECK-NEXT: at s1e1wp, x2
.arch_extension noccpp
dc cvap, x7
// CHECK: error: DC CVAP requires ccpp
// CHECK: error: DC CVAP requires: ccpp
// CHECK-NEXT: dc cvap, x7
.arch_extension norcpc