aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2020-06-23 18:02:07 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2020-06-23 18:35:46 +0200
commit5bdd063b9d8082cb8c8ede2721f1f425d3b952f0 (patch)
treeac5e1dccfac67272224c2b532db82f4c076a4162 /gcc/ada/gcc-interface/trans.c
parentcd42cdc225a905cb1eb38dfad453e654261a659e (diff)
downloadgcc-5bdd063b9d8082cb8c8ede2721f1f425d3b952f0.zip
gcc-5bdd063b9d8082cb8c8ede2721f1f425d3b952f0.tar.gz
gcc-5bdd063b9d8082cb8c8ede2721f1f425d3b952f0.tar.bz2
Streamline implementation of renaming in gigi
The main changes are 1) the bulk of the implementation is put back entirely in gnat_to_gnu_entity and 2) the handling of lvalues is unified, i.e. it no longer depends on the Materialize_Entity flag being present on the entity. gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (DECL_RENAMED_OBJECT): Delete. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Always use the stabilized reference directly for renaming and create a variable pointing to it separately if requested. * gcc-interface/misc.c (gnat_print_decl): Adjust for deletion. * gcc-interface/trans.c (Identifier_to_gnu): Likewise. (gnat_to_gnu) <N_Object_Renaming_Declaration>: Do not deal with side-effects here. <N_Exception_Renaming_Declaration>: Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index a64b6d0..c32bdb9 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -1249,25 +1249,16 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
true)))
gnu_result = DECL_INITIAL (gnu_result);
- /* If it's a renaming pointer, get to the renamed object. */
- if (TREE_CODE (gnu_result) == VAR_DECL
- && !DECL_LOOP_PARM_P (gnu_result)
- && DECL_RENAMED_OBJECT (gnu_result))
- gnu_result = DECL_RENAMED_OBJECT (gnu_result);
-
- /* Otherwise, do the final dereference. */
- else
- {
- gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
+ /* Do the final dereference. */
+ gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
- if ((TREE_CODE (gnu_result) == INDIRECT_REF
- || TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF)
- && No (Address_Clause (gnat_entity)))
- TREE_THIS_NOTRAP (gnu_result) = 1;
+ if ((TREE_CODE (gnu_result) == INDIRECT_REF
+ || TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF)
+ && No (Address_Clause (gnat_entity)))
+ TREE_THIS_NOTRAP (gnu_result) = 1;
- if (read_only)
- TREE_READONLY (gnu_result) = 1;
- }
+ if (read_only)
+ TREE_READONLY (gnu_result) = 1;
}
/* If we have a constant declaration and its initializer, try to return the
@@ -6543,31 +6534,19 @@ gnat_to_gnu (Node_Id gnat_node)
&& (Is_Array_Type (Etype (gnat_temp))
|| Is_Record_Type (Etype (gnat_temp))
|| Is_Concurrent_Type (Etype (gnat_temp)))))
- {
- tree gnu_temp
- = gnat_to_gnu_entity (gnat_temp,
- gnat_to_gnu (Renamed_Object (gnat_temp)),
- true);
- /* See case 2 of renaming in gnat_to_gnu_entity. */
- if (TREE_SIDE_EFFECTS (gnu_temp))
- gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp);
- }
+ gnat_to_gnu_entity (gnat_temp,
+ gnat_to_gnu (Renamed_Object (gnat_temp)),
+ true);
break;
case N_Exception_Renaming_Declaration:
gnat_temp = Defining_Entity (gnat_node);
gnu_result = alloc_stmt_list ();
- /* See the above case for the rationale. */
if (Present (Renamed_Entity (gnat_temp)))
- {
- tree gnu_temp
- = gnat_to_gnu_entity (gnat_temp,
- gnat_to_gnu (Renamed_Entity (gnat_temp)),
- true);
- if (TREE_SIDE_EFFECTS (gnu_temp))
- gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_temp);
- }
+ gnat_to_gnu_entity (gnat_temp,
+ gnat_to_gnu (Renamed_Entity (gnat_temp)),
+ true);
break;
case N_Subprogram_Renaming_Declaration: