[llvm] r341308 - [Sparc] allow tls_add/tls_call syntax in assembler parser
Daniel Cederman via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 3 03:38:12 PDT 2018
Author: dcederman
Date: Mon Sep 3 03:38:12 2018
New Revision: 341308
URL: http://llvm.org/viewvc/llvm-project?rev=341308&view=rev
Log:
[Sparc] allow tls_add/tls_call syntax in assembler parser
Summary: Removing unneeded isCodeGenOnly from tls-specific
instructions - TLS_ADD/TLS_LD/TLS_LDX/TLS_CALL.
Author: fedor.sergeev
Reviewers: jyknight, fedor.sergeev
Reviewed By: jyknight
Subscribers: dcederman, brad, llvm-commits
Differential Revision: https://reviews.llvm.org/D36463
Modified:
llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td
llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
llvm/trunk/test/MC/Sparc/sparc-tls-relocations.s
Modified: llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td?rev=341308&r1=341307&r2=341308&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td Mon Sep 3 03:38:12 2018
@@ -239,7 +239,7 @@ let Predicates = [Is64Bit] in {
let DecoderMethod = "DecodeLoadInt" in
defm LDX : Load<"ldx", 0b001011, load, I64Regs, i64>;
-let mayLoad = 1, isCodeGenOnly = 1, isAsmParserOnly = 1 in
+let mayLoad = 1, isAsmParserOnly = 1 in
def TLS_LDXrr : F3_1<3, 0b001011,
(outs IntRegs:$dst), (ins MEMrr:$addr, TLSSym:$sym),
"ldx [$addr], $dst, $sym",
Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=341308&r1=341307&r2=341308&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Mon Sep 3 03:38:12 2018
@@ -1334,7 +1334,7 @@ let Defs = [FCC0], rd = 0, isCodeGenOnly
//===----------------------------------------------------------------------===//
// Instructions for Thread Local Storage(TLS).
//===----------------------------------------------------------------------===//
-let isCodeGenOnly = 1, isAsmParserOnly = 1 in {
+let isAsmParserOnly = 1 in {
def TLS_ADDrr : F3_1<2, 0b000000,
(outs IntRegs:$rd),
(ins IntRegs:$rs1, IntRegs:$rs2, TLSSym:$sym),
Modified: llvm/trunk/test/MC/Sparc/sparc-tls-relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparc-tls-relocations.s?rev=341308&r1=341307&r2=341308&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparc-tls-relocations.s (original)
+++ llvm/trunk/test/MC/Sparc/sparc-tls-relocations.s Mon Sep 3 03:38:12 2018
@@ -10,74 +10,147 @@
! REL: Arch: sparc
! REL: Relocations [
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_HIX22 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_HI22 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_LO10 Head 0x0
-! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_LOX10 Head 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_HIX22 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_HI22 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_LO10 Local 0x0
+! REL: 0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_LOX10 Local 0x0
! REL: ]
! OBJDUMP: foo:
foo:
-! Here we use two different sequences to get the address of a static TLS variable 'Head'
+! Here we use two different sequences to get the address of a static TLS variable 'Local'
! (note - there is no intent to have valid assembler function here,
! we just check how TLS relocations are emitted)
!
-! First sequence uses LE_HIX22/LE_LOX10
+! Sequence for Local Executable model:
+! LE_HIX22/LE_LOX10
! OBJDUMP: {{[0-9,a-f]+}}: 31 00 00 00 sethi 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LE_HIX22 Head
-! ASM: sethi %tle_hix22(Head), %i0 ! encoding: [0x31,0x00,0x00,0x00]
-! ASM: ! fixup A - offset: 0, value: %tle_hix22(Head), kind: fixup_sparc_tls_le_hix22
- sethi %tle_hix22(Head), %i0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LE_HIX22 Local
+! ASM: sethi %tle_hix22(Local), %i0 ! encoding: [0x31,0x00,0x00,0x00]
+! ASM: ! fixup A - offset: 0, value: %tle_hix22(Local), kind: fixup_sparc_tls_le_hix22
+ sethi %tle_hix22(Local), %i0
! OBJDUMP: {{[0-9,a-f]+}}: b0 1e 20 00 xor %i0, 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LE_LOX10 Head
-! ASM: xor %i0, %tle_lox10(Head), %i0 ! encoding: [0xb0,0x1e,0x20,0x00]
-! ASM: ! fixup A - offset: 0, value: %tle_lox10(Head), kind: fixup_sparc_tls_le_lox10
- xor %i0, %tle_lox10(Head), %i0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LE_LOX10 Local
+! ASM: xor %i0, %tle_lox10(Local), %i0 ! encoding: [0xb0,0x1e,0x20,0x00]
+! ASM: ! fixup A - offset: 0, value: %tle_lox10(Local), kind: fixup_sparc_tls_le_lox10
+ xor %i0, %tle_lox10(Local), %i0
! Second sequence is for PIC, so it is more complicated.
-! It uses LDO_HIX22/LDO_LOX10/LDO_ADD/LDM_HI22/LDM_LO10/LDM_ADD/LDM_CALL
+! Local Dynamic model:
+! LDO_HIX22/LDO_LOX10/LDO_ADD/LDM_HI22/LDM_LO10/LDM_ADD/LDM_CALL
! OBJDUMP: {{[0-9,a-f]+}}: 33 00 00 00 sethi 0, %i1
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDO_HIX22 Head
-! ASM: sethi %tldo_hix22(Head), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
-! ASM: ! fixup A - offset: 0, value: %tldo_hix22(Head), kind: fixup_sparc_tls_ldo_hix22
- sethi %tldo_hix22(Head), %i1
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDO_HIX22 Local
+! ASM: sethi %tldo_hix22(Local), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM: ! fixup A - offset: 0, value: %tldo_hix22(Local), kind: fixup_sparc_tls_ldo_hix22
+ sethi %tldo_hix22(Local), %i1
! OBJDUMP: {{[0-9,a-f]+}}: 35 00 00 00 sethi 0, %i2
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_HI22 Head
-! ASM: sethi %tldm_hi22(Head), %i2 ! encoding: [0x35,0b00AAAAAA,A,A]
-! ASM: ! fixup A - offset: 0, value: %tldm_hi22(Head), kind: fixup_sparc_tls_ldm_hi22
- sethi %tldm_hi22(Head), %i2
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_HI22 Local
+! ASM: sethi %tldm_hi22(Local), %i2 ! encoding: [0x35,0b00AAAAAA,A,A]
+! ASM: ! fixup A - offset: 0, value: %tldm_hi22(Local), kind: fixup_sparc_tls_ldm_hi22
+ sethi %tldm_hi22(Local), %i2
! OBJDUMP: {{[0-9,a-f]+}}: b4 06 a0 00 add %i2, 0, %i2
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_LO10 Head
-! ASM: add %i2, %tldm_lo10(Head), %i2 ! encoding: [0xb4,0x06,0b101000AA,A]
-! ASM: ! fixup A - offset: 0, value: %tldm_lo10(Head), kind: fixup_sparc_tls_ldm_lo10
- add %i2, %tldm_lo10(Head), %i2
-
- ! ???error from llvm-mc on the next asm line???
- ! add %i0, %i2, %o0, %tldm_add(Head)
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_LO10 Local
+! ASM: add %i2, %tldm_lo10(Local), %i2 ! encoding: [0xb4,0x06,0b101000AA,A]
+! ASM: ! fixup A - offset: 0, value: %tldm_lo10(Local), kind: fixup_sparc_tls_ldm_lo10
+ add %i2, %tldm_lo10(Local), %i2
+
+! OBJDUMP: {{[0-9,a-f]+}}: 90 06 00 1a add %i0, %i2, %o0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_ADD Local
+! ASM: add %i0, %i2, %o0, %tldm_add(Local) ! encoding: [0x90,0x06,0x00,0x1a]
+! ASM: ! fixup A - offset: 0, value: %tldm_add(Local), kind: fixup_sparc_tls_ldm_add
+ add %i0, %i2, %o0, %tldm_add(Local)
! OBJDUMP: {{[0-9,a-f]+}}: b0 1e 60 00 xor %i1, 0, %i0
-! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDO_LOX10 Head
-! ASM: xor %i1, %tldo_lox10(Head), %i0 ! encoding: [0xb0,0x1e,0b011000AA,A]
-! ASM: ! fixup A - offset: 0, value: %tldo_lox10(Head), kind: fixup_sparc_tls_ldo_lox10
- xor %i1, %tldo_lox10(Head), %i0
-
- ! ???error from llvm-mc on the next asm line???
- ! call __tls_get_addr, %tldm_call(Head)
- ! nop
- ! ???error from llvm-mc on the next asm line???
- ! add %o0, %i0, %i0, %tldo_add(Head)
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDO_LOX10 Local
+! ASM: xor %i1, %tldo_lox10(Local), %i0 ! encoding: [0xb0,0x1e,0b011000AA,A]
+! ASM: ! fixup A - offset: 0, value: %tldo_lox10(Local), kind: fixup_sparc_tls_ldo_lox10
+ xor %i1, %tldo_lox10(Local), %i0
+
+! OBJDUMP: {{[0-9,a-f]+}}: 40 00 00 00 call 0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDM_CALL Local
+! ASM: call __tls_get_addr, %tldm_call(Local) ! encoding: [0x40,0x00,0x00,0x00]
+! ASM: ! fixup A - offset: 0, value: %tldm_call(Local), kind: fixup_sparc_tls_ldm_call
+ call __tls_get_addr, %tldm_call(Local)
+ nop
+
+! OBJDUMP: {{[0-9,a-f]+}}: 90 02 00 18 add %o0, %i0, %o0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_LDO_ADD Local
+! ASM: add %o0, %i0, %o0, %tldo_add(Local) ! encoding: [0x90,0x02,0x00,0x18]
+! ASM: ! fixup A - offset: 0, value: %tldo_add(Local), kind: fixup_sparc_tls_ldo_add
+ add %o0, %i0, %o0, %tldo_add(Local)
+
+! Next two sequences are for extern symbols.
+! Initial Executable model:
+! IE_HI22/IE_LO10/IE_LD (or IE_LDX)/IE_ADD
+
+! OBJDUMP: {{[0-9,a-f]+}}: 33 00 00 00 sethi 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_IE_HI22 Extern
+! ASM: sethi %tie_hi22(Extern), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM: ! fixup A - offset: 0, value: %tie_hi22(Extern), kind: fixup_sparc_tls_ie_hi22
+ sethi %tie_hi22(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}: b2 06 60 00 add %i1, 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_IE_LO10 Extern
+! ASM: add %i1, %tie_lo10(Extern), %i1 ! encoding: [0xb2,0x06,0b011000AA,A]
+! ASM: ! fixup A - offset: 0, value: %tie_lo10(Extern), kind: fixup_sparc_tls_ie_lo10
+ add %i1, %tie_lo10(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}: f0 06 00 19 ld [%i0+%i1], %i0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_IE_LD Extern
+! ASM: ld [%i0+%i1], %i0, %tie_ld(Extern) ! encoding: [0xf0,0x06,0x00,0x19]
+! ASM: ! fixup A - offset: 0, value: %tie_ld(Extern), kind: fixup_sparc_tls_ie_ld
+ ld [%i0+%i1], %i0, %tie_ld(Extern)
+
+! OBJDUMP: {{[0-9,a-f]+}}: f0 5e 00 19 ldx [%i0+%i1], %i0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_IE_LDX Extern
+! ASM: ldx [%i0+%i1], %i0, %tie_ldx(Extern) ! encoding: [0xf0,0x5e,0x00,0x19]
+! ASM: ! fixup A - offset: 0, value: %tie_ldx(Extern), kind: fixup_sparc_tls_ie_ldx
+ ldx [%i0+%i1], %i0, %tie_ldx(Extern)
+
+! OBJDUMP: {{[0-9,a-f]+}}: 90 01 c0 18 add %g7, %i0, %o0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_IE_ADD Extern
+! ASM: add %g7, %i0, %o0, %tie_add(Extern) ! encoding: [0x90,0x01,0xc0,0x18]
+! ASM: ! fixup A - offset: 0, value: %tie_add(Extern), kind: fixup_sparc_tls_ie_add
+ add %g7, %i0, %o0, %tie_add(Extern)
+
+! General Dynamic model
+! GD_HI22/GD_LO10/GD_ADD/GD_CALL
+
+! OBJDUMP: {{[0-9,a-f]+}}: 33 00 00 00 sethi 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_GD_HI22 Extern
+! ASM: sethi %tgd_hi22(Extern), %i1 ! encoding: [0x33,0b00AAAAAA,A,A]
+! ASM: ! fixup A - offset: 0, value: %tgd_hi22(Extern), kind: fixup_sparc_tls_gd_hi22
+ sethi %tgd_hi22(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}: b2 06 60 00 add %i1, 0, %i1
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_GD_LO10 Extern
+! ASM: add %i1, %tgd_lo10(Extern), %i1 ! encoding: [0xb2,0x06,0b011000AA,A]
+! ASM: ! fixup A - offset: 0, value: %tgd_lo10(Extern), kind: fixup_sparc_tls_gd_lo10
+ add %i1, %tgd_lo10(Extern), %i1
+
+! OBJDUMP: {{[0-9,a-f]+}}: 90 06 00 19 add %i0, %i1, %o0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_GD_ADD Extern
+! ASM: add %i0, %i1, %o0, %tgd_add(Extern) ! encoding: [0x90,0x06,0x00,0x19]
+! ASM: ! fixup A - offset: 0, value: %tgd_add(Extern), kind: fixup_sparc_tls_gd_add
+ add %i0, %i1, %o0, %tgd_add(Extern)
+
+! OBJDUMP: {{[0-9,a-f]+}}: 40 00 00 00 call 0
+! OBJDUMP: {{[0-9,a-f]+}}: R_SPARC_TLS_GD_CALL Extern
+! ASM: call __tls_get_addr, %tgd_call(Extern) ! encoding: [0x40,0x00,0x00,0x00]
+! ASM: ! fixup A - offset: 0, value: %tgd_call(Extern), kind: fixup_sparc_tls_gd_call
+ call __tls_get_addr, %tgd_call(Extern)
- .type Head, at object
+ .type Local, at object
.section .tbss,#alloc,#write,#tls
-Head:
+Local:
.word 0
- .size Head, 4
+ .size Local, 4
More information about the llvm-commits
mailing list