GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "cgraph.h"
#include "gimple-pretty-print.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "tree-eh.h"
#include "calls.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-inline.h"
#include "demangle.h"
#include "output.h"
#include "trans-mem.h"
#include "langhooks.h"
#include "cfgloop.h"
#include "tree-ssa-address.h"
#include "stringpool.h"
#include "attribs.h"
#include "alloc-pool.h"
#include "symbol-summary.h"
#include "symtab-thunks.h"
#include "gt-trans-mem.h"
Data Structures | |
struct | tm_wrapper_hasher |
struct | diagnose_tm |
struct | tm_log_entry |
struct | log_entry_hasher |
struct | tm_new_mem_map |
struct | tm_mem_map_hasher |
struct | tm_region |
struct | bb2reg_stuff |
struct | tm_memop |
struct | tm_memop_hasher |
struct | tm_memopt_bitmaps |
struct | tm_ipa_cg_data |
struct | create_version_alias_info |
Macros | |
#define | A_RUNINSTRUMENTEDCODE 0x0001 |
#define | A_RUNUNINSTRUMENTEDCODE 0x0002 |
#define | A_SAVELIVEVARIABLES 0x0004 |
#define | A_RESTORELIVEVARIABLES 0x0008 |
#define | A_ABORTTRANSACTION 0x0010 |
#define | AR_USERABORT 0x0001 |
#define | AR_USERRETRY 0x0002 |
#define | AR_TMCONFLICT 0x0004 |
#define | AR_EXCEPTIONBLOCKABORT 0x0008 |
#define | AR_OUTERABORT 0x0010 |
#define | MODE_SERIALIRREVOCABLE 0x0000 |
#define | DIAG_TM_OUTER 1 |
#define | DIAG_TM_SAFE 2 |
#define | DIAG_TM_RELAXED 4 |
#define | STORE_AVAIL_IN(BB) |
#define | STORE_AVAIL_OUT(BB) |
#define | STORE_ANTIC_IN(BB) |
#define | STORE_ANTIC_OUT(BB) |
#define | READ_AVAIL_IN(BB) |
#define | READ_AVAIL_OUT(BB) |
#define | READ_LOCAL(BB) |
#define | STORE_LOCAL(BB) |
#define | AVAIL_IN_WORKLIST_P(BB) |
#define | BB_VISITED_P(BB) |
#define | TRANSFORM_RAR 1 |
#define | TRANSFORM_RAW 2 |
#define | TRANSFORM_RFW 3 |
#define | TRANSFORM_WAR 1 |
#define | TRANSFORM_WAW 2 |
Typedefs | |
typedef vec< cgraph_node * > | cgraph_node_queue |
Enumerations | |
enum | thread_memory_type { mem_non_local = 0 , mem_thread_local , mem_transaction_local , mem_max } |
Variables | |
static hash_table< tm_wrapper_hasher > * | tm_wrap_map |
static hash_table< log_entry_hasher > * | tm_log |
static vec< tree > | tm_log_save_addresses |
static hash_table< tm_mem_map_hasher > * | tm_new_mem_hash |
bool | pending_edge_inserts_p |
static struct tm_region * | all_tm_regions |
static bitmap_obstack | tm_obstack |
static bitmap_obstack | tm_memopt_obstack |
static unsigned int | tm_memopt_value_id |
static hash_table< tm_memop_hasher > * | tm_memopt_value_numbers |
#define A_ABORTTRANSACTION 0x0010 |
Referenced by expand_transaction().
#define A_RESTORELIVEVARIABLES 0x0008 |
Referenced by expand_transaction().
#define A_RUNINSTRUMENTEDCODE 0x0001 |
Passes for transactional memory support. Copyright (C) 2008-2024 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com> and Aldy Hernandez <aldyh@redhat.com>. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
#define A_RUNUNINSTRUMENTEDCODE 0x0002 |
Referenced by expand_transaction().
#define A_SAVELIVEVARIABLES 0x0004 |
#define AR_EXCEPTIONBLOCKABORT 0x0008 |
#define AR_OUTERABORT 0x0010 |
Referenced by build_tm_abort_call(), and expand_block_edges().
#define AR_TMCONFLICT 0x0004 |
#define AR_USERABORT 0x0001 |
Referenced by build_tm_abort_call().
#define AR_USERRETRY 0x0002 |
#define AVAIL_IN_WORKLIST_P | ( | BB | ) |
Referenced by tm_memopt_compute_antic(), and tm_memopt_compute_available().
#define BB_VISITED_P | ( | BB | ) |
Referenced by tm_memopt_clear_visited(), tm_memopt_compute_antic(), tm_memopt_compute_antin(), tm_memopt_compute_available(), and tm_memopt_compute_avin().
#define DIAG_TM_OUTER 1 |
Diagnostics for tm_safe functions/regions. Called by the front end once we've lowered the function to high-gimple.
Subroutine of diagnose_tm_safe_errors, called through walk_gimple_seq. Process exactly one statement. WI->INFO is set to non-null when in the context of a tm_safe function, and null for a __transaction block.
Referenced by diagnose_tm_1(), and diagnose_tm_blocks().
#define DIAG_TM_RELAXED 4 |
Referenced by diagnose_tm_1().
#define DIAG_TM_SAFE 2 |
Referenced by diagnose_tm_1(), diagnose_tm_1_op(), and diagnose_tm_blocks().
#define MODE_SERIALIRREVOCABLE 0x0000 |
Referenced by ipa_tm_insert_irr_call().
#define READ_AVAIL_IN | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_compute_available(), tm_memopt_compute_avin(), and tm_memopt_transform_blocks().
#define READ_AVAIL_OUT | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_compute_available(), and tm_memopt_compute_avin().
#define READ_LOCAL | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_accumulate_memops(), and tm_memopt_compute_available().
#define STORE_ANTIC_IN | ( | BB | ) |
Referenced by tm_memopt_compute_antic(), and tm_memopt_compute_antin().
#define STORE_ANTIC_OUT | ( | BB | ) |
Referenced by tm_memopt_compute_antic(), tm_memopt_compute_antin(), and tm_memopt_transform_blocks().
#define STORE_AVAIL_IN | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_compute_available(), tm_memopt_compute_avin(), and tm_memopt_transform_blocks().
#define STORE_AVAIL_OUT | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_compute_available(), and tm_memopt_compute_avin().
#define STORE_LOCAL | ( | BB | ) |
Referenced by dump_tm_memopt_sets(), tm_memopt_accumulate_memops(), tm_memopt_compute_antic(), and tm_memopt_compute_available().
#define TRANSFORM_RAR 1 |
Offsets of load variants from TM_LOAD. For example, BUILT_IN_TM_LOAD_RAR* is an offset of 1 from BUILT_IN_TM_LOAD*. See gtm-builtins.def.
Referenced by tm_memopt_transform_blocks().
#define TRANSFORM_RAW 2 |
Referenced by tm_memopt_transform_blocks().
#define TRANSFORM_RFW 3 |
Referenced by tm_memopt_transform_blocks().
#define TRANSFORM_WAR 1 |
Offsets of store variants from TM_STORE.
Referenced by tm_memopt_transform_blocks().
#define TRANSFORM_WAW 2 |
Referenced by tm_memopt_transform_blocks().
typedef vec<cgraph_node *> cgraph_node_queue |
enum thread_memory_type |
Build a GENERIC tree for a user abort. This is called by front ends while transforming the __tm_abort statement.
References AR_OUTERABORT, AR_USERABORT, build_call_expr_loc(), build_int_cst(), builtin_decl_explicit(), and integer_type_node.
|
static |
Construct a memory load in a transactional context. Return the gimple statement performing the load, or NULL if there is no TM_LOAD builtin of the appropriate size to do the load. LOC is the location to use for the new statement(s).
References builtin_decl_explicit(), builtin_decl_explicit_p(), create_tmp_reg(), double_type_node, float_type_node, fold_build1, g, gcc_assert, gimple_build_assign(), gimple_build_call(), gimple_call_set_lhs(), gimple_set_location(), gimplify_addr(), gsi_insert_before(), GSI_SAME_STMT, long_double_type_node, NULL, TREE_CODE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, TYPE_SIZE, and useless_type_conversion_p().
Referenced by expand_assign_tm().
|
static |
Similarly for storing TYPE in a transactional context.
References build_int_cst(), builtin_decl_explicit(), builtin_decl_explicit_p(), CONSTRUCTOR_ELTS, create_tmp_reg(), double_type_node, float_type_node, fold_build1, g, gcc_assert, gimple_build_assign(), gimple_build_call(), gimple_set_location(), gimplify_addr(), gsi_insert_before(), GSI_SAME_STMT, long_double_type_node, NULL, TREE_CHAIN, TREE_CODE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, TREE_VALUE, TYPE_ARG_TYPES, TYPE_SIZE, and useless_type_conversion_p().
Referenced by expand_assign_tm().
|
static |
void compute_transaction_bits | ( | void | ) |
Set the IN_TRANSACTION for all gimple statements that appear in a transaction.
References all_tm_regions, bitmap_obstack_release(), cfun, tm_region::entry_block, tm_region::exit_blocks, basic_block_def::flags, FOR_EACH_BB_FN, gate_tm_init(), get_tm_region_blocks(), i, tm_region::irr_blocks, tm_region::next, NULL, queue, and tm_obstack.
Referenced by tree_ssa_lim_initialize().
|
static |
References as_a(), diagnose_tm::block_flags, DECL_NAME, DECL_P, DIAG_TM_OUTER, DIAG_TM_RELAXED, DIAG_TM_SAFE, diagnose_tm_1(), diagnose_tm_1_op(), ECF_TM_BUILTIN, error_at(), find_tm_replacement_function(), flags_from_decl_or_type(), diagnose_tm::func_flags, gimple_call_fn(), gimple_call_internal_p(), gimple_location(), gimple_transaction_body(), gimple_transaction_subcode(), gsi_stmt(), GTMA_IS_OUTER, GTMA_IS_RELAXED, walk_stmt_info::info, is_tm_callable(), is_tm_irrevocable(), is_tm_may_cancel_outer(), is_tm_safe_or_pure(), IS_TYPE_OR_DECL_P, NULL_TREE, diagnose_tm::stmt, diagnose_tm::summary_flags, TREE_CODE, TREE_OPERAND, and walk_gimple_seq().
Referenced by diagnose_tm_1(), and diagnose_tm_blocks().
Tree callback function for diagnose_tm pass.
References diagnose_tm::block_flags, DIAG_TM_SAFE, error_at(), diagnose_tm::func_flags, gimple_location(), NULL_TREE, diagnose_tm::saw_volatile, diagnose_tm::stmt, TYPE_P, and volatile_lvalue_p().
Referenced by diagnose_tm_1(), and diagnose_tm_blocks().
|
static |
|
static |
Prettily dump one of the memopt sets. BITS is the bitmap to dump.
References tm_memop::addr, dump_file, EXECUTE_IF_SET_IN_BITMAP, FOR_EACH_HASH_TABLE_ELEMENT, gcc_assert, i, NULL, print_generic_expr(), tm_memopt_value_numbers, and tm_memop::value_id.
Referenced by dump_tm_memopt_sets().
|
static |
Prettily dump all of the memopt sets in BLOCKS.
References dump_file, dump_tm_memopt_set(), i, basic_block_def::index, READ_AVAIL_IN, READ_AVAIL_OUT, READ_LOCAL, STORE_AVAIL_IN, STORE_AVAIL_OUT, and STORE_LOCAL.
Referenced by tm_memopt_compute_antic(), and tm_memopt_compute_available().
|
static |
Inform about a load/store optimization.
References dump_file, and print_gimple_stmt().
Referenced by tm_memopt_transform_stmt().
|
static |
Mark the GIMPLE_ASSIGN statement as appropriate for being inside a transaction region.
References gimple_assign_lhs(), gimple_assign_rhs1(), gsi_stmt(), GTMA_HAVE_LOAD, GTMA_HAVE_STORE, NULL, and requires_barrier().
Referenced by lower_sequence_tm().
|
static |
Mark a GIMPLE_CALL as appropriate for being inside a transaction.
References gimple_call_fndecl(), gsi_stmt(), GTMA_HAVE_ABORT, GTMA_HAVE_LOAD, GTMA_HAVE_STORE, is_tm_abort(), and is_tm_pure_call().
Referenced by lower_sequence_tm().
|
static |
Main entry point for flattening GIMPLE_TRANSACTION constructs. After this, GIMPLE_TRANSACTION nodes still exist, but the nested body has been moved out, and all the data required for constructing a proper CFG has been recorded.
References current_function_decl, decl_is_tm_clone(), gcc_assert, gimple_body(), gimple_set_body(), lower_sequence_no_tm(), NULL, and walk_gimple_seq_mod().
|
static |
Entry point to the MARK phase of TM expansion. Here we replace transactional memory statements with calls to builtins, and function calls with their transactional clones (if available). But we don't yet lower GIMPLE_TRANSACTION or add the transaction restart back-edges.
References all_tm_regions, BASIC_BLOCK_FOR_FN, CDI_DOMINATORS, cfun, expand_block_tm(), expand_regions(), expand_transaction(), FOR_EACH_VEC_ELT, free_dominance_info(), generate_tm_state(), get_bb_regions_instrumented(), gimple_transaction_subcode(), gsi_commit_edge_inserts(), GTMA_DOES_GO_IRREVOCABLE, GTMA_MAY_ENTER_IRREVOCABLE, i, NULL, pending_edge_inserts_p, propagate_tm_flags_out(), r, tm_log_delete(), tm_log_emit(), and tm_log_init().
|
static |
Replace TM load/stores with hints for the runtime. We handle things like read-after-write, write-after-read, read-after-read, read-for-write, etc.
References all_tm_regions, basic_block_def::aux, bitmap_obstack_initialize(), bitmap_obstack_release(), tm_region::entry_block, tm_region::exit_blocks, get_tm_region_blocks(), i, tm_region::irr_blocks, tm_region::next, NULL, tm_memopt_accumulate_memops(), tm_memopt_clear_visited(), tm_memopt_compute_antic(), tm_memopt_compute_available(), tm_memopt_free_sets(), tm_memopt_init_sets(), tm_memopt_obstack, tm_memopt_transform_blocks(), tm_memopt_value_id, and tm_memopt_value_numbers.
|
static |
Expand an assignment statement into transactional builtins.
References build_fold_addr_expr, build_tm_load(), build_tm_store(), builtin_decl_explicit(), copy_fn(), create_tmp_var, tm_region::entry_block, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_build_assign(), gimple_build_call(), gimple_location(), gimple_set_location(), gimplify_addr(), gsi_insert_before(), gsi_next(), gsi_remove(), GSI_SAME_STMT, gsi_stmt(), GTMA_HAVE_LOAD, GTMA_HAVE_STORE, is_gimple_reg(), NULL, requires_barrier(), transaction_subcode_ior(), TREE_ADDRESSABLE, TREE_TYPE, and TYPE_SIZE_UNIT.
Referenced by expand_block_tm(), and expand_call_tm().
|
static |
Split block BB as necessary for every builtin function we added, and wire up the abnormal back edges implied by the transaction restart.
References AR_OUTERABORT, cfun, hash_table< Descriptor, Lazy, Allocator >::create_ggc(), current_function_decl, decl_is_tm_clone(), dyn_cast(), ECF_TM_BUILTIN, gimple_call_arg(), gimple_call_builtin_p(), gimple_call_flags(), gimple_call_set_tail(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), NULL, tm_region::outer, tm_region::restart_block, split_bb_make_tm_edge(), tm_restart_node::stmt, TREE_CODE, and TREE_INT_CST_LOW.
|
static |
Expand all statements in BB as appropriate for being inside a transaction.
References expand_assign_tm(), expand_call_tm(), gcc_unreachable, gimple_assign_single_p(), gimple_clobber_p(), gsi_end_p(), gsi_next(), gsi_start_bb(), and gsi_stmt().
Referenced by execute_tm_mark().
|
static |
Expand a call statement as appropriate for a transaction. That is, either verify that the call does not affect the transaction, or redirect the call to a clone that handles transactions, or change the transaction state to IRREVOCABLE. Return true if the call is one of the builtins that end a transaction.
References as_a(), BUILT_IN_NORMAL, builtin_decl_explicit(), cfun, cgraph_node::create(), create_tmp_reg(), DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), tm_region::entry_block, expand_assign_tm(), expand_call_tm(), find_tm_replacement_function(), FOR_EACH_EDGE, gcc_assert, gcc_unreachable, cgraph_node::get(), gimple_bb(), gimple_build_assign(), gimple_call_fn(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_return_slot_opt_p(), gimple_call_set_fndecl(), gimple_call_set_lhs(), gimple_location(), gimple_seq_alloc_with_stmt(), gimple_set_location(), GSI_CONTINUE_LINKING, gsi_insert_after(), gsi_insert_seq_on_edge(), gsi_start(), gsi_stmt(), GTMA_HAVE_ABORT, GTMA_HAVE_LOAD, GTMA_HAVE_STORE, GTMA_MAY_ENTER_IRREVOCABLE, is_tm_abort(), is_tm_ending_fndecl(), is_tm_pure_call(), is_tm_safe(), NULL, pending_edge_inserts_p, requires_barrier(), stmt_can_throw_internal(), basic_block_def::succs, cgraph_node::tm_may_enter_irr, transaction_subcode_ior(), TREE_TYPE, and update_stmt().
Referenced by expand_block_tm(), and expand_call_tm().
|
static |
The representation of a transaction changes several times during the lowering process. In the beginning, in the front-end we have the GENERIC tree TRANSACTION_EXPR. For example, __transaction { local++; if (++global == 10) __tm_abort; } During initial gimplification (gimplify.cc) the TRANSACTION_EXPR node is trivially replaced with a GIMPLE_TRANSACTION node. During pass_lower_tm, we examine the body of transactions looking for aborts. Transactions that do not contain an abort may be merged into an outer transaction. We also add a TRY-FINALLY node to arrange for the transaction to be committed on any exit. [??? Think about how this arrangement affects throw-with-commit and throw-with-abort operations. In this case we want the TRY to handle gotos, but not to catch any exceptions because the transaction will already be closed.] GIMPLE_TRANSACTION [label=NULL] { try { local = local + 1; t0 = global; t1 = t0 + 1; global = t1; if (t1 == 10) __builtin___tm_abort (); } finally { __builtin___tm_commit (); } } During pass_lower_eh, we create EH regions for the transactions, intermixed with the regular EH stuff. This gives us a nice persistent mapping (all the way through rtl) from transactional memory operation back to the transaction, which allows us to get the abnormal edges correct to model transaction aborts and restarts: GIMPLE_TRANSACTION [label=over] local = local + 1; t0 = global; t1 = t0 + 1; global = t1; if (t1 == 10) __builtin___tm_abort (); __builtin___tm_commit (); over: This is the end of all_lowering_passes, and so is what is present during the IPA passes, and through all of the optimization passes. During pass_ipa_tm, we examine all GIMPLE_TRANSACTION blocks in all functions and mark functions for cloning. At the end of gimple optimization, before exiting SSA form, pass_tm_edges replaces statements that perform transactional memory operations with the appropriate TM builtins, and swap out function calls with their transactional clones. At this point we introduce the abnormal transaction restart edges and complete lowering of the GIMPLE_TRANSACTION node. x = __builtin___tm_start (MAY_ABORT); eh_label: if (x & abort_transaction) goto over; local = local + 1; t0 = __builtin___tm_load (global); t1 = t0 + 1; __builtin___tm_store (&global, t1); if (t1 == 10) __builtin___tm_abort (); __builtin___tm_commit (); over:
Traverse the regions enclosed and including REGION. Execute CALLBACK for each region, passing DATA. CALLBACK returns NULL to continue the traversal, otherwise a non-null value which this function will return as well. TRAVERSE_CLONES is true if we should traverse transactional clones.
References expand_regions_1(), tm_region::next, and NULL.
Referenced by execute_tm_mark(), expand_regions_1(), and get_bb_regions_instrumented().
|
static |
Helper function for expand_regions. Expand REGION and recurse to the inner region. Call CALLBACK on each region. CALLBACK returns NULL to continue the traversal, otherwise a non-null value which this function will return as well. TRAVERSE_CLONES is true if we should traverse transactional clones.
References current_function_decl, decl_is_tm_clone(), tm_region::exit_blocks, expand_regions(), tm_region::inner, and NULL.
Referenced by expand_regions().
|
static |
Replace the GIMPLE_TRANSACTION in this region with the corresponding call to BUILT_IN_TM_START.
References A_ABORTTRANSACTION, A_RESTORELIVEVARIABLES, A_RUNUNINSTRUMENTEDCODE, add_bb_to_loop(), profile_probability::always(), build_int_cst(), builtin_decl_explicit(), basic_block_def::count, create_empty_bb(), create_tmp_reg(), tm_region::entry_block, profile_probability::even(), basic_block_def::flags, FOR_EACH_EDGE, gcc_assert, tm_region::get_transaction_stmt(), gimple_bb(), gimple_build_assign(), gimple_build_call(), gimple_build_cond(), gimple_call_set_lhs(), gimple_location(), gimple_set_location(), gimple_transaction_subcode(), GSI_CONTINUE_LINKING, gsi_insert_after(), gsi_insert_before(), gsi_last_bb(), gsi_remove(), GSI_SAME_STMT, gsi_stmt(), GTMA_DOES_GO_IRREVOCABLE, GTMA_HAS_NO_INSTRUMENTATION, GTMA_HAVE_ABORT, GTMA_HAVE_STORE, GTMA_IS_OUTER, GTMA_MAY_ENTER_IRREVOCABLE, i, profile_probability::likely(), basic_block_def::loop_father, make_edge(), NULL, tm_region::original_transaction_was_outer, phi_nodes(), PR_DOESGOIRREVOCABLE, PR_HASNOABORT, PR_HASNOIRREVOCABLE, PR_INSTRUMENTEDCODE, PR_READONLY, PR_UNINSTRUMENTEDCODE, redirect_edge_pred(), tm_region::restart_block, basic_block_def::succs, tm_log_emit_restores(), tm_log_emit_saves(), tm_log_save_addresses, tm_region::tm_state, tm_region::transaction_stmt, TREE_TYPE, profile_probability::unlikely(), and profile_probability::very_likely().
Referenced by execute_tm_mark().
Return a TM-aware replacement function for DECL.
References BUILT_IN_NORMAL, builtin_decl_explicit(), DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), NULL, and tm_wrap_map.
Referenced by diagnose_tm_1(), expand_call_tm(), ipa_tm_decrement_clone_counts(), ipa_tm_mayenterirr_function(), ipa_tm_scan_calls_block(), ipa_tm_scan_irr_block(), ipa_tm_transform_calls_redirect(), and tm_malloc_replacement().
|
static |
The "gate" function for all transactional memory expansion and optimization passes. We collect region information for each top-level transaction, and if we don't find any, we skip all of the TM passes. Each region will have all of the exit blocks recorded, and the originating statement.
References all_tm_regions, BITMAP_ALLOC, bitmap_obstack_initialize(), bitmap_obstack_release(), calculate_dominance_info(), CDI_DOMINATORS, cfun, current_function_decl, decl_is_tm_clone(), tm_region::entry_block, ENTRY_BLOCK_PTR_FOR_FN, tm_region::irr_blocks, NULL, bitmap_obstack::obstack, single_succ(), tm_obstack, and tm_region_init().
Referenced by compute_transaction_bits().
|
static |
Generate the temporary to be used for the return value of BUILT_IN_TM_START.
References builtin_decl_explicit(), create_tmp_reg(), tm_region::exit_blocks, tm_region::get_transaction_stmt(), gimple_transaction_set_subcode(), gimple_transaction_subcode(), GTMA_DECLARATION_MASK, GTMA_DOES_GO_IRREVOCABLE, GTMA_HAS_NO_INSTRUMENTATION, GTMA_MAY_ENTER_IRREVOCABLE, NULL, tm_region::tm_state, tm_region::transaction_stmt, and TREE_TYPE.
Referenced by execute_tm_mark().
|
static |
Return the attributes we want to examine for X, or NULL if it's not something we examine. We look at function types, but allow pointers to function types and function decls and peek through.
References NULL_TREE, TREE_CODE, TREE_TYPE, TYPE_ATTRIBUTES, and TYPE_P.
Referenced by is_tm_callable(), is_tm_irrevocable(), is_tm_may_cancel_outer(), and is_tm_safe().
|
static |
References all_tm_regions, bb2reg_stuff::bb2reg, cfun, collect_bb2reg(), expand_regions(), bb2reg_stuff::include_uninstrumented_p, and last_basic_block_for_fn.
Referenced by execute_tm_mark().
|
static |
Return the ipa data associated with NODE, allocating zeroed memory if necessary. TRAVERSE_ALIASES is true if we must traverse aliases and set *NODE accordingly.
References cgraph_node::get_alias_target(), NULL, bitmap_obstack::obstack, and tm_obstack.
Referenced by ipa_tm_create_version(), ipa_tm_create_version_alias(), ipa_tm_decrement_clone_counts(), ipa_tm_execute(), ipa_tm_mayenterirr_function(), ipa_tm_note_irrevocable(), ipa_tm_scan_calls_block(), ipa_tm_scan_irr_block(), ipa_tm_scan_irr_function(), ipa_tm_transform_calls_redirect(), ipa_tm_transform_clone(), and ipa_tm_transform_transaction().
|
static |
Return the list of basic-blocks in REGION. STOP_AT_IRREVOCABLE_P is true if caller is uninterested in blocks following a TM_IRREVOCABLE call. INCLUDE_UNINSTRUMENTED_P is TRUE if we should include the uninstrumented code path blocks in the list of basic blocks returned, false otherwise.
References BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_ior_into(), bitmap_set_bit, FOR_EACH_EDGE, i, basic_block_def::index, NULL, basic_block_def::succs, and vNULL.
Referenced by collect_bb2reg(), compute_transaction_bits(), execute_tm_memopt(), ipa_tm_diagnose_transaction(), ipa_tm_propagate_irr(), and ipa_tm_scan_calls_transaction().
|
static |
Gimplify the address of a TARGET_MEM_REF. Return the SSA_NAME result, insert the new statements before GSI.
References build_fold_addr_expr, build_pointer_type(), force_gimple_operand_gsi(), GSI_SAME_STMT, NULL, TREE_CODE, tree_mem_ref_addr(), and TREE_TYPE.
Referenced by build_tm_load(), build_tm_store(), expand_assign_tm(), and tm_log_emit_stmt().
|
static |
Create a copy of the function (possibly declaration only) of OLD_NODE, appropriate for the transactional clone.
References AVAIL_INTERPOSABLE, symbol_table::call_cgraph_insertion_hooks(), cgraph_node::call_for_symbol_thunks_and_aliases(), tm_ipa_cg_data::clone, copy_node(), cgraph_node::create_version_clone(), symtab_node::decl, DECL_ASSEMBLER_NAME, DECL_COMDAT_GROUP, DECL_DECLARED_INLINE_P, DECL_EXTERNAL, DECL_ONE_ONLY, DECL_WEAK, symtab_node::externally_visible, ipa_ref_list::first_referring(), symtab_node::force_output, symtab_node::forced_by_abi, gcc_assert, varpool_node::get(), cgraph_node::get_availability(), get_cg_data(), symtab_node::implicit_section, ipa_tm_create_version_alias(), ipa_tm_mark_force_output_node(), ipa_tm_mark_forced_by_abi_node(), cgraph_node::ipa_transforms_to_apply, cgraph_node::local, cgraph_node::lowered, create_version_alias_info::new_decl, NULL, create_version_alias_info::old_node, record_tm_clone_pair(), symtab_node::ref_list, symtab_node::set_comdat_group(), SET_DECL_ASSEMBLER_NAME, SET_DECL_RTL, symtab_node::set_section(), symtab, cgraph_node::tm_clone, tm_mangle(), tree_function_versioning(), TREE_PUBLIC, TREE_SYMBOL_REFERENCED, and vNULL.
Referenced by ipa_tm_execute().
|
static |
A subroutine of ipa_tm_create_version, called via cgraph_for_node_and_aliases. Create new tm clones for each of the existing aliases.
References build_decl(), tm_ipa_cg_data::clone, symtab_node::cpp_implicit_alias, cgraph_node::create_same_body_alias(), symtab_node::decl, DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, decl_comdat_group_id(), DECL_CONTEXT, DECL_EXTERNAL, DECL_LANG_SPECIFIC, DECL_ONE_ONLY, DECL_SOURCE_LOCATION, symtab_node::externally_visible, ipa_ref_list::first_referring(), symtab_node::force_output, symtab_node::forced_by_abi, varpool_node::get(), get_cg_data(), ipa_tm_mark_force_output_node(), ipa_tm_mark_forced_by_abi_node(), create_version_alias_info::new_decl, symtab_node::no_reorder, NULL, create_version_alias_info::old_node, record_tm_clone_pair(), symtab_node::ref_list, symtab_node::set_comdat_group(), SET_DECL_ASSEMBLER_NAME, SET_DECL_RTL, cgraph_node::tm_clone, tm_mangle(), TREE_ADDRESSABLE, TREE_CODE, TREE_PUBLIC, TREE_READONLY, TREE_SYMBOL_REFERENCED, TREE_TYPE, and TREE_USED.
Referenced by ipa_tm_create_version().
|
static |
References find_tm_replacement_function(), gcc_assert, cgraph_node::get(), get_cg_data(), gimple_call_fndecl(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_call(), is_tm_ending_fndecl(), is_tm_pure_call(), tm_ipa_cg_data::tm_callers_clone, and tm_ipa_cg_data::tm_callers_normal.
Referenced by ipa_tm_scan_irr_function().
|
static |
Diagnose calls from transaction_safe functions to unmarked functions that are determined to not be safe.
References cgraph_edge::call_stmt, cgraph_edge::callee, cgraph_node::callees, symtab_node::decl, error_at(), gimple_location(), is_tm_callable(), cgraph_edge::next_callee, and cgraph_node::tm_may_enter_irr.
Referenced by ipa_tm_execute().
|
static |
Diagnose call from atomic transactions to unmarked functions that are determined to not be safe.
References all_tm_regions, bitmap_bit_p, error_at(), get_tm_region_blocks(), gimple_call_fndecl(), gimple_location(), gimple_transaction_subcode(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), GTMA_IS_RELAXED, i, basic_block_def::index, ipa_tm_diagnose_transaction(), is_gimple_call(), is_tm_callable(), is_tm_ending_fndecl(), is_tm_pure_call(), cgraph_node::local_info_node(), tm_region::next, NULL, and r.
Referenced by ipa_tm_diagnose_transaction(), and ipa_tm_execute().
|
static |
Main entry point for the transactional memory IPA pass.
References a, symtab_node::alias, all_tm_regions, tm_ipa_cg_data::all_tm_regions, symtab_node::analyzed, symtab_node::aux, AVAIL_AVAILABLE, AVAIL_INTERPOSABLE, AVAIL_NOT_AVAILABLE, bitmap_obstack_initialize(), bitmap_obstack_release(), calculate_dominance_info(), cgraph_edge::caller, cgraph_node::callers, CDI_DOMINATORS, cgraph_node::checking_verify_cgraph_nodes(), tm_ipa_cg_data::clone, symtab_node::cpp_implicit_alias, symtab_node::decl, DECL_STRUCT_FUNCTION, dyn_cast(), FOR_EACH_ALIAS, FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION, free_original_copy_tables(), gcc_assert, cgraph_node::get(), thunk_info::get(), cgraph_node::get_availability(), get_cg_data(), i, tm_ipa_cg_data::in_callee_queue, tm_ipa_cg_data::in_worklist, initialize_original_copy_tables(), ipa_tm_create_version(), ipa_tm_diagnose_tm_safe(), ipa_tm_diagnose_transaction(), ipa_tm_mayenterirr_function(), ipa_tm_note_irrevocable(), ipa_tm_scan_calls_clone(), ipa_tm_scan_calls_transaction(), ipa_tm_scan_irr_function(), ipa_tm_transform_clone(), ipa_tm_transform_transaction(), tm_ipa_cg_data::is_irrevocable, is_tm_callable(), is_tm_irrevocable(), is_tm_pure(), is_tm_safe(), is_tm_safe_or_pure(), cgraph_node::local, cgraph_node::lowered, maybe_push_queue(), cgraph_edge::next_caller, NULL, pop_cfun(), push_cfun(), record_tm_clone_pair(), ipa_ref::referring, tm_ipa_cg_data::tm_callers_clone, tm_ipa_cg_data::tm_callers_normal, cgraph_node::tm_may_enter_irr, tm_obstack, tm_region_init(), tree_versionable_function_p(), and tm_ipa_cg_data::want_irr_scan_normal.
|
static |
Construct a call to TM_GETTMCLONE and insert it before GSI.
References builtin_decl_explicit(), count, cgraph_node::create_edge(), create_tmp_reg(), create_tmp_var, current_function_decl, fold_build1, g, cgraph_node::get(), cgraph_node::get_create(), cgraph_node::get_edge(), get_tm_clone_pair(), gimple_assign_set_lhs(), gimple_bb(), gimple_build_assign(), gimple_build_call(), gimple_call_fn(), gimple_call_fntype(), gimple_call_lhs(), gimple_call_nothrow_p(), gimple_call_set_fn(), gimple_call_set_lhs(), gimple_call_set_nothrow(), gsi_insert_after(), gsi_insert_before(), GSI_SAME_STMT, GTMA_MAY_ENTER_IRREVOCABLE, cgraph_edge::indirect_info, is_tm_safe(), make_ssa_name(), cgraph_node::mark_address_taken(), OBJ_TYPE_REF_EXPR, cgraph_indirect_call_info::polymorphic, ptr_type_node, transaction_subcode_ior(), TREE_CODE, TREE_OPERAND, TREE_TYPE, update_stmt(), and useless_type_conversion_p().
Referenced by ipa_tm_transform_calls_redirect().
|
static |
Construct a call to TM_IRREVOCABLE and insert it at the beginning of BB.
References build_int_cst(), builtin_decl_explicit(), count, cgraph_node::create_edge(), g, cgraph_node::get_create(), gimple_bb(), gimple_build_call(), gsi_after_labels(), gsi_insert_before(), GSI_SAME_STMT, GTMA_MAY_ENTER_IRREVOCABLE, MODE_SERIALIRREVOCABLE, NULL_TREE, split_block_after_labels(), and transaction_subcode_ior().
Referenced by ipa_tm_transform_calls_1().
|
inlinestatic |
References symtab_node::analyzed, and cgraph_node::mark_force_output().
Referenced by ipa_tm_create_version(), and ipa_tm_create_version_alias().
|
inlinestatic |
References symtab_node::analyzed, and symtab_node::forced_by_abi.
Referenced by ipa_tm_create_version(), and ipa_tm_create_version_alias().
|
static |
Return true if, for the transactional clone of NODE, any call may enter irrevocable mode.
References symtab_node::alias, AVAIL_AVAILABLE, symtab_node::decl, ECF_TM_BUILTIN, ECF_TM_PURE, find_tm_replacement_function(), flags_from_decl_or_type(), cgraph_node::get(), thunk_info::get(), cgraph_node::get_availability(), get_cg_data(), ipa_tm_mayenterirr_function(), tm_ipa_cg_data::irrevocable_blocks_clone, tm_ipa_cg_data::is_irrevocable, is_tm_callable(), is_tm_irrevocable(), is_tm_safe(), and cgraph_node::tm_may_enter_irr.
Referenced by ipa_tm_execute(), and ipa_tm_mayenterirr_function().
|
static |
The function NODE has been detected to be irrevocable. Push all of its callers onto WORKLIST for the purpose of re-scanning them.
References bitmap_bit_p, cgraph_edge::call_stmt, cgraph_edge::caller, cgraph_node::callers, symtab_node::decl, gcc_assert, get_cg_data(), gimple_bb(), tm_ipa_cg_data::in_worklist, basic_block_def::index, tm_ipa_cg_data::is_irrevocable, is_tm_safe_or_pure(), maybe_push_queue(), cgraph_edge::next_caller, NULL, tm_ipa_cg_data::transaction_blocks_normal, and tm_ipa_cg_data::want_irr_scan_normal.
Referenced by ipa_tm_execute().
|
static |
Propagate the irrevocable property both up and down the dominator tree. BB is the current block being scanned; EXIT_BLOCKS are the edges of the TM regions; OLD_IRR are the results of a previous scan of the dominator tree which has been fully propagated; NEW_IRR is the set of new blocks which are gaining the irrevocable property during the current scan.
References BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, CDI_DOMINATORS, first_dom_son(), FOR_EACH_EDGE, get_tm_region_blocks(), basic_block_def::index, next_dom_son(), NULL, basic_block_def::succs, and tm_obstack.
Referenced by ipa_tm_scan_irr_function().
|
static |
A subroutine of ipa_tm_scan_calls_transaction and ipa_tm_scan_calls_clone. Queue all callees within block BB.
References find_tm_replacement_function(), gcc_assert, cgraph_node::get(), get_cg_data(), gimple_call_fndecl(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), tm_ipa_cg_data::in_callee_queue, is_gimple_call(), is_tm_ending_fndecl(), is_tm_pure_call(), maybe_push_queue(), NULL, tm_ipa_cg_data::tm_callers_clone, and tm_ipa_cg_data::tm_callers_normal.
Referenced by ipa_tm_scan_calls_clone(), and ipa_tm_scan_calls_transaction().
|
static |
Scan all calls in NODE as if this is the transactional clone, and push the destinations into the callee queue.
References symtab_node::decl, DECL_STRUCT_FUNCTION, FOR_EACH_BB_FN, and ipa_tm_scan_calls_block().
Referenced by ipa_tm_execute().
|
static |
Scan all calls in NODE that are within a transaction region, and push the resulting nodes into the callee queue.
References all_tm_regions, tm_ipa_cg_data::all_tm_regions, BITMAP_ALLOC, FOR_EACH_VEC_ELT, get_tm_region_blocks(), i, ipa_tm_scan_calls_block(), tm_region::next, NULL, r, tm_obstack, and tm_ipa_cg_data::transaction_blocks_normal.
Referenced by ipa_tm_execute().
|
static |
A subroutine of ipa_tm_scan_irr_blocks; return true iff any statement within the block is irrevocable.
References current_function_decl, error_at(), find_tm_replacement_function(), cgraph_node::get(), get_cg_data(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_call_fn(), gimple_call_lhs(), gimple_location(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), tm_ipa_cg_data::is_irrevocable, is_tm_ending_fndecl(), is_tm_irrevocable(), is_tm_pure_call(), is_tm_safe(), is_tm_safe_or_pure(), TREE_CODE, TREE_OPERAND, and volatile_lvalue_p().
Referenced by ipa_tm_scan_irr_blocks().
|
static |
For each of the blocks seeded witin PQUEUE, walk the CFG looking for new irrevocable blocks, marking them in NEW_IRR. Don't bother scanning past OLD_IRR or EXIT_BLOCKS.
References BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, FOR_EACH_EDGE, basic_block_def::index, ipa_tm_scan_irr_block(), NULL, and basic_block_def::succs.
Referenced by ipa_tm_scan_irr_function().
|
static |
(Re-)Scan the transaction blocks in NODE for calls to irrevocable functions, as well as other irrevocable actions such as inline assembly. Mark all such blocks as irrevocable and decrement the number of calls to transactional clones. Return true if, for the transactional clone, the entire function is irrevocable.
References tm_ipa_cg_data::all_tm_regions, BASIC_BLOCK_FOR_FN, BITMAP_ALLOC, bitmap_bit_p, bitmap_empty_p(), BITMAP_FREE, bitmap_ior_into(), calculate_dominance_info(), CDI_DOMINATORS, cfun, current_function_decl, symtab_node::decl, lang_hooks::decl_printable_name, DECL_STRUCT_FUNCTION, dump_file, tm_region::entry_block, ENTRY_BLOCK_PTR_FOR_FN, EXECUTE_IF_SET_IN_BITMAP, tm_region::exit_blocks, get_cg_data(), i, ipa_tm_decrement_clone_counts(), ipa_tm_propagate_irr(), ipa_tm_scan_irr_blocks(), tm_ipa_cg_data::irrevocable_blocks_clone, tm_ipa_cg_data::irrevocable_blocks_normal, tm_region::next, NULL, pop_cfun(), push_cfun(), queue, single_succ(), and tm_obstack.
Referenced by ipa_tm_execute().
|
static |
Walk the CFG for REGION, beginning at BB. Install calls to tm_irrevocable when IRR_BLOCKS are reached, redirect other calls to the generated transactional clone.
References BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, tm_region::exit_blocks, FOR_EACH_EDGE, basic_block_def::index, ipa_tm_transform_calls_1(), NULL, queue, and basic_block_def::succs.
Referenced by ipa_tm_transform_clone(), and ipa_tm_transform_transaction().
|
static |
Helper function for ipa_tm_transform_calls. For a given BB, install calls to tm_irrevocable when IRR_BLOCKS are reached, redirect other calls to the generated transactional clone.
References bitmap_bit_p, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, ipa_tm_insert_irr_call(), ipa_tm_transform_calls_redirect(), is_gimple_call(), and is_tm_pure_call().
Referenced by ipa_tm_transform_calls().
|
static |
Helper function for ipa_tm_transform_calls*. Given a call statement in GSI which resides inside transaction REGION, redirect the call to either its wrapper function, or its clone.
References as_a(), cgraph_edge::callee, cgraph_edge::caller, tm_ipa_cg_data::clone, current_function_decl, symtab_node::decl, decl_is_tm_clone(), ECF_TM_BUILTIN, find_tm_replacement_function(), flags_from_decl_or_type(), get_cg_data(), cgraph_node::get_create(), cgraph_node::get_edge(), gimple_call_fndecl(), gimple_call_set_fndecl(), gsi_stmt(), ipa_tm_insert_gettmclone_call(), NULL, cgraph_edge::redirect_callee(), and cgraph_node::tm_may_enter_irr.
Referenced by ipa_tm_transform_calls_1().
|
static |
Transform the calls within the transactional clone of NODE.
References calculate_dominance_info(), cgraph_node::callees, CDI_DOMINATORS, cfun, tm_ipa_cg_data::clone, symtab_node::decl, DECL_STRUCT_FUNCTION, ENTRY_BLOCK_PTR_FOR_FN, get_cg_data(), cgraph_node::indirect_calls, ipa_tm_transform_calls(), tm_ipa_cg_data::irrevocable_blocks_clone, NULL, pop_cfun(), push_cfun(), single_succ(), TODO_update_ssa_only_virtuals, and update_ssa().
Referenced by ipa_tm_execute().
|
static |
Transform the calls within the TM regions within NODE.
References tm_ipa_cg_data::all_tm_regions, bitmap_bit_p, calculate_dominance_info(), CDI_DOMINATORS, symtab_node::decl, DECL_STRUCT_FUNCTION, tm_region::entry_block, get_cg_data(), GTMA_DOES_GO_IRREVOCABLE, GTMA_HAS_NO_INSTRUMENTATION, GTMA_MAY_ENTER_IRREVOCABLE, basic_block_def::index, ipa_tm_transform_calls(), tm_ipa_cg_data::irrevocable_blocks_normal, tm_region::next, pop_cfun(), push_cfun(), TODO_update_ssa_only_virtuals, transaction_subcode_ior(), and update_ssa().
Referenced by ipa_tm_execute().
Return true if FNDECL is BUILT_IN_TM_ABORT.
References fndecl_built_in_p().
Referenced by examine_call_tm(), and expand_call_tm().
Return true if X has been marked TM_CALLABLE.
References get_attrs_for(), and lookup_attribute().
Referenced by diagnose_tm_1(), ipa_tm_diagnose_tm_safe(), ipa_tm_diagnose_transaction(), ipa_tm_execute(), and ipa_tm_mayenterirr_function().
Return true if STMT is a built in function call that "ends" a transaction.
References gimple_call_fndecl(), is_tm_ending_fndecl(), and NULL_TREE.
Referenced by merge_stmts_p().
Return true for built in functions that "end" a transaction.
References BUILT_IN_NORMAL, DECL_BUILT_IN_CLASS, and DECL_FUNCTION_CODE().
Referenced by expand_call_tm(), gimple_call_initialize_ctrl_altering(), ipa_tm_decrement_clone_counts(), ipa_tm_diagnose_transaction(), ipa_tm_scan_calls_block(), ipa_tm_scan_irr_block(), and is_tm_ending().
Return true if X has been marked TM_IRREVOCABLE.
References fndecl_built_in_p(), get_attrs_for(), lookup_attribute(), TREE_CODE, and TREE_OPERAND.
Referenced by diagnose_tm_1(), ipa_tm_execute(), ipa_tm_mayenterirr_function(), and ipa_tm_scan_irr_block().
Return true if STMT is a TM load.
References BUILT_IN_NORMAL, BUILTIN_TM_LOAD_P, DECL_FUNCTION_CODE(), fndecl_built_in_p(), and gimple_call_fndecl().
Referenced by tm_memopt_accumulate_memops(), and tm_memopt_value_number().
Return true if X has been marked TRANSACTION_MAY_CANCEL_OUTER.
References get_attrs_for(), lookup_attribute(), and NULL.
Referenced by diagnose_tm_1(), and diagnose_tm_blocks().
bool is_tm_pure | ( | const_tree | x | ) |
Return true if X has been marked TM_PURE.
References ECF_TM_PURE, flags_from_decl_or_type(), TREE_CODE, TREE_TYPE, and TYPE_P.
Referenced by can_inline_edge_p(), ipa_tm_execute(), and is_tm_safe_or_pure().
Return true if CALL is const, or tm_pure.
References ECF_CONST, ECF_TM_PURE, and gimple_call_flags().
Referenced by examine_call_tm(), expand_call_tm(), ipa_tm_decrement_clone_counts(), ipa_tm_diagnose_transaction(), ipa_tm_scan_calls_block(), ipa_tm_scan_irr_block(), and ipa_tm_transform_calls_1().
bool is_tm_safe | ( | const_tree | x | ) |
Return true if X has been marked TM_SAFE.
References get_attrs_for(), and lookup_attribute().
Referenced by diagnose_tm_blocks(), expand_call_tm(), ipa_tm_execute(), ipa_tm_insert_gettmclone_call(), ipa_tm_mayenterirr_function(), ipa_tm_scan_irr_block(), and is_tm_safe_or_pure().
|
inlinestatic |
References is_tm_pure(), and is_tm_safe().
Referenced by diagnose_tm_1(), ipa_tm_execute(), ipa_tm_note_irrevocable(), and ipa_tm_scan_irr_block().
Same as above, but for simple TM loads, that is, not the after-write, after-read, etc optimized variants.
References BUILT_IN_NORMAL, DECL_FUNCTION_CODE(), fndecl_built_in_p(), and gimple_call_fndecl().
Referenced by tm_memopt_transform_blocks().
Same as above, but for simple TM stores, that is, not the after-write, after-read, etc optimized variants.
References BUILT_IN_NORMAL, DECL_FUNCTION_CODE(), fndecl_built_in_p(), and gimple_call_fndecl().
Referenced by tm_memopt_transform_blocks().
Return true if STMT is a TM store.
References BUILT_IN_NORMAL, BUILTIN_TM_STORE_P, DECL_FUNCTION_CODE(), fndecl_built_in_p(), and gimple_call_fndecl().
Referenced by tm_memopt_accumulate_memops(), and tm_memopt_value_number().
|
static |
Iterate through the statements in the sequence, lowering them all as appropriate for being outside of a transaction.
References gimple_has_substatements(), walk_stmt_info::gsi, gsi_stmt(), lower_transaction(), NULL_TREE, and walk_stmt_info::stmt.
Referenced by execute_lower_tm().
|
static |
Iterate through the statements in the sequence, lowering them all as appropriate for being in a transaction.
References examine_assign_tm(), examine_call_tm(), gimple_assign_single_p(), gimple_has_substatements(), walk_stmt_info::gsi, gsi_stmt(), GTMA_MAY_ENTER_IRREVOCABLE, lower_transaction(), NULL_TREE, and walk_stmt_info::stmt.
Referenced by lower_transaction().
|
static |
Lower a GIMPLE_TRANSACTION statement.
References as_a(), builtin_decl_explicit(), copy_gimple_seq_and_replace_locals(), create_artificial_label(), create_tmp_var, g, gimple_build_call(), gimple_build_eh_else(), gimple_build_goto(), gimple_build_label(), gimple_build_try(), gimple_call_set_lhs(), gimple_seq_add_stmt(), gimple_seq_alloc_with_stmt(), gimple_transaction_body(), gimple_transaction_body_ptr(), gimple_transaction_set_body(), gimple_transaction_set_label_norm(), gimple_transaction_set_label_over(), gimple_transaction_set_label_uninst(), gimple_transaction_set_subcode(), gimple_transaction_subcode(), GIMPLE_TRY_FINALLY, walk_stmt_info::gsi, GSI_CONTINUE_LINKING, gsi_insert_after(), gsi_insert_seq_after(), gsi_insert_seq_before(), gsi_remove(), GSI_SAME_STMT, gsi_stmt(), GTMA_DECLARATION_MASK, GTMA_HAVE_ABORT, GTMA_IS_OUTER, walk_stmt_info::info, integer_zero_node, lower_sequence_tm(), make_tm_uninst(), NULL, ptr_type_node, walk_stmt_info::stmt, UNKNOWN_LOCATION, walk_gimple_seq(), and walk_gimple_seq_mod().
Referenced by lower_sequence_no_tm(), and lower_sequence_tm().
gimple_opt_pass * make_pass_diagnose_tm_blocks | ( | gcc::context * | ctxt | ) |
simple_ipa_opt_pass * make_pass_ipa_tm | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_lower_tm | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_tm_edges | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_tm_init | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_tm_mark | ( | gcc::context * | ctxt | ) |
gimple_opt_pass * make_pass_tm_memopt | ( | gcc::context * | ctxt | ) |
|
static |
Iterate through the statements in the sequence, moving labels (and thus edges) of transactions from "label_norm" to "label_uninst".
References dyn_cast(), gimple_has_substatements(), gsi_stmt(), NULL, and NULL_TREE.
Referenced by lower_transaction().
|
static |
Add NODE to the end of QUEUE, unless IN_QUEUE_P indicates that it is already present.
Referenced by ipa_tm_execute(), ipa_tm_note_irrevocable(), and ipa_tm_scan_calls_block().
|
static |
References tm_region::get_transaction_stmt(), gimple_transaction_set_subcode(), gimple_transaction_subcode(), GTMA_HAVE_ABORT, GTMA_HAVE_LOAD, GTMA_HAVE_STORE, GTMA_MAY_ENTER_IRREVOCABLE, tm_region::inner, tm_region::next, NULL, tm_region::outer, propagate_tm_flags_out(), and tm_region::transaction_stmt.
Referenced by execute_tm_mark(), and propagate_tm_flags_out().
References hash_table< Descriptor, Lazy, Allocator >::create_ggc(), DECL_UNINLINABLE, ggc_alloc(), NULL, and tm_wrap_map.
Referenced by tm_malloc_replacement().
|
static |
Determine whether X has to be instrumented using a read or write barrier. ENTRY_BLOCK is the entry block for the region where stmt resides in. NULL if unknown. STMT is the statement in which X occurs in. It is used for thread private memory instrumentation. If no TPM instrumentation is desired, STMT should be null.
References DECL_BY_REFERENCE, tm_log_entry::entry_block, gcc_assert, handled_component_p(), is_global_var(), mem_non_local, mem_thread_local, needs_to_live_in_memory(), thread_private_new_memory(), tm_log_add(), TMR_BASE, TREE_CODE, TREE_OPERAND, TREE_READONLY, and VAR_P.
Referenced by examine_assign_tm(), expand_assign_tm(), and expand_call_tm().
|
inlinestatic |
Create an abnormal edge from STMT at iter, splitting the block as necessary. Adjust *PNEXT as needed for the split block.
References cfun, hash_table< Descriptor, Lazy, Allocator >::create_ggc(), ggc_alloc(), gimple_bb(), gimple_block_label(), gsi_one_before_end_p(), gsi_start_bb(), profile_probability::guessed_never(), tm_restart_node::label_or_list, make_edge(), NULL, split_block(), tm_restart_node::stmt, TREE_CODE, and tree_cons().
Referenced by expand_block_edges().
|
static |
Evaluate an address X being dereferenced and determine if it originally points to a non aliased new chunk of memory (malloc, alloca, etc). Return MEM_THREAD_LOCAL if it points to a thread-local address. Return MEM_TRANSACTION_LOCAL if it points to a transaction-local address. Return MEM_NON_LOCAL otherwise. ENTRY_BLOCK is the entry block to the transaction containing the dereference of X.
References CDI_DOMINATORS, CONVERT_EXPR_CODE_P, dominated_by_p(), ECF_MALLOC, tm_log_entry::entry_block, gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), gimple_bb(), gimple_call_flags(), gimple_phi_num_args(), gimple_phi_result(), i, is_gimple_assign(), is_gimple_call(), tm_new_mem_map::local_new_memory, mem_max, mem_non_local, mem_thread_local, mem_transaction_local, MIN, NULL, PHI_ARG_DEF, ptr_deref_may_alias_global_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, thread_private_new_memory(), tm_new_mem_hash, TREE_CODE, and tm_new_mem_map::val.
Referenced by requires_barrier(), and thread_private_new_memory().
|
static |
Given an address ADDR in STMT, find it in the memory log or add it, making sure to keep only the addresses highest in the dominator tree. ENTRY_BLOCK is the entry_block for the transaction. If we find the address in the log, make sure it's either the same address, or an equivalent one that dominates ADDR. If we find the address, but neither ADDR dominates the found address, nor the found one dominates ADDR, we're on different execution paths. Add it. If known, ENTRY_BLOCK is the entry block for the region, otherwise NULL.
References tm_log_entry::addr, CDI_DOMINATORS, create_tmp_reg(), dominated_by_p(), tm_log_entry::entry_block, gcc_assert, gimple_bb(), i, NULL, tm_log_entry::save_var, tm_log_entry::stmts, tm_log, tm_log_save_addresses, transaction_invariant_address_p(), TREE_ADDRESSABLE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, and TYPE_SIZE_UNIT.
Referenced by requires_barrier().
|
static |
Free logging data structures.
References NULL, tm_log, tm_log_save_addresses, and tm_new_mem_hash.
Referenced by execute_tm_mark().
|
static |
Go through the log and instrument address that must be instrumented with the logging functions. Leave the save/restore addresses for later.
References tm_log_entry::addr, dump_file, FOR_EACH_HASH_TABLE_ELEMENT, i, print_generic_expr(), tm_log_entry::save_var, tm_log_entry::stmts, tm_log, and tm_log_emit_stmt().
Referenced by execute_tm_mark().
|
static |
Emit the restore sequence for the corresponding addresses in the log. ENTRY_BLOCK is the entry block for the transaction. BB is the basic block to insert the code in.
References tm_log_entry::addr, tm_log_entry::entry_block, gcc_assert, gimple_build_assign(), GSI_CONTINUE_LINKING, gsi_insert_after(), gsi_start_bb(), i, NULL, tm_log_entry::save_var, tm_log, tm_log_save_addresses, and unshare_expr().
Referenced by expand_transaction().
|
static |
Emit the save sequence for the corresponding addresses in the log. ENTRY_BLOCK is the entry block for the transaction. BB is the basic block to insert the code in.
References tm_log_entry::addr, tm_log_entry::entry_block, gcc_assert, gimple_assign_set_lhs(), gimple_build_assign(), gsi_insert_before(), gsi_last_bb(), GSI_SAME_STMT, i, is_gimple_reg_type(), make_ssa_name(), NULL, tm_log_entry::save_var, tm_log, tm_log_save_addresses, TREE_TYPE, and unshare_expr().
Referenced by expand_transaction().
Instrument one address with the logging functions. ADDR is the address to save. STMT is the statement before which to place it.
References tm_log_entry::addr, builtin_decl_explicit(), builtin_decl_explicit_p(), double_type_node, float_type_node, gimple_build_call(), gimplify_addr(), gsi_for_stmt(), gsi_insert_before(), GSI_SAME_STMT, log(), long_double_type_node, NULL, TREE_CODE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, TYPE_SIZE, and TYPE_SIZE_UNIT.
Referenced by tm_log_emit().
|
static |
Initialize logging data structures.
References tm_log, tm_log_save_addresses, and tm_new_mem_hash.
Referenced by execute_tm_mark().
void tm_malloc_replacement | ( | tree | from | ) |
When appropriate, record TM replacement for memory allocation functions. FROM is the FNDECL to wrap.
References builtin_decl_explicit(), DECL_NAME, find_tm_replacement_function(), IDENTIFIER_POINTER, record_tm_replacement(), TREE_CODE, and TREE_NOTHROW.
Return a transactional mangled name for the DECL_ASSEMBLER_NAME in OLD_DECL. The returned value is a freshly malloced pointer that should be freed by the caller.
References free(), get_identifier(), IDENTIFIER_LENGTH, IDENTIFIER_POINTER, and NULL.
Referenced by ipa_tm_create_version(), and ipa_tm_create_version_alias().
|
static |
Accumulate TM memory operations in BB into STORE_LOCAL and READ_LOCAL.
References bitmap_set_bit, dump_file, gimple_bb(), gimple_call_arg(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_tm_load(), is_tm_store(), print_generic_expr(), READ_LOCAL, STORE_LOCAL, and tm_memopt_value_number().
Referenced by execute_tm_memopt().
|
static |
Clear the visited bit for every basic block in BLOCKS.
References BB_VISITED_P, and i.
Referenced by execute_tm_memopt().
|
static |
Compute ANTIC sets for every basic block in BLOCKS. We compute STORE_ANTIC_OUT as follows: STORE_ANTIC_OUT[bb] = union(STORE_ANTIC_IN[bb], STORE_LOCAL[bb]) STORE_ANTIC_IN[bb] = intersect(STORE_ANTIC_OUT[successors]) REGION is the TM region. BLOCKS are the basic blocks in the region.
References AVAIL_IN_WORKLIST_P, BASIC_BLOCK_FOR_FN, BB_VISITED_P, bitmap_bit_p, bitmap_ior_into(), cfun, dump_file, dump_tm_memopt_sets(), tm_region::entry_block, EXECUTE_IF_SET_IN_BITMAP, tm_region::exit_blocks, FOR_EACH_EDGE, free(), i, basic_block_def::index, basic_block_def::preds, STORE_ANTIC_IN, STORE_ANTIC_OUT, STORE_LOCAL, tm_memopt_compute_antin(), and worklist.
Referenced by execute_tm_memopt().
|
static |
Compute the STORE_ANTIC_IN for the basic block BB.
References BB_VISITED_P, bitmap_and_into(), bitmap_copy(), EDGE_COUNT, EDGE_SUCC, STORE_ANTIC_IN, STORE_ANTIC_OUT, and basic_block_def::succs.
Referenced by tm_memopt_compute_antic().
|
static |
Compute the AVAIL sets for every basic block in BLOCKS. We compute {STORE,READ}_AVAIL_{OUT,IN} as follows: AVAIL_OUT[bb] = union (AVAIL_IN[bb], LOCAL[bb]) AVAIL_IN[bb] = intersect (AVAIL_OUT[predecessors]) This is basically what we do in lcm's compute_available(), but here we calculate two sets of sets (one for STOREs and one for READs), and we work on a region instead of the entire CFG. REGION is the TM region. BLOCKS are the basic blocks in the region.
References AVAIL_IN_WORKLIST_P, BB_VISITED_P, bitmap_bit_p, bitmap_ior_into(), cfun, changed, dump_file, dump_tm_memopt_sets(), tm_region::entry_block, EXIT_BLOCK_PTR_FOR_FN, tm_region::exit_blocks, FOR_EACH_EDGE, free(), gcc_assert, i, basic_block_def::index, NULL, READ_AVAIL_IN, READ_AVAIL_OUT, READ_LOCAL, STORE_AVAIL_IN, STORE_AVAIL_OUT, STORE_LOCAL, basic_block_def::succs, tm_memopt_compute_avin(), and worklist.
Referenced by execute_tm_memopt().
|
static |
Compute {STORE,READ}_AVAIL_IN for the basic block BB.
References BB_VISITED_P, bitmap_and_into(), bitmap_copy(), EDGE_COUNT, EDGE_PRED, basic_block_def::preds, READ_AVAIL_IN, READ_AVAIL_OUT, STORE_AVAIL_IN, and STORE_AVAIL_OUT.
Referenced by tm_memopt_compute_available().
|
static |
Free sets computed for each BB.
References basic_block_def::aux, i, and NULL.
Referenced by execute_tm_memopt().
|
static |
Return a new set of bitmaps for a BB.
References b, BITMAP_ALLOC, bitmap_obstack::obstack, and tm_memopt_obstack.
Referenced by execute_tm_memopt().
|
static |
Perform the actual TM memory optimization transformations in the basic blocks in BLOCKS.
References as_a(), bitmap_bit_p, bitmap_set_bit, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), i, is_tm_simple_load(), is_tm_simple_store(), READ_AVAIL_IN, STORE_ANTIC_OUT, STORE_AVAIL_IN, tm_memopt_transform_stmt(), tm_memopt_value_number(), TRANSFORM_RAR, TRANSFORM_RAW, TRANSFORM_RFW, TRANSFORM_WAR, and TRANSFORM_WAW.
Referenced by execute_tm_memopt().
|
static |
Perform a read/write optimization. Replaces the TM builtin in STMT by a builtin that is OFFSET entries down in the builtins table in gtm-builtins.def.
References builtin_decl_explicit(), DECL_FUNCTION_CODE(), dump_tm_memopt_transform(), gcc_assert, gimple_call_fn(), gimple_call_set_fn(), gsi_replace(), offset, TREE_CODE, and TREE_OPERAND.
Referenced by tm_memopt_transform_blocks().
|
static |
Given a TM load/store in STMT, return the value number for the address it accesses.
References tm_memop::addr, gcc_assert, gcc_unreachable, gimple_call_arg(), is_tm_load(), is_tm_store(), tm_memopt_value_id, tm_memopt_value_numbers, and tm_memop::value_id.
Referenced by tm_memopt_accumulate_memops(), and tm_memopt_transform_blocks().
|
static |
Collect all of the transaction regions within the current function and record them in ALL_TM_REGIONS. The REGION parameter may specify an "outermost" region for use by tm clones.
References all_tm_regions, BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, cfun, dyn_cast(), tm_region::entry_block, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, g, basic_block_def::index, last_basic_block_for_fn, last_nondebug_stmt(), NULL, queue, single_succ(), basic_block_def::succs, tm_region_init_0(), and tm_region_init_1().
Referenced by gate_tm_init(), and ipa_tm_execute().
|
static |
A subroutine of tm_region_init. Record the existence of the GIMPLE_TRANSACTION statement in a tree of tm_region elements.
References all_tm_regions, BITMAP_ALLOC, tm_region::entry_block, tm_region::exit_blocks, FALLTHRU_EDGE, tm_region::inner, tm_region::irr_blocks, tm_region::next, NULL, bitmap_obstack::obstack, tm_region::original_transaction_was_outer, tm_region::outer, tm_obstack, tm_region::tm_state, and tm_region::transaction_stmt.
Referenced by tm_region_init().
|
static |
A subroutine of tm_region_init. Record all the exit and irrevocable blocks in BB into the region's exit_blocks and irr_blocks bitmaps. Returns the new region being scanned.
References bitmap_set_bit, BUILT_IN_NORMAL, DECL_FUNCTION_CODE(), tm_region::exit_blocks, fndecl_built_in_p(), g, gimple_call_fndecl(), gsi_end_p(), gsi_last_bb(), gsi_prev(), gsi_stmt(), basic_block_def::index, tm_region::irr_blocks, and tm_region::outer.
Referenced by tm_region_init().
|
static |
Return true if MEM is a transaction invariant memory for the TM region starting at REGION_ENTRY_BLOCK.
References CDI_DOMINATORS, CONSTANT_CLASS_P, decl_address_invariant_p(), dominated_by_p(), gimple_bb(), INDIRECT_REF_P, SSA_NAME_DEF_STMT, strip_invariant_refs(), TREE_CODE, and TREE_OPERAND.
Referenced by tm_log_add().
|
inlinestatic |
Add FLAGS to the GIMPLE_TRANSACTION subcode for the transaction region represented by STATE.
References tm_region::get_transaction_stmt(), gimple_transaction_set_subcode(), gimple_transaction_subcode(), and tm_region::transaction_stmt.
Referenced by expand_assign_tm(), expand_call_tm(), ipa_tm_insert_gettmclone_call(), ipa_tm_insert_irr_call(), and ipa_tm_transform_transaction().
Return true if T is a volatile lvalue of some kind.
References REFERENCE_CLASS_P, SSA_VAR_P, TREE_THIS_VOLATILE, and TREE_TYPE.
Referenced by diagnose_tm_1_op(), and ipa_tm_scan_irr_block().
|
static |
bool pending_edge_inserts_p |
True if there are pending edge statements to be committed for the current function being scanned in the tmmark pass.
Referenced by execute_tm_mark(), and expand_call_tm().
|
static |
The actual log.
Referenced by tm_log_add(), tm_log_delete(), tm_log_emit(), tm_log_emit_restores(), tm_log_emit_saves(), and tm_log_init().
Addresses to log with a save/restore sequence. These should be in dominator order.
Referenced by expand_transaction(), tm_log_add(), tm_log_delete(), tm_log_emit_restores(), tm_log_emit_saves(), and tm_log_init().
|
static |
Referenced by execute_tm_memopt(), and tm_memopt_init_sets().
|
static |
Unique counter for TM loads and stores. Loads and stores of the same address get the same ID.
Referenced by execute_tm_memopt(), and tm_memopt_value_number().
|
static |
Referenced by dump_tm_memopt_set(), execute_tm_memopt(), and tm_memopt_value_number().
|
static |
Map for an SSA_NAME originally pointing to a non aliased new piece of memory (malloc, alloc, etc).
Referenced by thread_private_new_memory(), tm_log_delete(), and tm_log_init().
|
static |
|
static |
Referenced by find_tm_replacement_function(), and record_tm_replacement().