This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! Attached patch cleans legitimize_tls_address and corresponding expanders to call gen_tls_dynamic_gnu2_{32,64} directly in case of TARGET_GNU2_TLS target. The patch also changes unique REG_EQUIV note to __tls_get_addr call to UNSPEC (the same approach MIPS does) instead of some strange nested EXPR_LISTs. Additionally, ix86_tls_get_address is now used only in i386.c, so it can be declared static. The patch does not introduce any functional change, leaving also previous ICE on 64bit targets with -mcmodel=large and -mtls-dialect=gnu: tls.c:6:1: error: unrecognizable insn: (call_insn/u 5 4 6 3 (parallel [ (set (reg:DI 0 ax) (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0 S1 A8]) (const_int 0 [0]))) (unspec:DI [ (symbol_ref:DI ("tls_gd") [flags 0x12] <var_decl 0x7f3846c08000 tls_gd>) ] UNSPEC_TLS_GD) ]) tls.c:5 -1 (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000]) (nil)) (nil)) The test (tls.c), used to check all TLS models is attached to the message. I plan to convert it to proper dg test... ;) 2011-05-11 Uros Bizjak <ubizjak@gmail.com> * config/i386/i386.c (legitimize_tls_address) <TLS_MODEL_GLOBAL_DYNAMIC>: Call gen_tls_dynamic_gnu2_{32,64} expanders directly for TARGET_GNU2_TLS. Determine pic and __tls_get_addr symbol reference here. Update call to gen_tls_global_dynamic_{32,64} for added arguments. <TLS_MODEL_LOCAL_DYNAMIC>: Call gen_tls_dynamic_gnu2_{32,64} expanders directly for TARGET_GNU2_TLS. Determine __tls_get_addr symbol reference here. Update call to gen_tls_local_dynamic_base_{32,64} for added arguments. Attach unique UNSPEC REG_EQUIV to libcall block. (ix86_tls_get_addr): Declare static. * config/i386/i386-protos.h (ix86_tls_get_addr): Remove declaration. * config/i386/i386.md (tls_global_dynamic_32): Add operand 2 and 3. Do not determine pic and __tls_get_addr symbol reference here. Do not call gen_tls_dynamic_gnu2_32 for TARGET_GNU2_TLS. (tls_local_dynamic_base_32): Ditto for operands 1 and 2. (tls_global_dynamic_64): Add operand 2. Do not determine __tls_get_addr symbol reference here. Do not call gen_tls_dynamic_gnu2_64 for TARGET_GNU2_TLS here. (tls_local_dynamic_base64): Ditto for operand 1. Patch was tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN. Uros.
Attachment:
p.diff.txt
Description: Text document
__thread int tls_gd __attribute__((tls_model("global-dynamic"))); int get_gd(void) { return tls_gd; } int *get_gdp(void) { return &tls_gd; } __thread int tls_ld __attribute__((tls_model("local-dynamic"))); __thread int tls_ld2 __attribute__((tls_model("local-dynamic"))); int get_ld(void) { return tls_ld + tls_ld2; } int *get_ldp(void) { return &tls_ld; } __thread int tls_le __attribute__((tls_model("local-exec"))); int get_le(void) { return tls_le; } int *get_lep(void) { return &tls_le; } __thread int tls_ie __attribute__((tls_model("initial-exec"))); int get_ie(void) { return tls_ie; } int *get_iep(void) { return &tls_ie; }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |