diff options
author | Steven Bosscher <stevenb@suse.de> | 2005-06-30 12:17:52 +0000 |
---|---|---|
committer | Steven Bosscher <stevenb@suse.de> | 2005-06-30 12:17:52 +0000 |
commit | aade4bc60e5a7b963e987efe264a80d28f9d9921 (patch) | |
tree | 816c741b3c00522d35a8c6d2c7612f26999ef518 /gcc/varasm.c | |
parent | 991ef335dd4c2fc060842514675cffce7236a87e (diff) |
* coretypes.h (tls_model): Add TLS_MODEL_NONE as 0.
* tree.h (struct tree_decl): New field `tls_model'.
(DECL_TLS_MODEL): New.
(DECL_THREAD_LOCAL_P): Rename from DECL_THREAD_LOCAL, make it
a predicate.
* rtl.h (decl_default_tls_model): Add prototype for it.
* varasm.c (decl_tls_model): Rewritten and renamed to ...
(decl_default_tls_model): ... this.
(default_encode_section_info): Use DECL_TLS_MODEL instead of
decl_tls_model.
(assemble_variable): Replace DECL_THREAD_LOCAL with
DECL_THREAD_LOCAL_P.
(default_section_type_flags_1): Likewise.
(categorize_decl_for_section): Likewise.
* tree.c (staticp): Likewise.
(recompute_tree_invarant_for_addr_expr): Likewise.
* drawf2out (loc_descriptor_from_tree_1): Likewise.
* c-decl.c (diagnose_mismatched_decls): Likewise.
with DECL_THREAD_LOCAL_P.
(start_decl): Likewise.
* print-tree.c (print_node): Likewise. Print the TLS model.
(grokdeclarator): Set the default DECL_TLS_MODEL here.
* c-common.c (handle_tls_model_attribute): Rewrite to set the
TLS model up based on the attribute. Never add the attribute
to the decl's attributes list.
* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Replace
DECL_THREAD_LOCAL with DECL_THREAD_LOCAL_P.
cp/
* decl.c (start_decl): Replace DECL_THREAD_LOCAL with
DECL_THREAD_LOCAL_P.
(cp_finish_decl): Likewise.
(grokvardecl): Set the default DECL_TLS_MODEL here.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@101465 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 3c1eb115235..9e3183dd9d6 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1716,7 +1716,7 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, if (DECL_SECTION_NAME (decl) || dont_output_data) ; /* We don't implement common thread-local data at present. */ - else if (DECL_THREAD_LOCAL (decl)) + else if (DECL_THREAD_LOCAL_P (decl)) { if (DECL_COMMON (decl)) sorry ("thread-local COMMON data not implemented"); @@ -4745,31 +4745,12 @@ init_varasm_once (void) const_alias_set = new_alias_set (); } -static enum tls_model -decl_tls_model (tree decl) +enum tls_model +decl_default_tls_model (tree decl) { enum tls_model kind; - tree attr = lookup_attribute ("tls_model", DECL_ATTRIBUTES (decl)); bool is_local; - if (attr) - { - attr = TREE_VALUE (TREE_VALUE (attr)); - gcc_assert (TREE_CODE (attr) == STRING_CST); - - if (!strcmp (TREE_STRING_POINTER (attr), "local-exec")) - kind = TLS_MODEL_LOCAL_EXEC; - else if (!strcmp (TREE_STRING_POINTER (attr), "initial-exec")) - kind = TLS_MODEL_INITIAL_EXEC; - else if (!strcmp (TREE_STRING_POINTER (attr), "local-dynamic")) - kind = optimize ? TLS_MODEL_LOCAL_DYNAMIC : TLS_MODEL_GLOBAL_DYNAMIC; - else if (!strcmp (TREE_STRING_POINTER (attr), "global-dynamic")) - kind = TLS_MODEL_GLOBAL_DYNAMIC; - else - gcc_unreachable (); - return kind; - } - is_local = targetm.binds_local_p (decl); if (!flag_shlib) { @@ -4778,6 +4759,7 @@ decl_tls_model (tree decl) else kind = TLS_MODEL_INITIAL_EXEC; } + /* Local dynamic is inefficient when we're not combining the parts of the address. */ else if (optimize && is_local) @@ -4828,7 +4810,7 @@ default_section_type_flags_1 (tree decl, const char *name, int reloc, if (decl && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; - if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) + if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) flags |= SECTION_TLS | SECTION_WRITE; if (strcmp (name, ".bss") == 0 @@ -5106,7 +5088,7 @@ categorize_decl_for_section (tree decl, int reloc, int shlib) ret = SECCAT_RODATA; /* There are no read-only thread-local sections. */ - if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) + if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) { /* Note that this would be *just* SECCAT_BSS, except that there's no concept of a read-only thread-local-data section. */ @@ -5370,8 +5352,8 @@ default_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED) flags |= SYMBOL_FLAG_FUNCTION; if (targetm.binds_local_p (decl)) flags |= SYMBOL_FLAG_LOCAL; - if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl)) - flags |= decl_tls_model (decl) << SYMBOL_FLAG_TLS_SHIFT; + if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) + flags |= DECL_TLS_MODEL (decl) << SYMBOL_FLAG_TLS_SHIFT; else if (targetm.in_small_data_p (decl)) flags |= SYMBOL_FLAG_SMALL; /* ??? Why is DECL_EXTERNAL ever set for non-PUBLIC names? Without |