GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "cgraph.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "varasm.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "langhooks.h"
#include "tree-iterator.h"
#include "gimplify.h"
#include "diagnostic-core.h"
Data Structures | |
struct | tls_var_data |
struct | lower_emutls_data |
Macros | |
#define | EMUTLS_SEPARATOR "." |
Variables | |
static hash_map< varpool_node *, tls_var_data > * | tls_map = NULL |
static tree | emutls_object_type |
#define EMUTLS_SEPARATOR "." |
Referenced by get_emutls_init_templ_addr(), and get_emutls_object_name().
|
inlinestatic |
Clear the access variables, in order to begin a new block.
References NULL, reset_access(), and tls_map.
Referenced by lower_emutls_function_body().
|
static |
Create emutls variable for VAR, DATA is pointer to static ctor body we can add constructors to. Callback for varpool_for_variable_and_aliases.
References symtab_node::alias, symtab_node::analyzed, tls_var_data::control_var, symtab_node::decl, DECL_HAS_VALUE_EXPR_P, emutls_common_1(), varpool_node::get(), varpool_node::get_alias_target(), new_emutls_decl(), NULL, SET_DECL_VALUE_EXPR, and tls_map.
Referenced by ipa_lower_emutls().
Create the fields of the type for the control variables. Ordinarily this must match struct __emutls_object defined in emutls.c. However this is a target hook so that VxWorks can define its own layout.
References build_decl(), DECL_CHAIN, DECL_CONTEXT, get_identifier(), ptr_type_node, lang_hooks_for_types::type_for_mode, lang_hooks::types, UNKNOWN_LOCATION, and word_mode.
Initialize emulated tls object TO, which refers to TLS variable DECL and is initialized by PROXY. As above, this is the default implementation of a target hook overridden by VxWorks.
References build_constructor(), build_int_cst(), DECL_ALIGN_UNIT, DECL_CHAIN, DECL_SIZE_UNIT, fold_convert, constructor_elt::index, null_pointer_node, TREE_TYPE, TYPE_FIELDS, constructor_elt::value, and vec_alloc().
Generate a call statement to initialize CONTROL_DECL for TLS_DECL. This only needs to happen for TLS COMMON variables; non-COMMON variables can be initialized statically. Insert the generated call statement at the end of PSTMTS.
References append_to_statement_list(), build_call_expr(), build_fold_addr_expr, build_int_cst(), builtin_decl_explicit(), DECL_ALIGN_UNIT, DECL_COMMON, DECL_INITIAL, DECL_SIZE_UNIT, error_mark_node, fold_convert, get_emutls_init_templ_addr(), targetm, lang_hooks_for_types::type_for_mode, lang_hooks::types, and word_mode.
Referenced by create_emultls_var().
|
static |
Given a TLS variable DECL, return an SSA_NAME holding its address. Append any new computation statements required to D->SEQ.
References lower_emutls_data::bb, build_fold_addr_expr, build_pointer_type(), lower_emutls_data::builtin_decl, lower_emutls_data::builtin_node, lower_emutls_data::cfun_node, basic_block_def::count, cgraph_node::create_edge(), symtab_node::create_reference(), create_tmp_var, symtab_node::decl, varpool_node::get(), gimple_build_call(), gimple_call_set_lhs(), gimple_seq_add_stmt(), gimple_set_location(), IPA_REF_ADDR, lower_emutls_data::loc, make_ssa_name(), NULL, lower_emutls_data::seq, tls_map, TREE_ADDRESSABLE, and TREE_TYPE.
Referenced by lower_emutls_1().
Create a read-only variable like DECL, with the same DECL_INITIAL. This will be used for initializing the emulated tls data area.
References varpool_node::add(), build_decl(), build_fold_addr_expr, DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, DECL_CONTEXT, DECL_EXTERNAL, DECL_IGNORED_P, DECL_INITIAL, DECL_NAME, DECL_ONE_ONLY, DECL_PRESERVE_P, DECL_SECTION_NAME, DECL_SOURCE_LOCATION, DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, DECL_WEAK, EMUTLS_SEPARATOR, varpool_node::get_create(), make_decl_one_only(), NULL, null_pointer_node, prefix_name(), SET_DECL_ASSEMBLER_NAME, set_decl_section_name(), targetm, TREE_PUBLIC, TREE_READONLY, TREE_STATIC, TREE_TYPE, and TREE_USED.
Referenced by emutls_common_1(), and new_emutls_decl().
Create an identifier for the struct __emutls_object, given an identifier of the DECL_ASSEMBLY_NAME of the original object.
References EMUTLS_SEPARATOR, prefix_name(), and targetm.
Referenced by ipa_lower_emutls(), and new_emutls_decl().
|
static |
Create the structure for struct __emutls_object. This should match the structure at the top of emutls.c, modulo the union there.
References build_decl(), emutls_object_type, get_identifier(), layout_type(), lang_hooks_for_types::make_type, NULL, targetm, TYPE_FIELDS, TYPE_NAME, lang_hooks::types, and UNKNOWN_LOCATION.
Referenced by new_emutls_decl().
|
static |
Main entry point to the tls lowering pass.
References symtab_node::alias, alias_pairs, symtab_node::analyzed, varpool_node::call_for_symbol_and_aliases(), cgraph_build_static_cdtor(), create_emultls_var(), alias_pair::decl, symtab_node::decl, DECL_EXTERNAL, DECL_THREAD_LOCAL_P, DEFAULT_INIT_PRIORITY, symtab_node::definition, dump_file, FOR_EACH_DEFINED_FUNCTION, FOR_EACH_VARIABLE, FOR_EACH_VEC_SAFE_ELT, gcc_checking_assert, varpool_node::get(), get_emutls_object_name(), i, lower_emutls_function_body(), cgraph_node::lowered, NULL, alias_pair::target, tls_map, TREE_STATIC, varpool_node::ultimate_alias_target(), and visited.
Callback for walk_gimple_op. D = WI->INFO is a struct lower_emutls_data. Given an operand *PTR within D->STMT, if the operand references a TLS variable, then lower the reference to a call to the runtime. Insert any new statements required into D->SEQ; the caller is responsible for placing those appropriately.
References build2(), build_int_cst(), create_tmp_var, DECL_THREAD_LOCAL_P, error_mark_node, EXPR_P, gen_emutls_addr(), gimple_assign_set_lhs(), gimple_build_assign(), gimple_debug_bind_reset_value(), gimple_seq_add_stmt(), gimple_set_location(), is_gimple_debug(), is_gimple_min_invariant(), lower_emutls_data::loc, lower_emutls_1(), lower_emutls_2(), make_ssa_name(), NULL, NULL_TREE, lower_emutls_data::seq, TREE_CODE, TREE_OPERAND, TREE_TYPE, unshare_expr(), update_stmt(), and walk_tree.
Referenced by lower_emutls_1(), lower_emutls_phi_arg(), and lower_emutls_stmt().
Callback for lower_emutls_1, return non-NULL if there is any TLS VAR_DECL in the subexpressions.
References DECL_THREAD_LOCAL_P, EXPR_P, NULL_TREE, and VAR_P.
Referenced by lower_emutls_1().
|
static |
Lower the entire function NODE.
References lower_emutls_data::bb, lower_emutls_data::builtin_decl, builtin_decl_explicit(), lower_emutls_data::builtin_node, cfun, lower_emutls_data::cfun_node, clear_access_vars(), symtab_node::decl, DECL_STRUCT_FUNCTION, EDGE_COUNT, EDGE_PRED, FOR_EACH_BB_FN, cgraph_node::get_create(), gimple_seq_empty_p(), gsi_commit_edge_inserts(), gsi_end_p(), gsi_insert_seq_before(), gsi_insert_seq_on_edge(), gsi_next(), GSI_SAME_STMT, gsi_start_bb(), gsi_start_phis(), gsi_stmt(), i, lower_emutls_phi_arg(), lower_emutls_stmt(), NULL, phi_nodes(), pop_cfun(), basic_block_def::preds, push_cfun(), and lower_emutls_data::seq.
Referenced by ipa_lower_emutls().
|
static |
Lower the I'th operand of PHI.
References gcc_assert, gimple_phi_arg(), i, link_imm_use_stmt(), lower_emutls_data::loc, lower_emutls_1(), NULL, TREE_CODE, and walk_tree.
Referenced by lower_emutls_function_body().
|
static |
Lower all of the operands of STMT.
References gimple_location(), lower_emutls_data::loc, lower_emutls_1(), walk_stmt_info::stmt, update_stmt(), and walk_gimple_op().
Referenced by lower_emutls_function_body().
simple_ipa_opt_pass * make_pass_ipa_lower_emutls | ( | gcc::context * | ctxt | ) |
IPA Passes
Create and return the control variable for the TLS variable DECL.
References varpool_node::add(), build_decl(), varpool_node::create_alias(), symtab_node::decl, DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, DECL_ATTRIBUTES, DECL_COMMON, DECL_CONTEXT, DECL_DLLIMPORT_P, DECL_EXTERNAL, DECL_IGNORED_P, DECL_INITIAL, DECL_NAME, DECL_ONE_ONLY, DECL_PRESERVE_P, DECL_SOURCE_LOCATION, DECL_USER_ALIGN, DECL_VALUE_EXPR, DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, DECL_WEAK, error_mark_node, varpool_node::get_create(), get_emutls_init_templ_addr(), get_emutls_object_name(), get_emutls_object_type(), varpool_node::get_for_asmname(), make_decl_one_only(), record_references_in_initializer(), symtab_node::resolve_alias(), SET_DECL_ASSEMBLER_NAME, set_decl_section_name(), set_decl_tls_model(), targetm, TLS_MODEL_EMULATED, TREE_PUBLIC, TREE_READONLY, TREE_STATIC, and TREE_USED.
Referenced by create_emultls_var().
Create an IDENTIFIER_NODE by prefixing PREFIX to the IDENTIFIER_NODE NAME's name.
References alloca, get_identifier(), and IDENTIFIER_POINTER.
Referenced by get_emutls_init_templ_addr(), and get_emutls_object_name().
bool reset_access | ( | varpool_node *const & | , |
tls_var_data * | data, | ||
void * | ) |
Reset access variable for a given TLS variable data DATA.
References NULL.
Referenced by clear_access_vars().
|
static |
The type of the control structure, shared with the emutls.c runtime.
Referenced by get_emutls_object_type().
|
static |
TLS map accesses mapping between a TLS varpool node and a pair made by control variable and access variable.
Referenced by clear_access_vars(), create_emultls_var(), gen_emutls_addr(), and ipa_lower_emutls().