Commit 57d0f7c6 by Eric Botcazou Committed by Eric Botcazou

ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from using TYPE_LANG_FLAG_4 to…

ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from using TYPE_LANG_FLAG_4 to using TYPE_LANG_FLAG_0.

	* gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from
	using TYPE_LANG_FLAG_4 to using TYPE_LANG_FLAG_0.
	(TYPE_ALIGN_OK): Move around.
	(TYPE_PADDING_FOR_COMPONENT): Remove superfluous parentheses.
	* gcc-interface/decl.c (change_qualified_type): Move to...
	(gnat_to_gnu_entity): Adjust comment.
	* gcc-interface/gigi.h (change_qualified_type): ...here; make inline.
	(ceil_pow2): Use ceil_log2.
	* gcc-interface/utils.c (finish_subprog_decl): Add couple of comments
	and do not set TREE_SIDE_EFFECTS.
	(handle_noreturn_attribute): Use change_qualified_type.

From-SVN: r261486
parent 541bb35d
2018-06-12 Eric Botcazou <ebotcazou@adacore.com> 2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from
using TYPE_LANG_FLAG_4 to using TYPE_LANG_FLAG_0.
(TYPE_ALIGN_OK): Move around.
(TYPE_PADDING_FOR_COMPONENT): Remove superfluous parentheses.
* gcc-interface/decl.c (change_qualified_type): Move to...
(gnat_to_gnu_entity): Adjust comment.
* gcc-interface/gigi.h (change_qualified_type): ...here; make inline.
(ceil_pow2): Use ceil_log2.
* gcc-interface/utils.c (finish_subprog_decl): Add couple of comments
and do not set TREE_SIDE_EFFECTS.
(handle_noreturn_attribute): Use change_qualified_type.
2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Do not get * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Do not get
the expression of a dispatch table that is not being defined. the expression of a dispatch table that is not being defined.
<E_Record_Subtype>: Remove obsolete kludge. <E_Record_Subtype>: Remove obsolete kludge.
......
...@@ -83,6 +83,12 @@ do { \ ...@@ -83,6 +83,12 @@ do { \
((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \ ((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \
&& TYPE_PACKED_ARRAY_TYPE_P (NODE)) && TYPE_PACKED_ARRAY_TYPE_P (NODE))
/* For FUNCTION_TYPEs, nonzero if the function returns by direct reference,
i.e. the callee returns a pointer to a memory location it has allocated
and the caller only needs to dereference the pointer. */
#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
TYPE_LANG_FLAG_0 (FUNCTION_TYPE_CHECK (NODE))
/* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that /* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that
is not equal to two to the power of its mode's size. */ is not equal to two to the power of its mode's size. */
#define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE)) #define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE))
...@@ -152,12 +158,6 @@ do { \ ...@@ -152,12 +158,6 @@ do { \
#define TYPE_CONVENTION_FORTRAN_P(NODE) \ #define TYPE_CONVENTION_FORTRAN_P(NODE) \
TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE)) TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE))
/* For FUNCTION_TYPEs, nonzero if the function returns by direct reference,
i.e. the callee returns a pointer to a memory location it has allocated
and the caller only needs to dereference the pointer. */
#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE))
/* For RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE, nonzero if this is a dummy /* For RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE, nonzero if this is a dummy
type, made to correspond to a private or incomplete type. */ type, made to correspond to a private or incomplete type. */
#define TYPE_DUMMY_P(NODE) \ #define TYPE_DUMMY_P(NODE) \
...@@ -186,6 +186,9 @@ do { \ ...@@ -186,6 +186,9 @@ do { \
/* True for a dummy type if TYPE appears in a profile. */ /* True for a dummy type if TYPE appears in a profile. */
#define TYPE_DUMMY_IN_PROFILE_P(NODE) TYPE_LANG_FLAG_6 (NODE) #define TYPE_DUMMY_IN_PROFILE_P(NODE) TYPE_LANG_FLAG_6 (NODE)
/* True if objects of this type are guaranteed to be properly aligned. */
#define TYPE_ALIGN_OK(NODE) TYPE_LANG_FLAG_7 (NODE)
/* True for types that implement a packed array and for original packed array /* True for types that implement a packed array and for original packed array
types. */ types. */
#define TYPE_IMPL_PACKED_ARRAY_P(NODE) \ #define TYPE_IMPL_PACKED_ARRAY_P(NODE) \
...@@ -199,9 +202,6 @@ do { \ ...@@ -199,9 +202,6 @@ do { \
alignment value the type ought to have. */ alignment value the type ought to have. */
#define TYPE_MAX_ALIGN(NODE) (TYPE_PRECISION (RECORD_OR_UNION_CHECK (NODE))) #define TYPE_MAX_ALIGN(NODE) (TYPE_PRECISION (RECORD_OR_UNION_CHECK (NODE)))
/* True if objects of tagged types are guaranteed to be properly aligned. */
#define TYPE_ALIGN_OK(NODE) TYPE_LANG_FLAG_7 (NODE)
/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the /* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
template and the object. template and the object.
...@@ -238,7 +238,7 @@ do { \ ...@@ -238,7 +238,7 @@ do { \
/* For an ARRAY_TYPE with variable size, this is the padding type built for /* For an ARRAY_TYPE with variable size, this is the padding type built for
the array type when it is itself the component type of another array. */ the array type when it is itself the component type of another array. */
#define TYPE_PADDING_FOR_COMPONENT(NODE) \ #define TYPE_PADDING_FOR_COMPONENT(NODE) \
(TYPE_LANG_SLOT_1 (ARRAY_TYPE_CHECK (NODE))) TYPE_LANG_SLOT_1 (ARRAY_TYPE_CHECK (NODE))
/* For a VECTOR_TYPE, this is the representative array type. */ /* For a VECTOR_TYPE, this is the representative array type. */
#define TYPE_REPRESENTATIVE_ARRAY(NODE) \ #define TYPE_REPRESENTATIVE_ARRAY(NODE) \
......
...@@ -210,7 +210,6 @@ static tree gnat_to_gnu_subprog_type (Entity_Id, bool, bool, tree *); ...@@ -210,7 +210,6 @@ static tree gnat_to_gnu_subprog_type (Entity_Id, bool, bool, tree *);
static int adjust_packed (tree, tree, int); static int adjust_packed (tree, tree, int);
static tree gnat_to_gnu_field (Entity_Id, tree, int, bool, bool); static tree gnat_to_gnu_field (Entity_Id, tree, int, bool, bool);
static tree gnu_ext_name_for_subprog (Entity_Id, tree); static tree gnu_ext_name_for_subprog (Entity_Id, tree);
static tree change_qualified_type (tree, int);
static void set_nonaliased_component_on_array_type (tree); static void set_nonaliased_component_on_array_type (tree);
static void set_reverse_storage_order_on_array_type (tree); static void set_reverse_storage_order_on_array_type (tree);
static bool same_discriminant_p (Entity_Id, Entity_Id); static bool same_discriminant_p (Entity_Id, Entity_Id);
...@@ -4447,7 +4446,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) ...@@ -4447,7 +4446,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* If this is not an unconstrained array type, set some flags. */ /* If this is not an unconstrained array type, set some flags. */
if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE) if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE)
{ {
/* Tell the middle-end that objects of tagged types are guaranteed to /* Record the property that objects of tagged types are guaranteed to
be properly aligned. This is necessary because conversions to the be properly aligned. This is necessary because conversions to the
class-wide type are translated into conversions to the root type, class-wide type are translated into conversions to the root type,
which can be less aligned than some of its derived types. */ which can be less aligned than some of its derived types. */
...@@ -6065,19 +6064,6 @@ gnu_ext_name_for_subprog (Entity_Id gnat_subprog, tree gnu_entity_name) ...@@ -6065,19 +6064,6 @@ gnu_ext_name_for_subprog (Entity_Id gnat_subprog, tree gnu_entity_name)
return gnu_ext_name; return gnu_ext_name;
} }
/* Like build_qualified_type, but TYPE_QUALS is added to the existing
qualifiers on TYPE. */
static tree
change_qualified_type (tree type, int type_quals)
{
/* Qualifiers must be put on the associated array type. */
if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
return type;
return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
}
/* Set TYPE_NONALIASED_COMPONENT on an array type built by means of /* Set TYPE_NONALIASED_COMPONENT on an array type built by means of
build_nonshared_array_type. */ build_nonshared_array_type. */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * C Header File *
* * * *
* Copyright (C) 1992-2017, Free Software Foundation, Inc. * * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -1075,7 +1075,7 @@ maybe_vector_array (tree exp) ...@@ -1075,7 +1075,7 @@ maybe_vector_array (tree exp)
static inline unsigned HOST_WIDE_INT static inline unsigned HOST_WIDE_INT
ceil_pow2 (unsigned HOST_WIDE_INT x) ceil_pow2 (unsigned HOST_WIDE_INT x)
{ {
return (unsigned HOST_WIDE_INT) 1 << (floor_log2 (x - 1) + 1); return (unsigned HOST_WIDE_INT) 1 << ceil_log2 (x);
} }
/* Return true if EXP, a CALL_EXPR, is an atomic load. */ /* Return true if EXP, a CALL_EXPR, is an atomic load. */
...@@ -1172,3 +1172,16 @@ maybe_debug_type (tree type) ...@@ -1172,3 +1172,16 @@ maybe_debug_type (tree type)
return type; return type;
} }
/* Like build_qualified_type, but TYPE_QUALS is added to the existing
qualifiers on TYPE. */
static inline tree
change_qualified_type (tree type, int type_quals)
{
/* Qualifiers must be put on the associated array type. */
if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
return type;
return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
}
...@@ -3327,8 +3327,11 @@ finish_subprog_decl (tree decl, tree asm_name, tree type) ...@@ -3327,8 +3327,11 @@ finish_subprog_decl (tree decl, tree asm_name, tree type)
DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type); DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type);
DECL_RESULT (decl) = result_decl; DECL_RESULT (decl) = result_decl;
/* Propagate the "const" property. */
TREE_READONLY (decl) = TYPE_READONLY (type); TREE_READONLY (decl) = TYPE_READONLY (type);
TREE_SIDE_EFFECTS (decl) = TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (type);
/* Propagate the "noreturn" property. */
TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (type);
if (asm_name) if (asm_name)
{ {
...@@ -6226,8 +6229,7 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args), ...@@ -6226,8 +6229,7 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node) TREE_TYPE (*node)
= build_pointer_type = build_pointer_type
(build_type_variant (TREE_TYPE (type), (change_qualified_type (TREE_TYPE (type), TYPE_QUAL_VOLATILE));
TYPE_READONLY (TREE_TYPE (type)), 1));
else else
{ {
warning (OPT_Wattributes, "%qs attribute ignored", warning (OPT_Wattributes, "%qs attribute ignored",
......
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