[llvm] [AArch64][llvm] Disassemble instructions in `SYS` alias encoding space correctly (PR #153905)
Jonathan Thackray via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 05:50:15 PDT 2025
================
@@ -1017,13 +1018,24 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
else
return false;
+ StringRef Reg = getRegisterName(MI->getOperand(4).getReg());
+ bool NotXZR = Reg != "xzr";
+
+ // If a mandatory or optional register is not specified in the TableGen
+ // (i.e. no register operand should be present), and the register value
+ // is not xzr/x31, then disassemble to a SYS alias instead.
+ if (NotXZR && !NeedsReg && !OptionalReg)
+ return false;
+
std::string Str = Ins + Name;
llvm::transform(Str, Str.begin(), ::tolower);
O << '\t' << Str;
- if (NeedsReg) {
- O << ", ";
- printRegName(O, MI->getOperand(4).getReg());
+
+ // For optional registers, don't print the value if it's xzr/x31
+ // since this defaults to xzr/x31 if register is not specified.
+ if (NeedsReg || (OptionalReg && NotXZR)) {
----------------
jthackray wrote:
Removed.
https://github.com/llvm/llvm-project/pull/153905
More information about the llvm-commits
mailing list