gigi.h (create_var_decl_1): Rename into...
* gcc-interface/gigi.h (create_var_decl_1): Rename into... (create_var_decl): ...this. Add default value for last parameter. (create_type_stub_decl): Adjust. (create_type_decl): Likewise. (create_field_decl): Likewise. (create_param_decl): Likewise. (create_label_decl): Likewise. (create_subprog_decl): Likewise. * gcc-interface/utils.c (create_var_decl_1): Rename into... (create_var_decl): ...this. Rename var_name into name and var_init into init, move const_decl_allowed_p last and adjust accordingly. (create_type_stub_decl): Rename type_name into name and adjust. (create_type_decl): Likewise. (create_field_decl): Likewise for field_name and field_type. (create_param_decl): Likewise for param_name and param_type. (create_label_decl): Likewise for label_name. (create_subprog_decl): Likewise for subprog_name and subprog_type. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust couple of calls to create_var_decl_1. From-SVN: r225002
This commit is contained in:
parent
66cc6273ba
commit
6249559b62
4 changed files with 163 additions and 158 deletions
|
@ -1,3 +1,25 @@
|
|||
2015-06-26 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/gigi.h (create_var_decl_1): Rename into...
|
||||
(create_var_decl): ...this. Add default value for last parameter.
|
||||
(create_type_stub_decl): Adjust.
|
||||
(create_type_decl): Likewise.
|
||||
(create_field_decl): Likewise.
|
||||
(create_param_decl): Likewise.
|
||||
(create_label_decl): Likewise.
|
||||
(create_subprog_decl): Likewise.
|
||||
* gcc-interface/utils.c (create_var_decl_1): Rename into...
|
||||
(create_var_decl): ...this. Rename var_name into name and var_init
|
||||
into init, move const_decl_allowed_p last and adjust accordingly.
|
||||
(create_type_stub_decl): Rename type_name into name and adjust.
|
||||
(create_type_decl): Likewise.
|
||||
(create_field_decl): Likewise for field_name and field_type.
|
||||
(create_param_decl): Likewise for param_name and param_type.
|
||||
(create_label_decl): Likewise for label_name.
|
||||
(create_subprog_decl): Likewise for subprog_name and subprog_type.
|
||||
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust couple of calls
|
||||
to create_var_decl_1.
|
||||
|
||||
2015-06-26 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/trans.c (loop_info_d): Add low_bound, high_bound,
|
||||
|
|
|
@ -1444,11 +1444,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|
|||
|
||||
/* Now create the variable or the constant and set various flags. */
|
||||
gnu_decl
|
||||
= create_var_decl_1 (gnu_entity_name, gnu_ext_name, gnu_type,
|
||||
gnu_expr, const_flag, Is_Public (gnat_entity),
|
||||
imported_p || !definition, static_p,
|
||||
artificial_p, debug_info_p, !renamed_obj,
|
||||
attr_list, gnat_entity);
|
||||
= create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
|
||||
gnu_expr, const_flag, Is_Public (gnat_entity),
|
||||
imported_p || !definition, static_p,
|
||||
artificial_p, debug_info_p, attr_list,
|
||||
gnat_entity, !renamed_obj);
|
||||
DECL_BY_REF_P (gnu_decl) = used_by_ref;
|
||||
DECL_POINTS_TO_READONLY_P (gnu_decl) = used_by_ref && inner_const_flag;
|
||||
DECL_CAN_NEVER_BE_NULL_P (gnu_decl) = Can_Never_Be_Null (gnat_entity);
|
||||
|
@ -1497,11 +1497,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|
|||
|| Is_Aliased (Etype (gnat_entity))))
|
||||
{
|
||||
tree gnu_corr_var
|
||||
= create_var_decl_1 (gnu_entity_name, gnu_ext_name, gnu_type,
|
||||
gnu_expr, true, Is_Public (gnat_entity),
|
||||
!definition, static_p, artificial_p,
|
||||
debug_info_p, false, attr_list,
|
||||
gnat_entity);
|
||||
= create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
|
||||
gnu_expr, true, Is_Public (gnat_entity),
|
||||
!definition, static_p, artificial_p,
|
||||
debug_info_p, attr_list, gnat_entity,
|
||||
false);
|
||||
|
||||
SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var);
|
||||
}
|
||||
|
|
|
@ -654,23 +654,22 @@ extern tree create_index_type (tree min, tree max, tree index,
|
|||
sizetype is used. */
|
||||
extern tree create_range_type (tree type, tree min, tree max);
|
||||
|
||||
/* Return a TYPE_DECL node suitable for the TYPE_STUB_DECL field of a type.
|
||||
TYPE_NAME gives the name of the type and TYPE is a ..._TYPE node giving
|
||||
its data type. */
|
||||
extern tree create_type_stub_decl (tree type_name, tree type);
|
||||
/* Return a TYPE_DECL node suitable for the TYPE_STUB_DECL field of TYPE.
|
||||
NAME gives the name of the type to be used in the declaration. */
|
||||
extern tree create_type_stub_decl (tree name, tree type);
|
||||
|
||||
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
|
||||
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
|
||||
declaration was generated by the compiler. DEBUG_INFO_P is true if we
|
||||
need to write debug information about this type. GNAT_NODE is used for
|
||||
the position of the decl. */
|
||||
extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
|
||||
/* Return a TYPE_DECL node for TYPE. NAME gives the name of the type to be
|
||||
used in the declaration. ARTIFICIAL_P is true if the declaration was
|
||||
generated by the compiler. DEBUG_INFO_P is true if we need to write
|
||||
debug information about this type. GNAT_NODE is used for the position
|
||||
of the decl. */
|
||||
extern tree create_type_decl (tree name, tree type, bool artificial_p,
|
||||
bool debug_info_p, Node_Id gnat_node);
|
||||
|
||||
/* Return a VAR_DECL or CONST_DECL node.
|
||||
|
||||
VAR_NAME gives the name of the variable. ASM_NAME is its assembler name
|
||||
(if provided). TYPE is its data type (a GCC ..._TYPE node). VAR_INIT is
|
||||
NAME gives the name of the variable. ASM_NAME is its assembler name
|
||||
(if provided). TYPE is its data type (a GCC ..._TYPE node). INIT is
|
||||
the GCC tree for an optional initial expression; NULL_TREE if none.
|
||||
|
||||
CONST_FLAG is true if this variable is constant, in which case we might
|
||||
|
@ -691,49 +690,37 @@ extern tree create_type_decl (tree type_name, tree type, bool artificial_p,
|
|||
DEBUG_INFO_P is true if we need to write debug information for it.
|
||||
|
||||
GNAT_NODE is used for the position of the decl. */
|
||||
extern tree
|
||||
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
||||
bool const_flag, bool public_flag, bool extern_flag,
|
||||
bool static_flag, bool artificial_p, bool debug_info_p,
|
||||
bool const_decl_allowed_p, struct attrib *attr_list,
|
||||
Node_Id gnat_node);
|
||||
extern tree create_var_decl (tree name, tree asm_name, tree type, tree init,
|
||||
bool const_flag, bool public_flag,
|
||||
bool extern_flag, bool static_flag,
|
||||
bool artificial_p, bool debug_info_p,
|
||||
struct attrib *attr_list, Node_Id gnat_node,
|
||||
bool const_decl_allowed_p = true);
|
||||
|
||||
/* Wrapper around create_var_decl_1 for cases where we don't care whether
|
||||
a VAR or a CONST decl node is created. */
|
||||
#define create_var_decl(var_name, asm_name, type, var_init, \
|
||||
const_flag, public_flag, extern_flag, \
|
||||
static_flag, artificial_p, debug_info_p,\
|
||||
attr_list, gnat_node) \
|
||||
create_var_decl_1 (var_name, asm_name, type, var_init, \
|
||||
const_flag, public_flag, extern_flag, \
|
||||
static_flag, artificial_p, debug_info_p, \
|
||||
true, attr_list, gnat_node)
|
||||
|
||||
/* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is
|
||||
its type and RECORD_TYPE is the type of the enclosing record. If SIZE is
|
||||
nonzero, it is the specified size of the field. If POS is nonzero, it is
|
||||
the bit position. PACKED is 1 if the enclosing record is packed, -1 if it
|
||||
has Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it
|
||||
/* Return a FIELD_DECL node. NAME is the field's name, TYPE is its type and
|
||||
RECORD_TYPE is the type of the enclosing record. If SIZE is nonzero, it
|
||||
is the specified size of the field. If POS is nonzero, it is the bit
|
||||
position. PACKED is 1 if the enclosing record is packed, -1 if it has
|
||||
Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it
|
||||
means we are allowed to take the address of the field; if it is negative,
|
||||
we should not make a bitfield, which is used by make_aligning_type. */
|
||||
extern tree create_field_decl (tree field_name, tree field_type,
|
||||
tree record_type, tree size, tree pos,
|
||||
int packed, int addressable);
|
||||
extern tree create_field_decl (tree name, tree type, tree record_type,
|
||||
tree size, tree pos, int packed,
|
||||
int addressable);
|
||||
|
||||
/* Return a PARM_DECL node. PARAM_NAME is the name of the parameter and
|
||||
PARAM_TYPE is its type. READONLY is true if the parameter is readonly
|
||||
(either an In parameter or an address of a pass-by-ref parameter). */
|
||||
extern tree create_param_decl (tree param_name, tree param_type,
|
||||
bool readonly);
|
||||
/* Return a PARM_DECL node. NAME is the name of the parameter and TYPE is
|
||||
its type. READONLY is true if the parameter is readonly (either an In
|
||||
parameter or an address of a pass-by-ref parameter). */
|
||||
extern tree create_param_decl (tree name, tree type, bool readonly);
|
||||
|
||||
/* Return a LABEL_DECL with LABEL_NAME. GNAT_NODE is used for the position
|
||||
of the decl. */
|
||||
extern tree create_label_decl (tree label_name, Node_Id gnat_node);
|
||||
/* Return a LABEL_DECL with NAME. GNAT_NODE is used for the position of
|
||||
the decl. */
|
||||
extern tree create_label_decl (tree name, Node_Id gnat_node);
|
||||
|
||||
/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
|
||||
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
|
||||
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
|
||||
PARM_DECL nodes chained through the DECL_CHAIN field).
|
||||
/* Return a FUNCTION_DECL node. NAME is the name of the subprogram, ASM_NAME
|
||||
its assembler name, TYPE its type (a FUNCTION_TYPE node), PARAM_DECL_LIST
|
||||
the list of its parameters (a list of PARM_DECL nodes chained through the
|
||||
DECL_CHAIN field).
|
||||
|
||||
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
|
||||
appropriate fields in the FUNCTION_DECL.
|
||||
|
@ -743,8 +730,8 @@ extern tree create_label_decl (tree label_name, Node_Id gnat_node);
|
|||
DEBUG_INFO_P is true if we need to write debug information for it.
|
||||
|
||||
GNAT_NODE is used for the position of the decl. */
|
||||
extern tree create_subprog_decl (tree subprog_name, tree asm_name,
|
||||
tree subprog_type, tree param_decl_list,
|
||||
extern tree create_subprog_decl (tree name, tree asm_name, tree type,
|
||||
tree param_decl_list,
|
||||
enum inline_status_t inline_status,
|
||||
bool public_flag, bool extern_flag,
|
||||
bool artificial_p, bool debug_info_p,
|
||||
|
|
|
@ -2238,31 +2238,31 @@ create_range_type (tree type, tree min, tree max)
|
|||
return range_type;
|
||||
}
|
||||
|
||||
/* Return a TYPE_DECL node suitable for the TYPE_STUB_DECL field of a type.
|
||||
TYPE_NAME gives the name of the type and TYPE is a ..._TYPE node giving
|
||||
its data type. */
|
||||
/* Return a TYPE_DECL node suitable for the TYPE_STUB_DECL field of TYPE.
|
||||
NAME gives the name of the type to be used in the declaration. */
|
||||
|
||||
tree
|
||||
create_type_stub_decl (tree type_name, tree type)
|
||||
create_type_stub_decl (tree name, tree type)
|
||||
{
|
||||
tree type_decl = build_decl (input_location, TYPE_DECL, type_name, type);
|
||||
tree type_decl = build_decl (input_location, TYPE_DECL, name, type);
|
||||
DECL_ARTIFICIAL (type_decl) = 1;
|
||||
TYPE_ARTIFICIAL (type) = 1;
|
||||
return type_decl;
|
||||
}
|
||||
|
||||
/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type and TYPE
|
||||
is a ..._TYPE node giving its data type. ARTIFICIAL_P is true if the
|
||||
declaration was generated by the compiler. DEBUG_INFO_P is true if we
|
||||
need to write debug information about this type. GNAT_NODE is used for
|
||||
the position of the decl. */
|
||||
/* Return a TYPE_DECL node for TYPE. NAME gives the name of the type to be
|
||||
used in the declaration. ARTIFICIAL_P is true if the declaration was
|
||||
generated by the compiler. DEBUG_INFO_P is true if we need to write
|
||||
debug information about this type. GNAT_NODE is used for the position
|
||||
of the decl. */
|
||||
|
||||
tree
|
||||
create_type_decl (tree type_name, tree type, bool artificial_p,
|
||||
bool debug_info_p, Node_Id gnat_node)
|
||||
create_type_decl (tree name, tree type, bool artificial_p, bool debug_info_p,
|
||||
Node_Id gnat_node)
|
||||
{
|
||||
enum tree_code code = TREE_CODE (type);
|
||||
bool named = TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL;
|
||||
bool is_named
|
||||
= TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL;
|
||||
tree type_decl;
|
||||
|
||||
/* Only the builtin TYPE_STUB_DECL should be used for dummy types. */
|
||||
|
@ -2270,13 +2270,13 @@ create_type_decl (tree type_name, tree type, bool artificial_p,
|
|||
|
||||
/* If the type hasn't been named yet, we're naming it; preserve an existing
|
||||
TYPE_STUB_DECL that has been attached to it for some purpose. */
|
||||
if (!named && TYPE_STUB_DECL (type))
|
||||
if (!is_named && TYPE_STUB_DECL (type))
|
||||
{
|
||||
type_decl = TYPE_STUB_DECL (type);
|
||||
DECL_NAME (type_decl) = type_name;
|
||||
DECL_NAME (type_decl) = name;
|
||||
}
|
||||
else
|
||||
type_decl = build_decl (input_location, TYPE_DECL, type_name, type);
|
||||
type_decl = build_decl (input_location, TYPE_DECL, name, type);
|
||||
|
||||
DECL_ARTIFICIAL (type_decl) = artificial_p;
|
||||
TYPE_ARTIFICIAL (type) = artificial_p;
|
||||
|
@ -2293,7 +2293,7 @@ create_type_decl (tree type_name, tree type, bool artificial_p,
|
|||
from multiple contexts, and "type_decl" references a copy of it: in such a
|
||||
case, do not mess TYPE_STUB_DECL: we do not want to re-use the TYPE_DECL
|
||||
with the mechanism above. */
|
||||
if (!named && type != DECL_ORIGINAL_TYPE (type_decl))
|
||||
if (!is_named && type != DECL_ORIGINAL_TYPE (type_decl))
|
||||
TYPE_STUB_DECL (type) = type_decl;
|
||||
|
||||
/* Do not generate debug info for UNCONSTRAINED_ARRAY_TYPE that the
|
||||
|
@ -2306,8 +2306,8 @@ create_type_decl (tree type_name, tree type, bool artificial_p,
|
|||
|
||||
/* Return a VAR_DECL or CONST_DECL node.
|
||||
|
||||
VAR_NAME gives the name of the variable. ASM_NAME is its assembler name
|
||||
(if provided). TYPE is its data type (a GCC ..._TYPE node). VAR_INIT is
|
||||
NAME gives the name of the variable. ASM_NAME is its assembler name
|
||||
(if provided). TYPE is its data type (a GCC ..._TYPE node). INIT is
|
||||
the GCC tree for an optional initial expression; NULL_TREE if none.
|
||||
|
||||
CONST_FLAG is true if this variable is constant, in which case we might
|
||||
|
@ -2330,11 +2330,11 @@ create_type_decl (tree type_name, tree type, bool artificial_p,
|
|||
GNAT_NODE is used for the position of the decl. */
|
||||
|
||||
tree
|
||||
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
||||
bool const_flag, bool public_flag, bool extern_flag,
|
||||
bool static_flag, bool artificial_p, bool debug_info_p,
|
||||
bool const_decl_allowed_p, struct attrib *attr_list,
|
||||
Node_Id gnat_node)
|
||||
create_var_decl (tree name, tree asm_name, tree type, tree init,
|
||||
bool const_flag, bool public_flag, bool extern_flag,
|
||||
bool static_flag, bool artificial_p, bool debug_info_p,
|
||||
struct attrib *attr_list, Node_Id gnat_node,
|
||||
bool const_decl_allowed_p)
|
||||
{
|
||||
/* Whether the object has static storage duration, either explicitly or by
|
||||
virtue of being declared at the global level. */
|
||||
|
@ -2345,12 +2345,12 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
|||
constant expression for initializing a static variable; otherwise, we
|
||||
only check that it is constant. */
|
||||
const bool init_const
|
||||
= (var_init
|
||||
&& gnat_types_compatible_p (type, TREE_TYPE (var_init))
|
||||
= (init
|
||||
&& gnat_types_compatible_p (type, TREE_TYPE (init))
|
||||
&& (extern_flag || static_storage
|
||||
? initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
|
||||
? initializer_constant_valid_p (init, TREE_TYPE (init))
|
||||
!= NULL_TREE
|
||||
: TREE_CONSTANT (var_init)));
|
||||
: TREE_CONSTANT (init)));
|
||||
|
||||
/* Whether we will make TREE_CONSTANT the DECL we produce here, in which
|
||||
case the initializer may be used in lieu of the DECL node (as done in
|
||||
|
@ -2367,7 +2367,7 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
|||
= build_decl (input_location,
|
||||
(constant_p && const_decl_allowed_p
|
||||
&& !AGGREGATE_TYPE_P (type)) ? CONST_DECL : VAR_DECL,
|
||||
var_name, type);
|
||||
name, type);
|
||||
|
||||
/* If this is external, throw away any initializations (they will be done
|
||||
elsewhere) unless this is a constant for which we would like to remain
|
||||
|
@ -2376,17 +2376,17 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
|||
elaboration routine. If we are just annotating types, throw away the
|
||||
initialization if it isn't a constant. */
|
||||
if ((extern_flag && !constant_p)
|
||||
|| (type_annotate_only && var_init && !TREE_CONSTANT (var_init)))
|
||||
var_init = NULL_TREE;
|
||||
|| (type_annotate_only && init && !TREE_CONSTANT (init)))
|
||||
init = NULL_TREE;
|
||||
|
||||
/* At the global level, a non-constant initializer generates elaboration
|
||||
statements. Check that such statements are allowed, that is to say,
|
||||
not violating a No_Elaboration_Code restriction. */
|
||||
if (var_init && !init_const && global_bindings_p ())
|
||||
if (init && !init_const && global_bindings_p ())
|
||||
Check_Elaboration_Code_Allowed (gnat_node);
|
||||
|
||||
/* Attach the initializer, if any. */
|
||||
DECL_INITIAL (var_decl) = var_init;
|
||||
DECL_INITIAL (var_decl) = init;
|
||||
|
||||
/* Directly set some flags. */
|
||||
DECL_ARTIFICIAL (var_decl) = artificial_p;
|
||||
|
@ -2421,8 +2421,8 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
|
|||
|| (TREE_CODE (var_decl) == CONST_DECL && !optimize)
|
||||
|| (extern_flag
|
||||
&& constant_p
|
||||
&& var_init
|
||||
&& initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
|
||||
&& init
|
||||
&& initializer_constant_valid_p (init, TREE_TYPE (init))
|
||||
!= null_pointer_node))
|
||||
DECL_IGNORED_P (var_decl) = 1;
|
||||
|
||||
|
@ -2484,23 +2484,22 @@ aggregate_type_contains_array_p (tree type)
|
|||
}
|
||||
}
|
||||
|
||||
/* Return a FIELD_DECL node. FIELD_NAME is the field's name, FIELD_TYPE is
|
||||
its type and RECORD_TYPE is the type of the enclosing record. If SIZE is
|
||||
nonzero, it is the specified size of the field. If POS is nonzero, it is
|
||||
the bit position. PACKED is 1 if the enclosing record is packed, -1 if it
|
||||
has Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it
|
||||
/* Return a FIELD_DECL node. NAME is the field's name, TYPE is its type and
|
||||
RECORD_TYPE is the type of the enclosing record. If SIZE is nonzero, it
|
||||
is the specified size of the field. If POS is nonzero, it is the bit
|
||||
position. PACKED is 1 if the enclosing record is packed, -1 if it has
|
||||
Component_Alignment of Storage_Unit. If ADDRESSABLE is nonzero, it
|
||||
means we are allowed to take the address of the field; if it is negative,
|
||||
we should not make a bitfield, which is used by make_aligning_type. */
|
||||
|
||||
tree
|
||||
create_field_decl (tree field_name, tree field_type, tree record_type,
|
||||
tree size, tree pos, int packed, int addressable)
|
||||
create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
|
||||
int packed, int addressable)
|
||||
{
|
||||
tree field_decl = build_decl (input_location,
|
||||
FIELD_DECL, field_name, field_type);
|
||||
tree field_decl = build_decl (input_location, FIELD_DECL, name, type);
|
||||
|
||||
DECL_CONTEXT (field_decl) = record_type;
|
||||
TREE_READONLY (field_decl) = TYPE_READONLY (field_type);
|
||||
TREE_READONLY (field_decl) = TYPE_READONLY (type);
|
||||
|
||||
/* If FIELD_TYPE is BLKmode, we must ensure this is aligned to at least a
|
||||
byte boundary since GCC cannot handle less-aligned BLKmode bitfields.
|
||||
|
@ -2508,10 +2507,10 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
array, because in this case slices of variable length of this array
|
||||
must be handled by GCC and variable-sized objects need to be aligned
|
||||
to at least a byte boundary. */
|
||||
if (packed && (TYPE_MODE (field_type) == BLKmode
|
||||
if (packed && (TYPE_MODE (type) == BLKmode
|
||||
|| (!pos
|
||||
&& AGGREGATE_TYPE_P (field_type)
|
||||
&& aggregate_type_contains_array_p (field_type))))
|
||||
&& AGGREGATE_TYPE_P (type)
|
||||
&& aggregate_type_contains_array_p (type))))
|
||||
DECL_ALIGN (field_decl) = BITS_PER_UNIT;
|
||||
|
||||
/* If a size is specified, use it. Otherwise, if the record type is packed
|
||||
|
@ -2523,8 +2522,8 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
size = convert (bitsizetype, size);
|
||||
else if (packed == 1)
|
||||
{
|
||||
size = rm_size (field_type);
|
||||
if (TYPE_MODE (field_type) == BLKmode)
|
||||
size = rm_size (type);
|
||||
if (TYPE_MODE (type) == BLKmode)
|
||||
size = round_up (size, BITS_PER_UNIT);
|
||||
}
|
||||
|
||||
|
@ -2546,22 +2545,22 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
if (addressable >= 0
|
||||
&& size
|
||||
&& TREE_CODE (size) == INTEGER_CST
|
||||
&& TREE_CODE (TYPE_SIZE (field_type)) == INTEGER_CST
|
||||
&& (!tree_int_cst_equal (size, TYPE_SIZE (field_type))
|
||||
|| (pos && !value_factor_p (pos, TYPE_ALIGN (field_type)))
|
||||
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
|
||||
&& (!tree_int_cst_equal (size, TYPE_SIZE (type))
|
||||
|| (pos && !value_factor_p (pos, TYPE_ALIGN (type)))
|
||||
|| packed
|
||||
|| (TYPE_ALIGN (record_type) != 0
|
||||
&& TYPE_ALIGN (record_type) < TYPE_ALIGN (field_type))))
|
||||
&& TYPE_ALIGN (record_type) < TYPE_ALIGN (type))))
|
||||
{
|
||||
DECL_BIT_FIELD (field_decl) = 1;
|
||||
DECL_SIZE (field_decl) = size;
|
||||
if (!packed && !pos)
|
||||
{
|
||||
if (TYPE_ALIGN (record_type) != 0
|
||||
&& TYPE_ALIGN (record_type) < TYPE_ALIGN (field_type))
|
||||
&& TYPE_ALIGN (record_type) < TYPE_ALIGN (type))
|
||||
DECL_ALIGN (field_decl) = TYPE_ALIGN (record_type);
|
||||
else
|
||||
DECL_ALIGN (field_decl) = TYPE_ALIGN (field_type);
|
||||
DECL_ALIGN (field_decl) = TYPE_ALIGN (type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2574,14 +2573,14 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
{
|
||||
unsigned int bit_align
|
||||
= (DECL_BIT_FIELD (field_decl) ? 1
|
||||
: packed && TYPE_MODE (field_type) != BLKmode ? BITS_PER_UNIT : 0);
|
||||
: packed && TYPE_MODE (type) != BLKmode ? BITS_PER_UNIT : 0);
|
||||
|
||||
if (bit_align > DECL_ALIGN (field_decl))
|
||||
DECL_ALIGN (field_decl) = bit_align;
|
||||
else if (!bit_align && TYPE_ALIGN (field_type) > DECL_ALIGN (field_decl))
|
||||
else if (!bit_align && TYPE_ALIGN (type) > DECL_ALIGN (field_decl))
|
||||
{
|
||||
DECL_ALIGN (field_decl) = TYPE_ALIGN (field_type);
|
||||
DECL_USER_ALIGN (field_decl) = TYPE_USER_ALIGN (field_type);
|
||||
DECL_ALIGN (field_decl) = TYPE_ALIGN (type);
|
||||
DECL_USER_ALIGN (field_decl) = TYPE_USER_ALIGN (type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2619,7 +2618,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
of a copy. This is the case for true bitfields, but the DECL_BIT_FIELD
|
||||
value we have at this point is not accurate enough, so we don't account
|
||||
for this here and let finish_record_type decide. */
|
||||
if (!addressable && !type_for_nonaliased_component_p (field_type))
|
||||
if (!addressable && !type_for_nonaliased_component_p (type))
|
||||
addressable = 1;
|
||||
|
||||
DECL_NONADDRESSABLE_P (field_decl) = !addressable;
|
||||
|
@ -2627,40 +2626,39 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
|
|||
return field_decl;
|
||||
}
|
||||
|
||||
/* Return a PARM_DECL node. PARAM_NAME is the name of the parameter and
|
||||
PARAM_TYPE is its type. READONLY is true if the parameter is readonly
|
||||
(either an In parameter or an address of a pass-by-ref parameter). */
|
||||
/* Return a PARM_DECL node. NAME is the name of the parameter and TYPE is
|
||||
its type. READONLY is true if the parameter is readonly (either an In
|
||||
parameter or an address of a pass-by-ref parameter). */
|
||||
|
||||
tree
|
||||
create_param_decl (tree param_name, tree param_type, bool readonly)
|
||||
create_param_decl (tree name, tree type, bool readonly)
|
||||
{
|
||||
tree param_decl = build_decl (input_location,
|
||||
PARM_DECL, param_name, param_type);
|
||||
tree param_decl = build_decl (input_location, PARM_DECL, name, type);
|
||||
|
||||
/* Honor TARGET_PROMOTE_PROTOTYPES like the C compiler, as not doing so
|
||||
can lead to various ABI violations. */
|
||||
if (targetm.calls.promote_prototypes (NULL_TREE)
|
||||
&& INTEGRAL_TYPE_P (param_type)
|
||||
&& TYPE_PRECISION (param_type) < TYPE_PRECISION (integer_type_node))
|
||||
&& INTEGRAL_TYPE_P (type)
|
||||
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
|
||||
{
|
||||
/* We have to be careful about biased types here. Make a subtype
|
||||
of integer_type_node with the proper biasing. */
|
||||
if (TREE_CODE (param_type) == INTEGER_TYPE
|
||||
&& TYPE_BIASED_REPRESENTATION_P (param_type))
|
||||
if (TREE_CODE (type) == INTEGER_TYPE
|
||||
&& TYPE_BIASED_REPRESENTATION_P (type))
|
||||
{
|
||||
tree subtype
|
||||
= make_unsigned_type (TYPE_PRECISION (integer_type_node));
|
||||
TREE_TYPE (subtype) = integer_type_node;
|
||||
TYPE_BIASED_REPRESENTATION_P (subtype) = 1;
|
||||
SET_TYPE_RM_MIN_VALUE (subtype, TYPE_MIN_VALUE (param_type));
|
||||
SET_TYPE_RM_MAX_VALUE (subtype, TYPE_MAX_VALUE (param_type));
|
||||
param_type = subtype;
|
||||
SET_TYPE_RM_MIN_VALUE (subtype, TYPE_MIN_VALUE (type));
|
||||
SET_TYPE_RM_MAX_VALUE (subtype, TYPE_MAX_VALUE (type));
|
||||
type = subtype;
|
||||
}
|
||||
else
|
||||
param_type = integer_type_node;
|
||||
type = integer_type_node;
|
||||
}
|
||||
|
||||
DECL_ARG_TYPE (param_decl) = param_type;
|
||||
DECL_ARG_TYPE (param_decl) = type;
|
||||
TREE_READONLY (param_decl) = readonly;
|
||||
return param_decl;
|
||||
}
|
||||
|
@ -3015,14 +3013,14 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Return a LABEL_DECL with LABEL_NAME. GNAT_NODE is used for the position
|
||||
of the decl. */
|
||||
/* Return a LABEL_DECL with NAME. GNAT_NODE is used for the position of
|
||||
the decl. */
|
||||
|
||||
tree
|
||||
create_label_decl (tree label_name, Node_Id gnat_node)
|
||||
create_label_decl (tree name, Node_Id gnat_node)
|
||||
{
|
||||
tree label_decl
|
||||
= build_decl (input_location, LABEL_DECL, label_name, void_type_node);
|
||||
= build_decl (input_location, LABEL_DECL, name, void_type_node);
|
||||
|
||||
DECL_MODE (label_decl) = VOIDmode;
|
||||
|
||||
|
@ -3032,10 +3030,10 @@ create_label_decl (tree label_name, Node_Id gnat_node)
|
|||
return label_decl;
|
||||
}
|
||||
|
||||
/* Return a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
|
||||
ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
|
||||
node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
|
||||
PARM_DECL nodes chained through the DECL_CHAIN field).
|
||||
/* Return a FUNCTION_DECL node. NAME is the name of the subprogram, ASM_NAME
|
||||
its assembler name, TYPE its type (a FUNCTION_TYPE node), PARAM_DECL_LIST
|
||||
the list of its parameters (a list of PARM_DECL nodes chained through the
|
||||
DECL_CHAIN field).
|
||||
|
||||
INLINE_STATUS, PUBLIC_FLAG, EXTERN_FLAG and ATTR_LIST are used to set the
|
||||
appropriate fields in the FUNCTION_DECL.
|
||||
|
@ -3047,16 +3045,14 @@ create_label_decl (tree label_name, Node_Id gnat_node)
|
|||
GNAT_NODE is used for the position of the decl. */
|
||||
|
||||
tree
|
||||
create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
|
||||
tree param_decl_list, enum inline_status_t inline_status,
|
||||
bool public_flag, bool extern_flag, bool artificial_p,
|
||||
bool debug_info_p, struct attrib *attr_list,
|
||||
Node_Id gnat_node)
|
||||
create_subprog_decl (tree name, tree asm_name, tree type, tree param_decl_list,
|
||||
enum inline_status_t inline_status, bool public_flag,
|
||||
bool extern_flag, bool artificial_p, bool debug_info_p,
|
||||
struct attrib *attr_list, Node_Id gnat_node)
|
||||
{
|
||||
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, subprog_name,
|
||||
subprog_type);
|
||||
tree result_decl = build_decl (input_location, RESULT_DECL, NULL_TREE,
|
||||
TREE_TYPE (subprog_type));
|
||||
tree subprog_decl = build_decl (input_location, FUNCTION_DECL, name, type);
|
||||
tree result_decl
|
||||
= build_decl (input_location, RESULT_DECL, NULL_TREE, TREE_TYPE (type));
|
||||
DECL_ARGUMENTS (subprog_decl) = param_decl_list;
|
||||
|
||||
DECL_ARTIFICIAL (subprog_decl) = artificial_p;
|
||||
|
@ -3093,13 +3089,13 @@ create_subprog_decl (tree subprog_name, tree asm_name, tree subprog_type,
|
|||
DECL_IGNORED_P (subprog_decl) = 1;
|
||||
|
||||
TREE_PUBLIC (subprog_decl) = public_flag;
|
||||
TREE_READONLY (subprog_decl) = TYPE_READONLY (subprog_type);
|
||||
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (subprog_type);
|
||||
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (subprog_type);
|
||||
TREE_READONLY (subprog_decl) = TYPE_READONLY (type);
|
||||
TREE_THIS_VOLATILE (subprog_decl) = TYPE_VOLATILE (type);
|
||||
TREE_SIDE_EFFECTS (subprog_decl) = TYPE_VOLATILE (type);
|
||||
|
||||
DECL_ARTIFICIAL (result_decl) = 1;
|
||||
DECL_IGNORED_P (result_decl) = 1;
|
||||
DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (subprog_type);
|
||||
DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type);
|
||||
DECL_RESULT (subprog_decl) = result_decl;
|
||||
|
||||
process_attributes (&subprog_decl, &attr_list, true, gnat_node);
|
||||
|
|
Loading…
Add table
Reference in a new issue