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

[AVR] Add register aliases XL, YH, etc

These aliases are sometimes used in assembly code and make the code more
readable. They are supported by avr-gcc too.

Differential Revision: https://reviews.llvm.org/D96492
This commit is contained in:
Ayke van Laethem 2021-02-11 14:07:53 +01:00
parent c5b90ec153
commit 67e3f1aa81
2 changed files with 39 additions and 6 deletions

View File

@ -67,12 +67,12 @@ def R22 : AVRReg<22, "r22">, DwarfRegNum<[22]>;
def R23 : AVRReg<23, "r23">, DwarfRegNum<[23]>;
def R24 : AVRReg<24, "r24">, DwarfRegNum<[24]>;
def R25 : AVRReg<25, "r25">, DwarfRegNum<[25]>;
def R26 : AVRReg<26, "r26">, DwarfRegNum<[26]>;
def R27 : AVRReg<27, "r27">, DwarfRegNum<[27]>;
def R28 : AVRReg<28, "r28">, DwarfRegNum<[28]>;
def R29 : AVRReg<29, "r29">, DwarfRegNum<[29]>;
def R30 : AVRReg<30, "r30">, DwarfRegNum<[30]>;
def R31 : AVRReg<31, "r31">, DwarfRegNum<[31]>;
def R26 : AVRReg<26, "r26", [], ["xl"]>, DwarfRegNum<[26]>;
def R27 : AVRReg<27, "r27", [], ["xh"]>, DwarfRegNum<[27]>;
def R28 : AVRReg<28, "r28", [], ["yl"]>, DwarfRegNum<[28]>;
def R29 : AVRReg<29, "r29", [], ["yh"]>, DwarfRegNum<[29]>;
def R30 : AVRReg<30, "r30", [], ["zl"]>, DwarfRegNum<[30]>;
def R31 : AVRReg<31, "r31", [], ["zh"]>, DwarfRegNum<[31]>;
def SPL : AVRReg<32, "SPL">, DwarfRegNum<[32]>;
def SPH : AVRReg<33, "SPH">, DwarfRegNum<[33]>;

33
test/MC/AVR/registers.s Normal file
View File

@ -0,0 +1,33 @@
; RUN: llvm-mc -triple avr -show-encoding < %s | FileCheck %s
; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck -check-prefix=CHECK-INST %s
; Test register aliases: the upper 6 registers have aliases that can be used in
; assembly.
foo:
inc xl
inc xh
inc yl
inc yh
inc zl
inc zh
inc XL ; test uppercase
; CHECK: inc r26 ; encoding: [0xa3,0x95]
; CHECK: inc r27 ; encoding: [0xb3,0x95]
; CHECK: inc r28 ; encoding: [0xc3,0x95]
; CHECK: inc r29 ; encoding: [0xd3,0x95]
; CHECK: inc r30 ; encoding: [0xe3,0x95]
; CHECK: inc r31 ; encoding: [0xf3,0x95]
; CHECK: inc r26 ; encoding: [0xa3,0x95]
; CHECK-INST: inc r26
; CHECK-INST: inc r27
; CHECK-INST: inc r28
; CHECK-INST: inc r29
; CHECK-INST: inc r30
; CHECK-INST: inc r31
; CHECK-INST: inc r26