Mercurial > hg > CbC > CbC_gcc
diff gcc/trans-mem.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line diff
--- a/gcc/trans-mem.c Thu Oct 25 07:37:49 2018 +0900 +++ b/gcc/trans-mem.c Thu Feb 13 11:34:05 2020 +0900 @@ -1,5 +1,5 @@ /* Passes for transactional memory support. - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2020 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com> and Aldy Hernandez <aldyh@redhat.com>. @@ -46,7 +46,6 @@ #include "demangle.h" #include "output.h" #include "trans-mem.h" -#include "params.h" #include "langhooks.h" #include "cfgloop.h" #include "tree-ssa-address.h" @@ -265,20 +264,7 @@ static bool is_tm_pure_call (gimple *call) { - if (gimple_call_internal_p (call)) - return (gimple_call_flags (call) & (ECF_CONST | ECF_TM_PURE)) != 0; - - tree fn = gimple_call_fn (call); - - if (TREE_CODE (fn) == ADDR_EXPR) - { - fn = TREE_OPERAND (fn, 0); - gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); - } - else - fn = TREE_TYPE (fn); - - return is_tm_pure (fn); + return (gimple_call_flags (call) & (ECF_CONST | ECF_TM_PURE)) != 0; } /* Return true if X has been marked TM_CALLABLE. */ @@ -767,10 +753,10 @@ Either that or get the language spec to resurrect __tm_waiver. */ if (d->block_flags & DIAG_TM_SAFE) error_at (gimple_location (stmt), - "asm not allowed in atomic transaction"); + "%<asm%> not allowed in atomic transaction"); else if (d->func_flags & DIAG_TM_SAFE) error_at (gimple_location (stmt), - "asm not allowed in %<transaction_safe%> function"); + "%<asm%> not allowed in %<transaction_safe%> function"); break; case GIMPLE_TRANSACTION: @@ -1121,7 +1107,7 @@ && TYPE_SIZE_UNIT (type) != NULL && tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)) && ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE_UNIT (type)) - < PARAM_VALUE (PARAM_TM_MAX_AGGREGATE_SIZE)) + < param_tm_max_aggregate_size) /* We must be able to copy this type normally. I.e., no special constructors and the like. */ && !TREE_ADDRESSABLE (type)) @@ -2554,12 +2540,12 @@ gimple_call_set_fndecl (stmt, repl); update_stmt (stmt); node = cgraph_node::create (repl); - node->local.tm_may_enter_irr = false; + node->tm_may_enter_irr = false; return expand_call_tm (region, gsi); } gcc_unreachable (); } - if (node->local.tm_may_enter_irr) + if (node->tm_may_enter_irr) transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE); if (is_tm_abort (fn_decl)) @@ -3250,8 +3236,7 @@ || (gimple_call_flags (call_stmt) & ECF_TM_BUILTIN) == 0) continue; - if (DECL_FUNCTION_CODE (gimple_call_fndecl (call_stmt)) - == BUILT_IN_TM_ABORT) + if (gimple_call_builtin_p (call_stmt, BUILT_IN_TM_ABORT)) { // If we have a ``_transaction_cancel [[outer]]'', there is only // one abnormal edge: to the transaction marked OUTER. @@ -3721,9 +3706,9 @@ /* Allocate a worklist array/queue. Entries are only added to the list if they were not already on the list. So the size is bounded by the number of basic blocks in the region. */ + gcc_assert (!blocks.is_empty ()); qlen = blocks.length () - 1; - qin = qout = worklist = - XNEWVEC (basic_block, qlen); + qin = qout = worklist = XNEWVEC (basic_block, qlen); /* Put every block in the region on the worklist. */ for (i = 0; blocks.iterate (i, &bb); ++i) @@ -4427,7 +4412,8 @@ { tree t = build1 (NOP_EXPR, void_type_node, size_zero_node); SET_EXPR_LOCATION (t, gimple_location (stmt)); - error ("%Kasm not allowed in %<transaction_safe%> function", t); + error ("%K%<asm%> not allowed in %<transaction_safe%> function", + t); } return true; @@ -4735,7 +4721,7 @@ /* We may have previously marked this function as tm_may_enter_irr; see pass_diagnose_tm_blocks. */ - if (node->local.tm_may_enter_irr) + if (node->tm_may_enter_irr) return true; /* Recurse on the main body for aliases. In general, this will @@ -4759,7 +4745,7 @@ for (e = node->callees; e ; e = e->next_callee) if (!is_tm_callable (e->callee->decl) - && e->callee->local.tm_may_enter_irr) + && e->callee->tm_may_enter_irr) error_at (gimple_location (e->call_stmt), "unsafe function call %qD within " "%<transaction_safe%> function", e->callee->decl); @@ -4801,7 +4787,7 @@ if (gimple_code (stmt) == GIMPLE_ASM) { error_at (gimple_location (stmt), - "asm not allowed in atomic transaction"); + "%<asm%> not allowed in atomic transaction"); continue; } @@ -4827,7 +4813,7 @@ if (is_tm_callable (fndecl)) continue; - if (cgraph_node::local_info (fndecl)->tm_may_enter_irr) + if (cgraph_node::local_info_node (fndecl)->tm_may_enter_irr) error_at (gimple_location (stmt), "unsafe function call %qD within " "atomic transaction", fndecl); @@ -4859,7 +4845,7 @@ if (dc == NULL) { - char length[8]; + char length[12]; do_unencoded: sprintf (length, "%u", IDENTIFIER_LENGTH (old_asm_id)); @@ -5002,7 +4988,7 @@ gcc_assert (!old_node->ipa_transforms_to_apply.exists ()); new_node = old_node->create_version_clone (new_decl, vNULL, NULL); - new_node->local.local = false; + new_node->local = false; new_node->externally_visible = old_node->externally_visible; new_node->lowered = true; new_node->tm_clone = 1; @@ -5022,8 +5008,7 @@ } tree_function_versioning (old_decl, new_decl, - NULL, false, NULL, - false, NULL, NULL); + NULL, NULL, false, NULL, NULL); } record_tm_clone_pair (old_decl, new_decl); @@ -5223,7 +5208,7 @@ CALLER. Also note that find_tm_replacement_function also contains mappings into the TM runtime, e.g. memcpy. These we know won't go irrevocable. */ - new_node->local.tm_may_enter_irr = 1; + new_node->tm_may_enter_irr = 1; } else { @@ -5431,7 +5416,7 @@ No need to do this if the function's address can't be taken. */ if (is_tm_pure (node->decl)) { - if (!node->local.local) + if (!node->local) record_tm_clone_pair (node->decl, node->decl); continue; } @@ -5558,14 +5543,14 @@ node = irr_worklist[i]; d = get_cg_data (&node, true); d->in_worklist = false; - node->local.tm_may_enter_irr = true; + node->tm_may_enter_irr = true; /* Propagate back to normal callers. */ for (e = node->callers; e ; e = e->next_caller) { caller = e->caller; if (!is_tm_safe_or_pure (caller->decl) - && !caller->local.tm_may_enter_irr) + && !caller->tm_may_enter_irr) { d = get_cg_data (&caller, true); maybe_push_queue (caller, &irr_worklist, &d->in_worklist); @@ -5576,7 +5561,7 @@ FOR_EACH_ALIAS (node, ref) { caller = dyn_cast<cgraph_node *> (ref->referring); - if (!caller->local.tm_may_enter_irr) + if (!caller->tm_may_enter_irr) { /* ?? Do not traverse aliases here. */ d = get_cg_data (&caller, false);