diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-05-25 14:00:28 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-05-25 14:00:28 +0000 |
commit | ea292448322b87fcd3f8da04467420b49f609053 (patch) | |
tree | ad069168b45b5aa8b35d5e2c20ccbc3558fcf80d /gcc/ada/gcc-interface/decl.c | |
parent | 288cbbbdacf90e3da12df2fd0cffba69f66369ac (diff) | |
download | gcc-ea292448322b87fcd3f8da04467420b49f609053.zip gcc-ea292448322b87fcd3f8da04467420b49f609053.tar.gz gcc-ea292448322b87fcd3f8da04467420b49f609053.tar.bz2 |
ada-tree.h (DECL_RENAMING_GLOBAL_P): Rename into...
* gcc-interface/ada-tree.h (DECL_RENAMING_GLOBAL_P): Rename into...
(DECL_GLOBAL_NONCONSTANT_RENAMING_P): ...this.
* gcc-interface/gigi.h (record_global_renaming_pointer): Delete.
(invalidate_global_renaming_pointers): Likewise.
(record_global_nonconstant_renaming): New.
(invalidate_global_nonconstant_renamings): Likewise.
(get_inner_constant_reference): Likewise.
(gnat_constant_reference_p): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Adjust to above
and register the renaming pointer only if the object is non-constant.
(elaborate_expression_1): Call get_inner_constant_reference instead
of get_inner_reference.
* gcc-interface/trans.c (fold_constant_decl_in_expr): Minor tweak.
(Identifier_to_gnu): Adjust to above and do not recheck the renamed
object before substituting it.
(Compilation_Unit_to_gnu): Adjust to above renaming. Minor tweaks.
(gnat_to_gnu) <N_Object_Renaming_Declaration>: Do not return the
result at the global level.
(N_Exception_Renaming_Declaration): Likewise.
* gcc-interface/utils.c (global_renaming_pointers): Rename into...
(global_nonconstant_renamings): ...this.
(destroy_gnat_utils): Adjust to above renaming.
(record_global_renaming_pointer): Rename into...
(record_global_nonconstant_renaming): ...this.
(invalidate_global_renaming_pointers): Rename into...
(invalidate_global_nonconstant_renamings): ...this and do not recheck
the renamed object before invalidating.
* gcc-interface/utils2.c (gnat_stabilize_reference): Minor tweak.
(get_inner_constant_reference): New public function.
(gnat_constant_reference_p): New predicate.
From-SVN: r223644
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index d908a1b..7480593 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1517,15 +1517,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) DECL_LOOP_PARM_P (gnu_decl) = 1; /* If this is a renaming pointer, attach the renamed object to it and - register it if we are at the global level. Note that an external - constant is at the global level. */ + register it if we are at the global level and the renamed object + is a non-constant reference. Note that an external constant is at + the global level. */ if (renamed_obj) { SET_DECL_RENAMED_OBJECT (gnu_decl, renamed_obj); - if ((!definition && kind == E_Constant) || global_bindings_p ()) + + if (((!definition && kind == E_Constant) || global_bindings_p ()) + && !gnat_constant_reference_p (renamed_obj)) { - DECL_RENAMING_GLOBAL_P (gnu_decl) = 1; - record_global_renaming_pointer (gnu_decl); + DECL_GLOBAL_NONCONSTANT_RENAMING_P (gnu_decl) = 1; + record_global_nonconstant_renaming (gnu_decl); } } @@ -6245,18 +6248,7 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, inner = skip_simple_constant_arithmetic (inner); if (handled_component_p (inner)) - { - HOST_WIDE_INT bitsize, bitpos; - tree offset; - machine_mode mode; - int unsignedp, volatilep; - - inner = get_inner_reference (inner, &bitsize, &bitpos, &offset, - &mode, &unsignedp, &volatilep, false); - /* If the offset is variable, err on the side of caution. */ - if (offset) - inner = NULL_TREE; - } + inner = get_inner_constant_reference (inner); expr_variable_p = !(inner |