Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch introduces TLS (Thread-Local Storage) support to the LLVM m68k backend. Reviewed By: glaubitz Differential Revision: https://reviews.llvm.org/D144941
- Loading branch information
Showing
12 changed files
with
317 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=m68k --relocation-model=pic -o - %s | FileCheck %s | ||
|
||
@myvar = external thread_local global i32, align 4 | ||
|
||
define ptr @get_addr() nounwind { | ||
; CHECK-LABEL: get_addr: | ||
; CHECK: ; %bb.0: ; %entry | ||
; CHECK-NEXT: suba.l #4, %sp | ||
; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 | ||
; CHECK-NEXT: adda.l myvar@TLSGD, %a0 | ||
; CHECK-NEXT: move.l %a0, (%sp) | ||
; CHECK-NEXT: jsr (__tls_get_addr@PLT,%pc) | ||
; CHECK-NEXT: adda.l #4, %sp | ||
; CHECK-NEXT: rts | ||
entry: | ||
%0 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @myvar) | ||
ret ptr %0 | ||
} | ||
|
||
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=m68k -o - %s | FileCheck %s | ||
|
||
@myvar = external thread_local global i32, align 4 | ||
|
||
define dso_local ptr @get_addr() nounwind { | ||
; CHECK-LABEL: get_addr: | ||
; CHECK: ; %bb.0: ; %entry | ||
; CHECK-NEXT: suba.l #4, %sp | ||
; CHECK-NEXT: jsr __m68k_read_tp@PLT | ||
; CHECK-NEXT: move.l %a0, %d0 | ||
; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 | ||
; CHECK-NEXT: add.l (0,myvar@GOTTPOFF,%a0), %d0 | ||
; CHECK-NEXT: move.l %d0, %a0 | ||
; CHECK-NEXT: adda.l #4, %sp | ||
; CHECK-NEXT: rts | ||
|
||
entry: | ||
%0 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @myvar) | ||
ret ptr %0 | ||
} | ||
|
||
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=m68k --relocation-model=pic -o - %s | FileCheck %s | ||
|
||
@myvar = internal thread_local global i32 2, align 4 | ||
|
||
define dso_local ptr @get_addr() nounwind { | ||
; CHECK-LABEL: get_addr: | ||
; CHECK: ; %bb.0: ; %entry | ||
; CHECK-NEXT: suba.l #4, %sp | ||
; CHECK-NEXT: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 | ||
; CHECK-NEXT: adda.l myvar@TLSLDM, %a0 | ||
; CHECK-NEXT: move.l %a0, (%sp) | ||
; CHECK-NEXT: jsr (__tls_get_addr@PLT,%pc) | ||
; CHECK-NEXT: adda.l myvar@TLSLD, %a0 | ||
; CHECK-NEXT: adda.l #4, %sp | ||
; CHECK-NEXT: rts | ||
entry: | ||
%0 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @myvar) | ||
ret ptr %0 | ||
} | ||
|
||
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=m68k -o - %s | FileCheck %s | ||
|
||
@myvar = internal thread_local global i32 2, align 4 | ||
|
||
define dso_local ptr @get_addr() nounwind { | ||
; CHECK-LABEL: get_addr: | ||
; CHECK: ; %bb.0: ; %entry | ||
; CHECK-NEXT: suba.l #4, %sp | ||
; CHECK-NEXT: jsr __m68k_read_tp@PLT | ||
; CHECK-NEXT: adda.l myvar@TPOFF, %a0 | ||
; CHECK-NEXT: adda.l #4, %sp | ||
; CHECK-NEXT: rts | ||
entry: | ||
%0 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @myvar) | ||
ret ptr %0 | ||
} | ||
|
||
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) |