Commit 86da71db by Eric Botcazou Committed by Eric Botcazou

trans.c (lvalue_required_p): Remove ALIASED parameter and adjust recursive calls.

	* gcc-interface/trans.c (lvalue_required_p): Remove ALIASED parameter
	and adjust recursive calls.
	(Identifier_to_gnu): Adjust calls to lvalue_required_p.
	(gnat_to_gnu): Likewise.

From-SVN: r262496
parent 71836434
2018-07-07 Eric Botcazou <ebotcazou@adacore.com> 2018-07-07 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (lvalue_required_p): Remove ALIASED parameter
and adjust recursive calls.
(Identifier_to_gnu): Adjust calls to lvalue_required_p.
(gnat_to_gnu): Likewise.
2018-07-07 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_param): Minor tweak. * gcc-interface/decl.c (gnat_to_gnu_param): Minor tweak.
(gnat_to_gnu_subprog_type): New pure_flag local variable. Set it for (gnat_to_gnu_subprog_type): New pure_flag local variable. Set it for
a pure Ada function with a by-ref In parameter. Propagate it onto the a pure Ada function with a by-ref In parameter. Propagate it onto the
......
...@@ -246,7 +246,7 @@ static tree maybe_implicit_deref (tree); ...@@ -246,7 +246,7 @@ static tree maybe_implicit_deref (tree);
static void set_expr_location_from_node (tree, Node_Id, bool = false); static void set_expr_location_from_node (tree, Node_Id, bool = false);
static void set_gnu_expr_location_from_node (tree, Node_Id); static void set_gnu_expr_location_from_node (tree, Node_Id);
static bool set_end_locus_from_node (tree, Node_Id); static bool set_end_locus_from_node (tree, Node_Id);
static int lvalue_required_p (Node_Id, tree, bool, bool, bool); static int lvalue_required_p (Node_Id, tree, bool, bool);
static tree build_raise_check (int, enum exception_info_kind); static tree build_raise_check (int, enum exception_info_kind);
static tree create_init_temporary (const char *, tree, tree *, Node_Id); static tree create_init_temporary (const char *, tree, tree *, Node_Id);
...@@ -806,8 +806,8 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) ...@@ -806,8 +806,8 @@ lvalue_required_for_attribute_p (Node_Id gnat_node)
is the type that will be used for GNAT_NODE in the translated GNU tree. is the type that will be used for GNAT_NODE in the translated GNU tree.
CONSTANT indicates whether the underlying object represented by GNAT_NODE CONSTANT indicates whether the underlying object represented by GNAT_NODE
is constant in the Ada sense. If it is, ADDRESS_OF_CONSTANT indicates is constant in the Ada sense. If it is, ADDRESS_OF_CONSTANT indicates
whether its value is the address of a constant and ALIASED whether it is whether its value is the address of another constant. If it isn't, then
aliased. If it isn't, ADDRESS_OF_CONSTANT and ALIASED are ignored. ADDRESS_OF_CONSTANT is ignored.
The function climbs up the GNAT tree starting from the node and returns 1 The function climbs up the GNAT tree starting from the node and returns 1
upon encountering a node that effectively requires an lvalue downstream. upon encountering a node that effectively requires an lvalue downstream.
...@@ -816,7 +816,7 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) ...@@ -816,7 +816,7 @@ lvalue_required_for_attribute_p (Node_Id gnat_node)
static int static int
lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
bool address_of_constant, bool aliased) bool address_of_constant)
{ {
Node_Id gnat_parent = Parent (gnat_node), gnat_temp; Node_Id gnat_parent = Parent (gnat_node), gnat_temp;
...@@ -861,14 +861,12 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, ...@@ -861,14 +861,12 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
if (Prefix (gnat_parent) != gnat_node) if (Prefix (gnat_parent) != gnat_node)
return 0; return 0;
aliased |= Has_Aliased_Components (Etype (gnat_node));
return lvalue_required_p (gnat_parent, gnu_type, constant, return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased); address_of_constant);
case N_Selected_Component: case N_Selected_Component:
aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent)));
return lvalue_required_p (gnat_parent, gnu_type, constant, return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased); address_of_constant);
case N_Object_Renaming_Declaration: case N_Object_Renaming_Declaration:
/* We need to preserve addresses through a renaming. */ /* We need to preserve addresses through a renaming. */
...@@ -908,7 +906,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, ...@@ -908,7 +906,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
an intermediate conversion that is meant to be purely formal. */ an intermediate conversion that is meant to be purely formal. */
return lvalue_required_p (gnat_parent, return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)), get_unpadded_type (Etype (gnat_parent)),
constant, address_of_constant, aliased); constant, address_of_constant);
case N_Allocator: case N_Allocator:
/* We should only reach here through the N_Qualified_Expression case. /* We should only reach here through the N_Qualified_Expression case.
...@@ -922,7 +920,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant, ...@@ -922,7 +920,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
if (constant && address_of_constant) if (constant && address_of_constant)
return lvalue_required_p (gnat_parent, return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)), get_unpadded_type (Etype (gnat_parent)),
true, false, true); true, false);
/* ... fall through ... */ /* ... fall through ... */
...@@ -1123,8 +1121,8 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1123,8 +1121,8 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
&& !Is_Imported (gnat_temp) && !Is_Imported (gnat_temp)
&& Present (Address_Clause (gnat_temp))) && Present (Address_Clause (gnat_temp)))
{ {
require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true, require_lvalue
false, Is_Aliased (gnat_temp)); = lvalue_required_p (gnat_node, gnu_result_type, true, false);
use_constant_initializer = !require_lvalue; use_constant_initializer = !require_lvalue;
} }
...@@ -1161,7 +1159,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1161,7 +1159,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
else if (TREE_CODE (gnu_result) == CONST_DECL else if (TREE_CODE (gnu_result) == CONST_DECL
&& !(DECL_CONST_ADDRESS_P (gnu_result) && !(DECL_CONST_ADDRESS_P (gnu_result)
&& lvalue_required_p (gnat_node, gnu_result_type, true, && lvalue_required_p (gnat_node, gnu_result_type, true,
true, false))) true)))
gnu_result = DECL_INITIAL (gnu_result); gnu_result = DECL_INITIAL (gnu_result);
/* If it's a renaming pointer, get to the renamed object. */ /* If it's a renaming pointer, get to the renamed object. */
...@@ -1201,7 +1199,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1201,7 +1199,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
if ((!constant_only || address_of_constant) && require_lvalue < 0) if ((!constant_only || address_of_constant) && require_lvalue < 0)
require_lvalue require_lvalue
= lvalue_required_p (gnat_node, gnu_result_type, true, = lvalue_required_p (gnat_node, gnu_result_type, true,
address_of_constant, Is_Aliased (gnat_temp)); address_of_constant);
/* Finally retrieve the initializer if this is deemed valid. */ /* Finally retrieve the initializer if this is deemed valid. */
if ((constant_only && !address_of_constant) || !require_lvalue) if ((constant_only && !address_of_constant) || !require_lvalue)
...@@ -1217,8 +1215,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1217,8 +1215,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
{ {
if (require_lvalue < 0) if (require_lvalue < 0)
require_lvalue require_lvalue
= lvalue_required_p (gnat_node, gnu_result_type, true, false, = lvalue_required_p (gnat_node, gnu_result_type, true, false);
Is_Aliased (gnat_temp));
if (!require_lvalue) if (!require_lvalue)
gnu_result = fold_constant_decl_in_expr (gnu_result); gnu_result = fold_constant_decl_in_expr (gnu_result);
} }
...@@ -7860,7 +7857,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -7860,7 +7857,7 @@ gnat_to_gnu (Node_Id gnat_node)
|| kind == N_Indexed_Component || kind == N_Indexed_Component
|| kind == N_Selected_Component) || kind == N_Selected_Component)
&& TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE && TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE
&& !lvalue_required_p (gnat_node, gnu_result_type, false, false, false)) && !lvalue_required_p (gnat_node, gnu_result_type, false, false))
{ {
gnu_result gnu_result
= build_binary_op (NE_EXPR, gnu_result_type, = build_binary_op (NE_EXPR, gnu_result_type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment