summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils.c2
-rw-r--r--gcc/c-family/c-common.c2
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-decl.c4
-rw-r--r--gcc/c/c-parser.c2
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-common.c2
-rw-r--r--gcc/fortran/trans-decl.c4
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto-streamer-out.c1
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/lto.c1
-rw-r--r--gcc/tree-core.h5
-rw-r--r--gcc/tree-emutls.c9
-rw-r--r--gcc/tree-profile.c6
-rw-r--r--gcc/tree-streamer-in.c1
-rw-r--r--gcc/tree-streamer-out.c1
-rw-r--r--gcc/tree.c27
-rw-r--r--gcc/tree.h6
27 files changed, 114 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9134a88e422..1917c285a67 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * c-family/c-common.c (handle_tls_model_attribute): Use set_decl_tls_model.
+ * cgraph.h (struct varpool_node): Add tls_model.
+ * tree.c (decl_tls_model, set_decl_tls_model): New functions.
+ * tree.h (DECL_TLS_MODEL): Update.
+ (DECL_THREAD_LOCAL_P): Check that variable is static.
+ (decl_tls_model): Declare.
+ (set_decl_tls_model): Declare.
+ * tree-emutls.c (get_emutls_init_templ_addr): First build decl and then
+ set symbol prorperties.
+ (get_emutls_init_templ_addr): Cleanup.
+ (new_emutls_decl): Update.
+ * lto-cgraph.c (lto_output_varpool_node): Stream TLS model
+ (lto_input_varpool_node): Likewise.
+ * lto-streamer-out.c (hash_tree): Likewise.
+ * tree-streamer-in.c (unpack_ts_decl_with_vis_value_fields): Do
+ not stream DECL_TLS_MODEL.
+ * tree-profile.c (init_ic_make_global_vars): Use
+ set_decl_tls_model.
+ * tree-core.h (tree_decl_with_vis): Remove tls_model;
+ update comments.
+
2014-06-15 Richard Sandiford <rdsandiford@googlemail.com>
* df.h (DF_REF_REG_USE_P, DF_MWS_REG_USE_P): Remove null checks.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e83b056ecf0..649533afb1d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc-interface/utils.c (process_attributes): Use
+ set_decl_tls_model.
+
2014-06-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR ada/61505
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 201c022f6c8..4d4623b3419 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -2495,7 +2495,7 @@ process_attributes (tree *node, struct attrib **attr_list, bool in_place,
break;
case ATTR_THREAD_LOCAL_STORAGE:
- DECL_TLS_MODEL (*node) = decl_default_tls_model (*node);
+ set_decl_tls_model (*node, decl_default_tls_model (*node));
DECL_COMMON (*node) = 0;
break;
}
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index b010653ddcc..077263e1de5 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8036,7 +8036,7 @@ handle_tls_model_attribute (tree *node, tree name, tree args,
else
error ("tls_model argument must be one of \"local-exec\", \"initial-exec\", \"local-dynamic\" or \"global-dynamic\"");
- DECL_TLS_MODEL (decl) = kind;
+ set_decl_tls_model (decl, kind);
return NULL_TREE;
}
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 86372fa3035..cc3e5feda8a 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * c-parser.c (c_parser_omp_threadprivate): Likewise.
+ * c-decl.c (merge_decls): Likewise.
+
2014-06-09 Marek Polacek <polacek@redhat.com>
PR c/36446
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 4acb4f9f50d..34560308b83 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -2294,7 +2294,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
/* Merge the threadprivate attribute. */
if (TREE_CODE (olddecl) == VAR_DECL && C_DECL_THREADPRIVATE_P (olddecl))
{
- DECL_TLS_MODEL (newdecl) = DECL_TLS_MODEL (olddecl);
+ set_decl_tls_model (newdecl, DECL_TLS_MODEL (olddecl));
C_DECL_THREADPRIVATE_P (newdecl) = 1;
}
@@ -6345,7 +6345,7 @@ grokdeclarator (const struct c_declarator *declarator,
}
if (threadp)
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
}
if ((storage_class == csc_extern
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index abd636c5436..5fecb488b6a 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -13557,7 +13557,7 @@ c_parser_omp_threadprivate (c_parser *parser)
{
if (! DECL_THREAD_LOCAL_P (v))
{
- DECL_TLS_MODEL (v) = decl_default_tls_model (v);
+ set_decl_tls_model (v, decl_default_tls_model (v));
/* If rtl has been already set for this var, call
make_decl_rtl once again, so that encode_section_info
has a chance to look at the new decl flags. */
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ce99166fd4d..a701cf90f08 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -708,6 +708,8 @@ public:
/* Set if the variable is dynamically initialized, except for
function local statics. */
unsigned dynamically_initialized : 1;
+
+ ENUM_BITFIELD(tls_model) tls_model : 3;
};
/* Every top level asm statement is put into a asm_node. */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 52744d80919..8ab004896fc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * decl.c (duplicate_decls): Use set_decl_tls_model.
+ (grokdeclarator): Likewise.
+ * semantics.c (finish_id_expression): Check TLS only for
+ static variables.
+ (finish_omp_threadprivate): Use decl_default_tls_model.
+ * decl2.c (get_guard): Likewise.
+ * call.c (make_temporary_var_for_ref_to_temp): Likewise.
+
2014-06-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/33101
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 44e92fcd437..1d4c4f99e2f 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -9387,7 +9387,7 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type)
tree name;
TREE_STATIC (var) = TREE_STATIC (decl);
- DECL_TLS_MODEL (var) = DECL_TLS_MODEL (decl);
+ set_decl_tls_model (var, DECL_TLS_MODEL (decl));
name = mangle_ref_init_variable (decl);
DECL_NAME (var) = name;
SET_DECL_ASSEMBLER_NAME (var, name);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 29082240d84..1c8d4978848 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1952,7 +1952,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (!DECL_LANG_SPECIFIC (newdecl))
retrofit_lang_decl (newdecl);
- DECL_TLS_MODEL (newdecl) = DECL_TLS_MODEL (olddecl);
+ set_decl_tls_model (newdecl, DECL_TLS_MODEL (olddecl));
CP_DECL_THREADPRIVATE_P (newdecl) = 1;
}
}
@@ -8016,7 +8016,8 @@ grokvardecl (tree type,
if (decl_spec_seq_has_spec_p (declspecs, ds_thread))
{
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ if (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
if (declspecs->gnu_thread_keyword_p)
DECL_GNU_TLS_P (decl) = true;
}
@@ -10699,7 +10700,7 @@ grokdeclarator (const cp_declarator *declarator,
if (thread_p)
{
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
if (declspecs->gnu_thread_keyword_p)
DECL_GNU_TLS_P (decl) = true;
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 602a0c55759..99ea582f958 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2939,7 +2939,7 @@ get_guard (tree decl)
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
DECL_COMDAT (guard) = DECL_COMDAT (decl);
- DECL_TLS_MODEL (guard) = DECL_TLS_MODEL (decl);
+ set_decl_tls_model (guard, DECL_TLS_MODEL (decl));
if (DECL_ONE_ONLY (decl))
make_decl_one_only (guard, cxx_comdat_group (guard));
if (TREE_PUBLIC (decl))
@@ -4212,7 +4212,7 @@ handle_tls_init (void)
DECL_ARTIFICIAL (guard) = true;
DECL_IGNORED_P (guard) = true;
TREE_USED (guard) = true;
- DECL_TLS_MODEL (guard) = decl_default_tls_model (guard);
+ set_decl_tls_model (guard, decl_default_tls_model (guard));
pushdecl_top_level_and_finish (guard, NULL_TREE);
tree fn = get_local_tls_init_fn ();
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ca0c34bf6f2..ec510c96fed 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3493,6 +3493,7 @@ finish_id_expression (tree id_expression,
tree wrap;
if (VAR_P (decl)
&& !cp_unevaluated_operand
+ && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
&& DECL_THREAD_LOCAL_P (decl)
&& (wrap = get_tls_wrapper_fn (decl)))
{
@@ -5956,7 +5957,7 @@ finish_omp_threadprivate (tree vars)
if (! DECL_THREAD_LOCAL_P (v))
{
- DECL_TLS_MODEL (v) = decl_default_tls_model (v);
+ set_decl_tls_model (v, decl_default_tls_model (v));
/* If rtl has been already set for this var, call
make_decl_rtl once again, so that encode_section_info
has a chance to look at the new decl flags. */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 308a7bc22bf..e795de6767b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * trans-common.c (build_common_decl): Use
+ set_decl_tls_model.
+ * trans-decl.c (gfc_finish_var_decl): Likewise.
+ (get_proc_pointer_decl): Likewise.
+
2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/28484
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 36aa8f3efd8..5a52984602f 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -454,7 +454,7 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
gfc_set_decl_location (decl, &com->where);
if (com->threadprivate)
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
/* Place the back end declaration for this common block in
GLOBAL_BINDING_LEVEL. */
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 1940622d9da..bd82a905560 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -631,7 +631,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
/* Handle threadprivate variables. */
if (sym->attr.threadprivate
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
gfc_finish_decl_attrs (decl, &sym->attr);
}
@@ -1645,7 +1645,7 @@ get_proc_pointer_decl (gfc_symbol *sym)
/* Handle threadprivate procedure pointers. */
if (sym->attr.threadprivate
&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
- DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ set_decl_tls_model (decl, decl_default_tls_model (decl));
attributes = add_attributes_to_decl (sym->attr, NULL_TREE);
decl_attributes (&decl, attributes, 0);
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 803b66a2c4c..6c6896cb0f8 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -609,6 +609,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
&& boundary_p && !DECL_EXTERNAL (node->decl), 1);
/* in_other_partition. */
}
+ bp_pack_value (&bp, node->tls_model, 3);
streamer_write_bitpack (&bp);
group = node->get_comdat_group ();
@@ -1265,6 +1266,7 @@ input_varpool_node (struct lto_file_decl_data *file_data,
}
if (node->alias && !node->analyzed && node->weakref)
node->alias_target = get_alias_symbol (node->decl);
+ node->tls_model = (enum tls_model)bp_unpack_value (&bp, 3);
group = read_identifier (ib);
if (group)
{
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index ece0d3f1458..14d3623a1be 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -821,7 +821,6 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
v = iterative_hash_host_wide_int (DECL_HARD_REGISTER (t)
| (DECL_IN_CONSTANT_POOL (t) << 1),
v);
- v = iterative_hash_host_wide_int (DECL_TLS_MODEL (t), v);
}
if (TREE_CODE (t) == FUNCTION_DECL)
v = iterative_hash_host_wide_int (DECL_FINAL_P (t)
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index ae48cdc0571..9c45cc6071c 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto.c (compare_tree_sccs_1): Do not compare DECL_TLS_MODEL.
+
2014-06-10 Jan Hubicka <hubicka@ucw.cz>
* lto.c (read_cgraph_and_symbols): Remove unreachable symbols.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index c6c6c825180..015eaf0c1a0 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1299,7 +1299,6 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
compare_values (DECL_HARD_REGISTER);
/* DECL_IN_TEXT_SECTION is set during final asm output only. */
compare_values (DECL_IN_CONSTANT_POOL);
- compare_values (DECL_TLS_MODEL);
}
if (VAR_OR_FUNCTION_DECL_P (t1))
compare_values (DECL_INIT_PRIORITY);
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 8fd27e56b61..aa7498b90e0 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1455,10 +1455,9 @@ struct GTY(()) tree_decl_with_vis {
unsigned seen_in_bind_expr : 1;
unsigned comdat_flag : 1;
+ /* Used for FUNCTION_DECL, VAR_DECL and in C++ for TYPE_DECL. */
ENUM_BITFIELD(symbol_visibility) visibility : 2;
unsigned visibility_specified : 1;
- /* Belongs to VAR_DECL exclusively. */
- ENUM_BITFIELD(tls_model) tls_model : 3;
/* Belong to FUNCTION_DECL exclusively. */
unsigned init_priority_p : 1;
@@ -1470,7 +1469,7 @@ struct GTY(()) tree_decl_with_vis {
unsigned cxx_destructor : 1;
/* Belong to FUNCTION_DECL exclusively. */
unsigned final : 1;
- /* 12 unused bits. */
+ /* 15 unused bits. */
};
struct GTY(()) tree_var_decl {
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 5bb96ce0b55..fe1e85d9014 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -250,10 +250,10 @@ get_emutls_init_templ_addr (tree decl)
DECL_WEAK (to) = DECL_WEAK (decl);
if (DECL_ONE_ONLY (decl))
{
- make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
TREE_STATIC (to) = TREE_STATIC (decl);
TREE_PUBLIC (to) = TREE_PUBLIC (decl);
DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
+ make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
}
else
TREE_STATIC (to) = 1;
@@ -263,9 +263,7 @@ get_emutls_init_templ_addr (tree decl)
DECL_INITIAL (decl) = NULL;
if (targetm.emutls.tmpl_section)
- {
- set_decl_section_name (to, targetm.emutls.tmpl_section);
- }
+ set_decl_section_name (to, targetm.emutls.tmpl_section);
else
set_decl_section_name (to, DECL_SECTION_NAME (decl));
@@ -292,7 +290,6 @@ new_emutls_decl (tree decl, tree alias_of)
SET_DECL_ASSEMBLER_NAME (to, DECL_NAME (to));
- DECL_TLS_MODEL (to) = TLS_MODEL_EMULATED;
DECL_ARTIFICIAL (to) = 1;
DECL_IGNORED_P (to) = 1;
TREE_READONLY (to) = 0;
@@ -314,6 +311,8 @@ new_emutls_decl (tree decl, tree alias_of)
if (DECL_ONE_ONLY (decl))
make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
+ set_decl_tls_model (to, TLS_MODEL_EMULATED);
+
/* If we're not allowed to change the proxy object's alignment,
pretend it has been set by the user. */
if (targetm.emutls.var_align_fixed)
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index deefa8b992a..e0de24cd0e2 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -110,8 +110,7 @@ init_ic_make_global_vars (void)
DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
DECL_INITIAL (ic_void_ptr_var) = NULL;
if (targetm.have_tls)
- DECL_TLS_MODEL (ic_void_ptr_var) =
- decl_default_tls_model (ic_void_ptr_var);
+ set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var));
varpool_finalize_decl (ic_void_ptr_var);
@@ -141,8 +140,7 @@ init_ic_make_global_vars (void)
DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
if (targetm.have_tls)
- DECL_TLS_MODEL (ic_gcov_type_ptr_var) =
- decl_default_tls_model (ic_gcov_type_ptr_var);
+ set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var));
varpool_finalize_decl (ic_gcov_type_ptr_var);
}
diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c
index 8b3adebc6f3..1ab9d9f7d05 100644
--- a/gcc/tree-streamer-in.c
+++ b/gcc/tree-streamer-in.c
@@ -280,7 +280,6 @@ unpack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr)
{
DECL_HARD_REGISTER (expr) = (unsigned) bp_unpack_value (bp, 1);
DECL_IN_CONSTANT_POOL (expr) = (unsigned) bp_unpack_value (bp, 1);
- DECL_TLS_MODEL (expr) = (enum tls_model) bp_unpack_value (bp, 3);
}
if (TREE_CODE (expr) == FUNCTION_DECL)
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index dd148fa7080..c65214c83b6 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -248,7 +248,6 @@ pack_ts_decl_with_vis_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, DECL_HARD_REGISTER (expr), 1);
/* DECL_IN_TEXT_SECTION is set during final asm output only. */
bp_pack_value (bp, DECL_IN_CONSTANT_POOL (expr), 1);
- bp_pack_value (bp, DECL_TLS_MODEL (expr), 3);
}
if (TREE_CODE (expr) == FUNCTION_DECL)
diff --git a/gcc/tree.c b/gcc/tree.c
index 62477c3b1b3..559e7581ef8 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -657,6 +657,33 @@ set_decl_section_name (tree node, const char *value)
snode->set_section (value);
}
+/* Return TLS model of a variable NODE. */
+enum tls_model
+decl_tls_model (const_tree node)
+{
+ struct varpool_node *snode = varpool_get_node (node);
+ if (!snode)
+ return TLS_MODEL_NONE;
+ return snode->tls_model;
+}
+
+/* Set TLS model of variable NODE to MODEL. */
+void
+set_decl_tls_model (tree node, enum tls_model model)
+{
+ struct varpool_node *vnode;
+
+ if (model == TLS_MODEL_NONE)
+ {
+ vnode = varpool_get_node (node);
+ if (!vnode)
+ return;
+ }
+ else
+ vnode = varpool_node_for_decl (node);
+ vnode->tls_model = model;
+}
+
/* Compute the number of bytes occupied by a tree with code CODE.
This function cannot be used for nodes that have variable sizes,
including TREE_VEC, INTEGER_CST, STRING_CST, and CALL_EXPR. */
diff --git a/gcc/tree.h b/gcc/tree.h
index 31a9a87d2d1..4a29aa2776d 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2386,12 +2386,12 @@ extern void decl_value_expr_insert (tree, tree);
/* In a VAR_DECL, the model to use if the data should be allocated from
thread-local storage. */
-#define DECL_TLS_MODEL(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.tls_model)
+#define DECL_TLS_MODEL(NODE) decl_tls_model (NODE)
/* In a VAR_DECL, nonzero if the data should be allocated from
thread-local storage. */
#define DECL_THREAD_LOCAL_P(NODE) \
- (VAR_DECL_CHECK (NODE)->decl_with_vis.tls_model >= TLS_MODEL_REAL)
+ ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >= TLS_MODEL_REAL)
/* In a non-local VAR_DECL with static storage duration, true if the
variable has an initialization priority. If false, the variable
@@ -3429,6 +3429,8 @@ extern tree decl_comdat_group (const_tree);
extern tree decl_comdat_group_id (const_tree);
extern const char *decl_section_name (const_tree);
extern void set_decl_section_name (tree, const char *);
+extern enum tls_model decl_tls_model (const_tree);
+extern void set_decl_tls_model (tree, enum tls_model);
/* Compute the number of bytes occupied by 'node'. This routine only
looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH. */