diff options
author | Claudiu Zissulescu <claziss@gmail.com> | 2023-05-25 12:53:14 +0300 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gmail.com> | 2023-05-25 13:23:03 +0300 |
commit | 9e264ef6856a0e05834bc52f5774b4d1779913d5 (patch) | |
tree | a51ffa710c191fbc5e3636eb85cb98c58d2aea90 | |
parent | ea9154dbc8fc86d4c617503ca5e6f02fed3a6a56 (diff) | |
download | gcc-9e264ef6856a0e05834bc52f5774b4d1779913d5.zip gcc-9e264ef6856a0e05834bc52f5774b4d1779913d5.tar.gz gcc-9e264ef6856a0e05834bc52f5774b4d1779913d5.tar.bz2 |
arc: Make TLS Local Dynamic work like Global Dynamic model
Current ARC's TLS Local Dynamic model is using two anchors to access
data, namely `.tdata` and `.tbss`. This implementation is unnecessary
complicated. However, the TLS Local Dynamic model has better results
using Global Dynamic model and anchors.
gcc/ChangeLog;
* config/arc/arc.cc (arc_call_tls_get_addr): Simplify access using
TLS Local Dynamic.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
-rw-r--r-- | gcc/config/arc/arc.cc | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc index dd012ff..fef8a50 100644 --- a/gcc/config/arc/arc.cc +++ b/gcc/config/arc/arc.cc @@ -6257,8 +6257,6 @@ arc_call_tls_get_addr (rtx ti) return ret; } -#define DTPOFF_ZERO_SYM ".tdata" - /* Return a legitimized address for ADDR, which is a SYMBOL_REF with tls_model MODEL. */ @@ -6267,37 +6265,17 @@ arc_legitimize_tls_address (rtx addr, enum tls_model model) { rtx tmp; - if (!flag_pic && model == TLS_MODEL_LOCAL_DYNAMIC) - model = TLS_MODEL_LOCAL_EXEC; - - /* The TP pointer needs to be set. */ gcc_assert (arc_tp_regno != -1); switch (model) { case TLS_MODEL_GLOBAL_DYNAMIC: + case TLS_MODEL_LOCAL_DYNAMIC: tmp = gen_reg_rtx (Pmode); emit_move_insn (tmp, arc_unspec_offset (addr, UNSPEC_TLS_GD)); return arc_call_tls_get_addr (tmp); - case TLS_MODEL_LOCAL_DYNAMIC: - rtx base; - tree decl; - const char *base_name; - - decl = SYMBOL_REF_DECL (addr); - base_name = DTPOFF_ZERO_SYM; - if (decl && bss_initializer_p (decl)) - base_name = ".tbss"; - - base = gen_rtx_SYMBOL_REF (Pmode, base_name); - tmp = gen_reg_rtx (Pmode); - emit_move_insn (tmp, arc_unspec_offset (base, UNSPEC_TLS_GD)); - base = arc_call_tls_get_addr (tmp); - return gen_rtx_PLUS (Pmode, force_reg (Pmode, base), - arc_unspec_offset (addr, UNSPEC_TLS_OFF)); - case TLS_MODEL_INITIAL_EXEC: addr = arc_unspec_offset (addr, UNSPEC_TLS_IE); addr = copy_to_mode_reg (Pmode, gen_const_mem (Pmode, addr)); |