Skip to content

Commit e8a2ce1

Browse files
authored
[AArch64] When printing SYS aliases, use explicit NeedsReg flag from tablegen (NFC) (#140484)
Currently, when printing SYS aliases, the first instruction operand is compared with the string constant "all" to decide if a register needs to be parsed as the next operand. For example, `TLBI VMALLE1IS` contains "all" so no register is expected, but `TLBI IPAS2E1IS` doesn't match, so a register is expected. Future AArch64 SYS aliases won't always match this pattern, so use the (already provided) explicit `NeedsReg` bit flag provided in tablegen to check if a register is required to be parsed. This is already used by the code in `AArch64InstPrinter.cpp`, so now we are consistent in this source file too. No test files have been changed, since this is a non-functional change, and all AArch64 test cases continue to pass after this change.
1 parent 35a9631 commit e8a2ce1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3917,6 +3917,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
39173917
const AsmToken &Tok = getTok();
39183918
StringRef Op = Tok.getString();
39193919
SMLoc S = Tok.getLoc();
3920+
bool ExpectRegister = true;
39203921

39213922
if (Mnemonic == "ic") {
39223923
const AArch64IC::IC *IC = AArch64IC::lookupICByName(Op);
@@ -3927,6 +3928,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
39273928
setRequiredFeatureString(IC->getRequiredFeatures(), Str);
39283929
return TokError(Str);
39293930
}
3931+
ExpectRegister = IC->NeedsReg;
39303932
createSysAlias(IC->Encoding, Operands, S);
39313933
} else if (Mnemonic == "dc") {
39323934
const AArch64DC::DC *DC = AArch64DC::lookupDCByName(Op);
@@ -3957,6 +3959,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
39573959
setRequiredFeatureString(TLBI->getRequiredFeatures(), Str);
39583960
return TokError(Str);
39593961
}
3962+
ExpectRegister = TLBI->NeedsReg;
39603963
createSysAlias(TLBI->Encoding, Operands, S);
39613964
} else if (Mnemonic == "cfp" || Mnemonic == "dvp" || Mnemonic == "cpp" || Mnemonic == "cosp") {
39623965

@@ -3987,7 +3990,6 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
39873990

39883991
Lex(); // Eat operand.
39893992

3990-
bool ExpectRegister = !Op.contains_insensitive("all");
39913993
bool HasRegister = false;
39923994

39933995
// Check for the optional register operand.

0 commit comments

Comments
 (0)