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>
* 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.
(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
......
......@@ -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_gnu_expr_location_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 create_init_temporary (const char *, tree, tree *, Node_Id);
......@@ -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.
CONSTANT indicates whether the underlying object represented by GNAT_NODE
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
aliased. If it isn't, ADDRESS_OF_CONSTANT and ALIASED are ignored.
whether its value is the address of another constant. If it isn't, then
ADDRESS_OF_CONSTANT is ignored.
The function climbs up the GNAT tree starting from the node and returns 1
upon encountering a node that effectively requires an lvalue downstream.
......@@ -816,7 +816,7 @@ lvalue_required_for_attribute_p (Node_Id gnat_node)
static int
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;
......@@ -861,14 +861,12 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
if (Prefix (gnat_parent) != gnat_node)
return 0;
aliased |= Has_Aliased_Components (Etype (gnat_node));
return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased);
address_of_constant);
case N_Selected_Component:
aliased |= Is_Aliased (Entity (Selector_Name (gnat_parent)));
return lvalue_required_p (gnat_parent, gnu_type, constant,
address_of_constant, aliased);
address_of_constant);
case N_Object_Renaming_Declaration:
/* We need to preserve addresses through a renaming. */
......@@ -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. */
return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)),
constant, address_of_constant, aliased);
constant, address_of_constant);
case N_Allocator:
/* 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,
if (constant && address_of_constant)
return lvalue_required_p (gnat_parent,
get_unpadded_type (Etype (gnat_parent)),
true, false, true);
true, false);
/* ... fall through ... */
......@@ -1123,8 +1121,8 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
&& !Is_Imported (gnat_temp)
&& Present (Address_Clause (gnat_temp)))
{
require_lvalue = lvalue_required_p (gnat_node, gnu_result_type, true,
false, Is_Aliased (gnat_temp));
require_lvalue
= lvalue_required_p (gnat_node, gnu_result_type, true, false);
use_constant_initializer = !require_lvalue;
}
......@@ -1161,7 +1159,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
else if (TREE_CODE (gnu_result) == CONST_DECL
&& !(DECL_CONST_ADDRESS_P (gnu_result)
&& lvalue_required_p (gnat_node, gnu_result_type, true,
true, false)))
true)))
gnu_result = DECL_INITIAL (gnu_result);
/* 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)
if ((!constant_only || address_of_constant) && require_lvalue < 0)
require_lvalue
= 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. */
if ((constant_only && !address_of_constant) || !require_lvalue)
......@@ -1217,8 +1215,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
{
if (require_lvalue < 0)
require_lvalue
= lvalue_required_p (gnat_node, gnu_result_type, true, false,
Is_Aliased (gnat_temp));
= lvalue_required_p (gnat_node, gnu_result_type, true, false);
if (!require_lvalue)
gnu_result = fold_constant_decl_in_expr (gnu_result);
}
......@@ -7860,7 +7857,7 @@ gnat_to_gnu (Node_Id gnat_node)
|| kind == N_Indexed_Component
|| kind == N_Selected_Component)
&& 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
= 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