diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-05-26 19:40:18 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-05-26 19:40:18 +0000 |
commit | 241125b2a1e4d1a694cd54c20ce2d7d5304448b3 (patch) | |
tree | 327efcc70b8f4f364b4effa1ab951f534b11e419 /gcc/ada/gcc-interface/gigi.h | |
parent | 7194767cdf77212e8c736f41b426e3f636f52ca3 (diff) | |
download | gcc-241125b2a1e4d1a694cd54c20ce2d7d5304448b3.zip gcc-241125b2a1e4d1a694cd54c20ce2d7d5304448b3.tar.gz gcc-241125b2a1e4d1a694cd54c20ce2d7d5304448b3.tar.bz2 |
ada-tree.h (DECL_GLOBAL_NONCONSTANT_RENAMING_P): Delete
* gcc-interface/ada-tree.h (DECL_GLOBAL_NONCONSTANT_RENAMING_P): Delete
(DECL_RENAMED_OBJECT): Adjust comment.
* gcc-interface/gigi.h (record_global_nonconstant_renaming): Delete.
(invalidate_global_nonconstant_renamings): Likewise.
(gnat_constant_reference_p): Likewise.
(rewrite_fn): New function type.
(gnat_rewrite_reference): Declare.
(call_is_atomic_load): New inline predicate.
* gcc-interface/decl.c (elaborate_reference_1): New function.
(elaborate_reference): Likewise.
(gnat_to_gnu_entity): Call elaborate_reference to elaborate renamings
and simplify associated code. Set const_flag to true consistently in
conjunction with used_by_ref.
* gcc-interface/trans.c (Identifier_to_gnu): Always replace renaming
pointers by renamed objects.
(outer_atomic_access_required_p): Deal with renamings.
(Compilation_Unit_to_gnu): Do not call
invalidate_global_nonconstant_renamings.
(gnat_to_gnu) <N_Object_Renaming_Declaration>: Adjust comment.
(gnat_gimplify_expr): Deal with atomic loads.
* gcc-interface/utils.c (global_nonconstant_renamings): Delete.
(destroy_gnat_utils): Do not call
invalidate_global_nonconstant_renamings.
(record_global_nonconstant_renaming): Delete.
(invalidate_global_nonconstant_renamings): Likewise.
* gcc-interface/utils2.c (call_is_atomic_load): Move to gigi.h.
(build_load_modify_store): Build a copy of the destination.
(gnat_stabilize_reference_1): Adjust.
(gnat_stabilize_reference): Call gnat_stabilize_reference_1 through
gnat_rewrite_reference and move bulk of code to...
(gnat_rewrite_reference): ...here. New global function.
(gnat_constant_reference_p): Delete.
From-SVN: r223709
Diffstat (limited to 'gcc/ada/gcc-interface/gigi.h')
-rw-r--r-- | gcc/ada/gcc-interface/gigi.h | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index 2a964d2..b75cc35 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -712,12 +712,6 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, const_flag, public_flag, extern_flag, \ static_flag, false, attr_list, gnat_node) -/* Record DECL as a global non-constant renaming. */ -extern void record_global_nonconstant_renaming (tree decl); - -/* Invalidate the global non-constant renamings. */ -extern void invalidate_global_nonconstant_renamings (void); - /* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is its type and RECORD_TYPE is the type of the enclosing record. If SIZE is nonzero, it is the specified size of the field. If POS is nonzero, it is @@ -968,15 +962,19 @@ extern tree gnat_protect_expr (tree exp); force evaluation of everything. */ extern tree gnat_stabilize_reference (tree ref, bool force); +/* Rewrite reference REF and call FUNC on each expression within REF in the + process. DATA is passed unmodified to FUNC and N is bumped each time it + is passed to FUNC, so FUNC is guaranteed to see a given N only once per + reference to be rewritten. */ +typedef tree (*rewrite_fn) (tree, void *, int); +extern tree gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, + int n = 1); + /* This is equivalent to get_inner_reference in expr.c but it returns the ultimate containing object only if the reference (lvalue) is constant, i.e. if it doesn't depend on the context in which it is evaluated. */ extern tree get_inner_constant_reference (tree exp); -/* Return true if REF is a constant reference, i.e. a reference (lvalue) that - doesn't depend on the context in which it is evaluated. */ -extern bool gnat_constant_reference_p (tree ref); - /* If EXPR is an expression that is invariant in the current function, in the sense that it can be evaluated anywhere in the function and any number of times, return EXPR or an equivalent expression. Otherwise return NULL. */ @@ -1073,3 +1071,17 @@ ceil_pow2 (unsigned HOST_WIDE_INT x) { return (unsigned HOST_WIDE_INT) 1 << (floor_log2 (x - 1) + 1); } + +/* Return true if EXP, a CALL_EXPR, is an atomic load. */ + +static inline bool +call_is_atomic_load (tree exp) +{ + tree fndecl = get_callee_fndecl (exp); + + if (!(fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)) + return false; + + enum built_in_function code = DECL_FUNCTION_CODE (fndecl); + return BUILT_IN_ATOMIC_LOAD_N <= code && code <= BUILT_IN_ATOMIC_LOAD_16; +} |