Commit 491f54a7 by Eric Botcazou Committed by Eric Botcazou

ada-tree.h (DECL_BY_DOUBLE_REF_P): Delete.

	* gcc-interface/ada-tree.h (DECL_BY_DOUBLE_REF_P): Delete.
	* gcc-interface/gigi.h (annotate_object): Adjust prototype.
	(convert_vms_descriptor): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_param): Do not pass fat pointer
	types by double dereference.
	(annotate_object): Remove BY_DOUBLE_REF parameter and adjust.
	(gnat_to_gnu_entity): Adjust calls to annotate_object.
	* gcc-interface/trans.c (Identifier_to_gnu): Do not deal with double
	dereference.
	(Call_to_gnu): Likewise.
	(build_function_stub): Adjust call to convert_vms_descriptor.
	(Subprogram_Body_to_gnu): Adjust call to annotate_object.
	* gcc-interface/utils.c (convert_vms_descriptor): Remove BY_REF
	parameter and adjust.

From-SVN: r200057
parent 50751417
2013-06-13 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (DECL_BY_DOUBLE_REF_P): Delete.
* gcc-interface/gigi.h (annotate_object): Adjust prototype.
(convert_vms_descriptor): Likewise.
* gcc-interface/decl.c (gnat_to_gnu_param): Do not pass fat pointer
types by double dereference.
(annotate_object): Remove BY_DOUBLE_REF parameter and adjust.
(gnat_to_gnu_entity): Adjust calls to annotate_object.
* gcc-interface/trans.c (Identifier_to_gnu): Do not deal with double
dereference.
(Call_to_gnu): Likewise.
(build_function_stub): Adjust call to convert_vms_descriptor.
(Subprogram_Body_to_gnu): Adjust call to annotate_object.
* gcc-interface/utils.c (convert_vms_descriptor): Remove BY_REF
parameter and adjust.
2013-05-30 Eric Botcazou <ebotcazou@adacore.com> 2013-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/Makefile.in (arm% androideabi): Robustify. * gcc-interface/Makefile.in (arm% androideabi): Robustify.
......
...@@ -360,10 +360,6 @@ do { \ ...@@ -360,10 +360,6 @@ do { \
constant CONSTRUCTOR. */ constant CONSTRUCTOR. */
#define DECL_CONST_ADDRESS_P(NODE) DECL_LANG_FLAG_0 (CONST_DECL_CHECK (NODE)) #define DECL_CONST_ADDRESS_P(NODE) DECL_LANG_FLAG_0 (CONST_DECL_CHECK (NODE))
/* Nonzero in a PARM_DECL if it is always used by double reference, i.e. a
pair of INDIRECT_REFs is needed to access the object. */
#define DECL_BY_DOUBLE_REF_P(NODE) DECL_LANG_FLAG_0 (PARM_DECL_CHECK (NODE))
/* Nonzero in a FIELD_DECL if it is declared as aliased. */ /* Nonzero in a FIELD_DECL if it is declared as aliased. */
#define DECL_ALIASED_P(NODE) DECL_LANG_FLAG_0 (FIELD_DECL_CHECK (NODE)) #define DECL_ALIASED_P(NODE) DECL_LANG_FLAG_0 (FIELD_DECL_CHECK (NODE))
......
...@@ -1025,7 +1025,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1025,7 +1025,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
save_gnu_tree (gnat_entity, gnu_decl, true); save_gnu_tree (gnat_entity, gnu_decl, true);
saved = true; saved = true;
annotate_object (gnat_entity, gnu_type, NULL_TREE, annotate_object (gnat_entity, gnu_type, NULL_TREE,
false, false); false);
/* This assertion will fail if the renamed object /* This assertion will fail if the renamed object
isn't aligned enough as to make it possible to isn't aligned enough as to make it possible to
honor the alignment set on the renaming. */ honor the alignment set on the renaming. */
...@@ -1604,7 +1604,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1604,7 +1604,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
type of the object and not on the object directly, and makes it type of the object and not on the object directly, and makes it
possible to support all confirming representation clauses. */ possible to support all confirming representation clauses. */
annotate_object (gnat_entity, TREE_TYPE (gnu_decl), gnu_object_size, annotate_object (gnat_entity, TREE_TYPE (gnu_decl), gnu_object_size,
used_by_ref, false); used_by_ref);
} }
break; break;
...@@ -5650,7 +5650,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, ...@@ -5650,7 +5650,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
/* The parameter can be indirectly modified if its address is taken. */ /* The parameter can be indirectly modified if its address is taken. */
bool ro_param = in_param && !Address_Taken (gnat_param); bool ro_param = in_param && !Address_Taken (gnat_param);
bool by_return = false, by_component_ptr = false; bool by_return = false, by_component_ptr = false;
bool by_ref = false, by_double_ref = false; bool by_ref = false;
tree gnu_param; tree gnu_param;
/* Copy-return is used only for the first parameter of a valued procedure. /* Copy-return is used only for the first parameter of a valued procedure.
...@@ -5775,19 +5775,6 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, ...@@ -5775,19 +5775,6 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
gnu_param_type gnu_param_type
= build_qualified_type (gnu_param_type, TYPE_QUAL_RESTRICT); = build_qualified_type (gnu_param_type, TYPE_QUAL_RESTRICT);
by_ref = true; by_ref = true;
/* In some ABIs, e.g. SPARC 32-bit, fat pointer types are themselves
passed by reference. Pass them by explicit reference, this will
generate more debuggable code at -O0. */
if (TYPE_IS_FAT_POINTER_P (gnu_param_type)
&& targetm.calls.pass_by_reference (pack_cumulative_args (NULL),
TYPE_MODE (gnu_param_type),
gnu_param_type,
true))
{
gnu_param_type = build_reference_type (gnu_param_type);
by_double_ref = true;
}
} }
/* Pass In Out or Out parameters using copy-in copy-out mechanism. */ /* Pass In Out or Out parameters using copy-in copy-out mechanism. */
...@@ -5830,7 +5817,6 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, ...@@ -5830,7 +5817,6 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
gnu_param = create_param_decl (gnu_param_name, gnu_param_type, gnu_param = create_param_decl (gnu_param_name, gnu_param_type,
ro_param || by_ref || by_component_ptr); ro_param || by_ref || by_component_ptr);
DECL_BY_REF_P (gnu_param) = by_ref; DECL_BY_REF_P (gnu_param) = by_ref;
DECL_BY_DOUBLE_REF_P (gnu_param) = by_double_ref;
DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr; DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr;
DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor || DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor ||
mech == By_Short_Descriptor); mech == By_Short_Descriptor);
...@@ -7554,18 +7540,13 @@ annotate_value (tree gnu_size) ...@@ -7554,18 +7540,13 @@ annotate_value (tree gnu_size)
/* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception)
and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the
size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null.
BY_REF is true if the object is used by reference and BY_DOUBLE_REF is BY_REF is true if the object is used by reference. */
true if the object is used by double reference. */
void void
annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, bool by_ref, annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, bool by_ref)
bool by_double_ref)
{ {
if (by_ref) if (by_ref)
{ {
if (by_double_ref)
gnu_type = TREE_TYPE (gnu_type);
if (TYPE_IS_FAT_POINTER_P (gnu_type)) if (TYPE_IS_FAT_POINTER_P (gnu_type))
gnu_type = TYPE_UNCONSTRAINED_ARRAY (gnu_type); gnu_type = TYPE_UNCONSTRAINED_ARRAY (gnu_type);
else else
......
...@@ -178,10 +178,9 @@ extern tree choices_to_gnu (tree operand, Node_Id choices); ...@@ -178,10 +178,9 @@ extern tree choices_to_gnu (tree operand, Node_Id choices);
/* Given GNAT_ENTITY, an object (constant, variable, parameter, exception) /* Given GNAT_ENTITY, an object (constant, variable, parameter, exception)
and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the and GNU_TYPE, its corresponding GCC type, set Esize and Alignment to the
size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null. size and alignment used by Gigi. Prefer SIZE over TYPE_SIZE if non-null.
BY_REF is true if the object is used by reference and BY_DOUBLE_REF is BY_REF is true if the object is used by reference. */
true if the object is used by double reference. */
extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size,
bool by_ref, bool by_double_ref); bool by_ref);
/* Return the variant part of RECORD_TYPE, if any. Otherwise return NULL. */ /* Return the variant part of RECORD_TYPE, if any. Otherwise return NULL. */
extern tree get_variant_part (tree record_type); extern tree get_variant_part (tree record_type);
...@@ -953,11 +952,10 @@ extern tree fill_vms_descriptor (tree gnu_type, tree gnu_expr, ...@@ -953,11 +952,10 @@ extern tree fill_vms_descriptor (tree gnu_type, tree gnu_expr,
/* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular /* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular
pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit) pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit)
pointer type of GNU_EXPR. BY_REF is true if the result is to be used by pointer type of GNU_EXPR. GNAT_SUBPROG is the subprogram to which the
reference. GNAT_SUBPROG is the subprogram to which the VMS descriptor is descriptor is passed. */
passed. */
extern tree convert_vms_descriptor (tree gnu_type, tree gnu_expr, extern tree convert_vms_descriptor (tree gnu_type, tree gnu_expr,
tree gnu_expr_alt_type, bool by_ref, tree gnu_expr_alt_type,
Entity_Id gnat_subprog); Entity_Id gnat_subprog);
/* Indicate that we need to take the address of T and that it therefore /* Indicate that we need to take the address of T and that it therefore
......
...@@ -1082,19 +1082,6 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -1082,19 +1082,6 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
{ {
const bool read_only = DECL_POINTS_TO_READONLY_P (gnu_result); const bool read_only = DECL_POINTS_TO_READONLY_P (gnu_result);
/* First do the first dereference if needed. */
if (TREE_CODE (gnu_result) == PARM_DECL
&& DECL_BY_DOUBLE_REF_P (gnu_result))
{
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
if (TREE_CODE (gnu_result) == INDIRECT_REF)
TREE_THIS_NOTRAP (gnu_result) = 1;
/* The first reference, in case of a double reference, always points
to read-only, see gnat_to_gnu_param for the rationale. */
TREE_READONLY (gnu_result) = 1;
}
/* If it's a PARM_DECL to foreign convention subprogram, convert it. */ /* If it's a PARM_DECL to foreign convention subprogram, convert it. */
if (TREE_CODE (gnu_result) == PARM_DECL if (TREE_CODE (gnu_result) == PARM_DECL
&& DECL_BY_COMPONENT_PTR_P (gnu_result)) && DECL_BY_COMPONENT_PTR_P (gnu_result))
...@@ -3375,7 +3362,6 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) ...@@ -3375,7 +3362,6 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
= convert_vms_descriptor (TREE_TYPE (gnu_subprog_param), = convert_vms_descriptor (TREE_TYPE (gnu_subprog_param),
gnu_stub_param, gnu_stub_param,
DECL_PARM_ALT_TYPE (gnu_stub_param), DECL_PARM_ALT_TYPE (gnu_stub_param),
DECL_BY_DOUBLE_REF_P (gnu_subprog_param),
gnat_subprog); gnat_subprog);
} }
else else
...@@ -3670,8 +3656,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) ...@@ -3670,8 +3656,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL); bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL);
annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE, annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE,
DECL_BY_REF_P (gnu_param), DECL_BY_REF_P (gnu_param));
!is_var_decl && DECL_BY_DOUBLE_REF_P (gnu_param));
if (is_var_decl) if (is_var_decl)
save_gnu_tree (gnat_param, NULL_TREE, false); save_gnu_tree (gnat_param, NULL_TREE, false);
...@@ -4133,12 +4118,6 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, ...@@ -4133,12 +4118,6 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
/* The symmetry of the paths to the type of an entity is broken here /* The symmetry of the paths to the type of an entity is broken here
since arguments don't know that they will be passed by ref. */ since arguments don't know that they will be passed by ref. */
gnu_formal_type = TREE_TYPE (gnu_formal); gnu_formal_type = TREE_TYPE (gnu_formal);
if (DECL_BY_DOUBLE_REF_P (gnu_formal))
gnu_actual
= build_unary_op (ADDR_EXPR, TREE_TYPE (gnu_formal_type),
gnu_actual);
gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual);
} }
else if (is_true_formal_parm && DECL_BY_COMPONENT_PTR_P (gnu_formal)) else if (is_true_formal_parm && DECL_BY_COMPONENT_PTR_P (gnu_formal))
......
...@@ -4096,33 +4096,25 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog) ...@@ -4096,33 +4096,25 @@ convert_vms_descriptor32 (tree gnu_type, tree gnu_expr, Entity_Id gnat_subprog)
/* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular /* Convert GNU_EXPR, a pointer to a VMS descriptor, to GNU_TYPE, a regular
pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit) pointer or fat pointer type. GNU_EXPR_ALT_TYPE is the alternate (32-bit)
pointer type of GNU_EXPR. BY_REF is true if the result is to be used by pointer type of GNU_EXPR. GNAT_SUBPROG is the subprogram to which the
reference. GNAT_SUBPROG is the subprogram to which the VMS descriptor is descriptor is passed. */
passed. */
tree tree
convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type, convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type,
bool by_ref, Entity_Id gnat_subprog) Entity_Id gnat_subprog)
{ {
tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr)); tree desc_type = TREE_TYPE (TREE_TYPE (gnu_expr));
tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr); tree desc = build1 (INDIRECT_REF, desc_type, gnu_expr);
tree mbo = TYPE_FIELDS (desc_type); tree mbo = TYPE_FIELDS (desc_type);
const char *mbostr = IDENTIFIER_POINTER (DECL_NAME (mbo)); const char *mbostr = IDENTIFIER_POINTER (DECL_NAME (mbo));
tree mbmo = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (mbo))); tree mbmo = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (mbo)));
tree real_type, is64bit, gnu_expr32, gnu_expr64; tree is64bit, gnu_expr32, gnu_expr64;
if (by_ref)
real_type = TREE_TYPE (gnu_type);
else
real_type = gnu_type;
/* If the field name is not MBO, it must be 32-bit and no alternate. /* If the field name is not MBO, it must be 32-bit and no alternate.
Otherwise primary must be 64-bit and alternate 32-bit. */ Otherwise primary must be 64-bit and alternate 32-bit. */
if (strcmp (mbostr, "MBO") != 0) if (strcmp (mbostr, "MBO") != 0)
{ {
tree ret = convert_vms_descriptor32 (real_type, gnu_expr, gnat_subprog); tree ret = convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog);
if (by_ref)
ret = build_unary_op (ADDR_EXPR, gnu_type, ret);
return ret; return ret;
} }
...@@ -4139,14 +4131,9 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type, ...@@ -4139,14 +4131,9 @@ convert_vms_descriptor (tree gnu_type, tree gnu_expr, tree gnu_expr_alt_type,
integer_minus_one_node)); integer_minus_one_node));
/* Build the 2 possible end results. */ /* Build the 2 possible end results. */
gnu_expr64 = convert_vms_descriptor64 (real_type, gnu_expr, gnat_subprog); gnu_expr64 = convert_vms_descriptor64 (gnu_type, gnu_expr, gnat_subprog);
if (by_ref)
gnu_expr64 = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr64);
gnu_expr = fold_convert (gnu_expr_alt_type, gnu_expr); gnu_expr = fold_convert (gnu_expr_alt_type, gnu_expr);
gnu_expr32 = convert_vms_descriptor32 (real_type, gnu_expr, gnat_subprog); gnu_expr32 = convert_vms_descriptor32 (gnu_type, gnu_expr, gnat_subprog);
if (by_ref)
gnu_expr32 = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr32);
return build3 (COND_EXPR, gnu_type, is64bit, gnu_expr64, gnu_expr32); return build3 (COND_EXPR, gnu_type, is64bit, gnu_expr64, gnu_expr32);
} }
......
...@@ -439,7 +439,7 @@ package Targparm is ...@@ -439,7 +439,7 @@ package Targparm is
-- the source program may not contain explicit 64-bit shifts. In addition, -- the source program may not contain explicit 64-bit shifts. In addition,
-- the code generated for packed arrays will avoid the use of long shifts. -- the code generated for packed arrays will avoid the use of long shifts.
Support_Nondefault_SSO_On_Target : Boolean := False; Support_Nondefault_SSO_On_Target : Boolean := True;
-- If True, the back end supports the non-default Scalar_Storage_Order -- If True, the back end supports the non-default Scalar_Storage_Order
-- (i.e. allows non-confirming Scalar_Storage_Order attribute definition -- (i.e. allows non-confirming Scalar_Storage_Order attribute definition
-- clauses). -- clauses).
......
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