[Bug jit/95415] Add support for thread-local variables
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 29 14:37:27 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Perhaps, but it looks non-trivial.
Notes to self:
c/c-tree.h: struct c_declspecs has:
/* Whether "__thread" or "_Thread_local" was specified. */
BOOL_BITFIELD thread_p : 1;
/* Whether "__thread" rather than "_Thread_local" was specified. */
BOOL_BITFIELD thread_gnu_p : 1;
tree.h has:
/* In a VAR_DECL, the model to use if the data should be allocated from
thread-local storage. */
#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) \
((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >=
TLS_MODEL_REAL)
decl_tls_model/set_decl_tls_model get/set a field of the varpool_node, based on
this enum in coretypes.h:
/* The thread-local storage model associated with a given VAR_DECL
or SYMBOL_REF. This isn't used much, but both trees and RTL refer
to it, so it's here. */
enum tls_model {
TLS_MODEL_NONE,
TLS_MODEL_EMULATED,
TLS_MODEL_REAL,
TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL,
TLS_MODEL_LOCAL_DYNAMIC,
TLS_MODEL_INITIAL_EXEC,
TLS_MODEL_LOCAL_EXEC
};
More information about the Gcc-bugs
mailing list