mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-04 03:17:51 +00:00
dc73dc09f1
The 'common' section TLS is not implemented. Current C/C++ TLS variables are not placed in common section. DWARF debug info to get the address of TLS variables is not generated yet. clang and driver changes in http://reviews.llvm.org/D10524 Added -femulated-tls flag to select the emulated TLS model, which will be used for old targets like Android that do not support ELF TLS models. Added TargetLowering::LowerToTLSEmulatedModel as a target-independent function to convert a SDNode of TLS variable address to a function call to __emutls_get_address. Added into lib/Target/*/*ISelLowering.cpp to call LowerToTLSEmulatedModel for TLSModel::Emulated. Although all targets supporting ELF TLS models are enhanced, emulated TLS model has been tested only for Android ELF targets. Modified AsmPrinter.cpp to print the emutls_v.* and emutls_t.* variables for emulated TLS variables. Modified DwarfCompileUnit.cpp to skip some DIE for emulated TLS variabls. TODO: Add proper DIE for emulated TLS variables. Added new unit tests with emulated TLS. Differential Revision: http://reviews.llvm.org/D10522 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243438 91177308-0d34-0410-b5e6-96231b3b80d8
56 lines
1.7 KiB
LLVM
56 lines
1.7 KiB
LLVM
; RUN: llc -O0 -mtriple=arm64-none-linux-gnu -relocation-model=pic \
|
|
; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=NOEMU %s
|
|
; RUN: llc -emulated-tls -O0 -mtriple=arm64-none-linux-gnu -relocation-model=pic \
|
|
; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=EMU %s
|
|
|
|
; If the .tlsdesccall and blr parts are emitted completely separately (even with
|
|
; glue) then LLVM will separate them quite happily (with a spill at O0, hence
|
|
; the option). This is definitely wrong, so we make sure they are emitted
|
|
; together.
|
|
|
|
@general_dynamic_var = external thread_local global i32
|
|
|
|
define i32 @test_generaldynamic() {
|
|
; CHECK-LABEL: test_generaldynamic:
|
|
|
|
%val = load i32, i32* @general_dynamic_var
|
|
ret i32 %val
|
|
|
|
; NOEMU: .tlsdesccall general_dynamic_var
|
|
; NOEMU-NEXT: blr {{x[0-9]+}}
|
|
; NOEMU-NOT: __emutls_v.general_dynamic_var:
|
|
|
|
; EMU: adrp{{.+}}__emutls_v.general_dynamic_var
|
|
; EMU: bl __emutls_get_address
|
|
|
|
; EMU-NOT: __emutls_v.general_dynamic_var
|
|
; EMU-NOT: __emutls_t.general_dynamic_var
|
|
}
|
|
|
|
@emulated_init_var = thread_local global i32 37, align 8
|
|
|
|
define i32 @test_emulated_init() {
|
|
; COMMON-LABEL: test_emulated_init:
|
|
|
|
%val = load i32, i32* @emulated_init_var
|
|
ret i32 %val
|
|
|
|
; EMU: adrp{{.+}}__emutls_v.emulated_init_var
|
|
; EMU: bl __emutls_get_address
|
|
|
|
; EMU-NOT: __emutls_v.general_dynamic_var:
|
|
|
|
; EMU: .align 3
|
|
; EMU-LABEL: __emutls_v.emulated_init_var:
|
|
; EMU-NEXT: .xword 4
|
|
; EMU-NEXT: .xword 8
|
|
; EMU-NEXT: .xword 0
|
|
; EMU-NEXT: .xword __emutls_t.emulated_init_var
|
|
|
|
; EMU-LABEL: __emutls_t.emulated_init_var:
|
|
; EMU-NEXT: .word 37
|
|
}
|
|
|
|
; CHECK-NOT: __emutls_v.general_dynamic_var:
|
|
; EMU-NOT: __emutls_t.general_dynamic_var
|