Skip to content

Commit 246b0b6

Browse files
committed
[ARM64] Change SYS without a register to an alias to make disassembling more consistant.
llvm-svn: 205898
1 parent 2cef19a commit 246b0b6

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

llvm/lib/Target/ARM64/ARM64InstrFormats.td

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -774,22 +774,6 @@ def sys_cr_op : Operand<i32> {
774774
let ParserMatchClass = SysCRAsmOperand;
775775
}
776776

777-
class SystemI<bit L, string asm>
778-
: SimpleSystemI<L,
779-
(ins imm0_7:$op1, sys_cr_op:$Cn, sys_cr_op:$Cm, imm0_7:$op2),
780-
asm, "\t$op1, $Cn, $Cm, $op2">,
781-
Sched<[WriteSys]> {
782-
bits<3> op1;
783-
bits<4> Cn;
784-
bits<4> Cm;
785-
bits<3> op2;
786-
let Inst{20-19} = 0b01;
787-
let Inst{18-16} = op1;
788-
let Inst{15-12} = Cn;
789-
let Inst{11-8} = Cm;
790-
let Inst{7-5} = op2;
791-
}
792-
793777
class SystemXtI<bit L, string asm>
794778
: RtSystemI<L, (outs),
795779
(ins imm0_7:$op1, sys_cr_op:$Cn, sys_cr_op:$Cm, imm0_7:$op2, GPR64:$Rt),

llvm/lib/Target/ARM64/ARM64InstrInfo.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,13 @@ def MSRcpsr: MSRcpsrI;
332332
def : Pat<(ARM64threadpointer), (MRS 0xde82)>;
333333

334334
// Generic system instructions
335-
def SYS : SystemI<0, "sys">;
336335
def SYSxt : SystemXtI<0, "sys">;
337336
def SYSLxt : SystemLXtI<1, "sysl">;
338337

338+
def : InstAlias<"sys $op1, $Cn, $Cm, $op2",
339+
(SYSxt imm0_7:$op1, sys_cr_op:$Cn,
340+
sys_cr_op:$Cm, imm0_7:$op2, XZR)>;
341+
339342
//===----------------------------------------------------------------------===//
340343
// Move immediate instructions.
341344
//===----------------------------------------------------------------------===//

llvm/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void ARM64InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
5656

5757
unsigned Opcode = MI->getOpcode();
5858

59-
if (Opcode == ARM64::SYS || Opcode == ARM64::SYSxt)
59+
if (Opcode == ARM64::SYSxt)
6060
if (printSysAlias(MI, O)) {
6161
printAnnotation(O, Annot);
6262
return;
@@ -750,8 +750,7 @@ void ARM64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
750750
bool ARM64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) {
751751
#ifndef NDEBUG
752752
unsigned Opcode = MI->getOpcode();
753-
assert((Opcode == ARM64::SYS || Opcode == ARM64::SYSxt) &&
754-
"Invalid opcode for SYS alias!");
753+
assert(Opcode == ARM64::SYSxt && "Invalid opcode for SYS alias!");
755754
#endif
756755

757756
const char *Asm = 0;
@@ -961,9 +960,11 @@ bool ARM64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) {
961960
}
962961

963962
if (Asm) {
963+
unsigned Reg = MI->getOperand(4).getReg();
964+
964965
O << '\t' << Asm;
965-
if (MI->getNumOperands() == 5)
966-
O << ", " << getRegisterName(MI->getOperand(4).getReg());
966+
if (StringRef(Asm).lower().find("all") == StringRef::npos)
967+
O << ", " << getRegisterName(Reg);
967968
}
968969

969970
return Asm != 0;

llvm/test/MC/Disassembler/ARM64/system.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
# CHECK: dmb osh
3333
0x9f 0x37 0x03 0xd5
3434
# CHECK: dsb nsh
35+
0x3f 0x76 0x08 0xd5
36+
# CHECK: dc ivac
3537

3638
#-----------------------------------------------------------------------------
3739
# Generic system instructions

0 commit comments

Comments
 (0)