Commit b4680ca1 by Eric Botcazou Committed by Eric Botcazou

ada-tree.h (TYPE_RM_SIZE_NUM): Delete.

	* ada-tree.h (TYPE_RM_SIZE_NUM): Delete.
	(TYPE_RM_SIZE): Access TYPE_LANG_SLOT_1 directly for integral types.
	* decl.c (gnat_to_gnu_entity) <E_Modular_Integer_Type>: Remove useless
	support code for packed array types and assert its uselessness.
	<E_Signed_Integer_Subtype>: Reuse entity identifier in more places and
	adjust for TYPE_RM_SIZE change.
	<all> Fix nits in comments.  Use Original_Array_Type accessor instead
	of Associated_Node_For_Itype accessor for packed array types.
	(make_packable_type): Likewise.
	(maybe_pad_type): Likewise.
	(set_rm_size): Likewise.  Rework conditional statement.  Adjust for
	TYPE_RM_SIZE change.
	(make_type_from_size): Adjust for TYPE_RM_SIZE change.
	(rm_size): Fix nits in comments.  Rework conditional statements.
	* misc.c (gnat_print_type): Adjust for TYPE_RM_SIZE change.
	* trans.c (Attribute_to_gnu): Fix nits in comments.
	* utils.c (gnat_init_decl_processing): Use more appropriate function
	to initialize the size_type_node.  Adjust for TYPE_RM_SIZE change.

From-SVN: r146530
parent 35091630
2009-04-21 Eric Botcazou <ebotcazou@adacore.com>
* ada-tree.h (TYPE_RM_SIZE_NUM): Delete.
(TYPE_RM_SIZE): Access TYPE_LANG_SLOT_1 directly for integral types.
* decl.c (gnat_to_gnu_entity) <E_Modular_Integer_Type>: Remove useless
support code for packed array types and assert its uselessness.
<E_Signed_Integer_Subtype>: Reuse entity identifier in more places and
adjust for TYPE_RM_SIZE change.
<all> Fix nits in comments. Use Original_Array_Type accessor instead
of Associated_Node_For_Itype accessor for packed array types.
(make_packable_type): Likewise.
(maybe_pad_type): Likewise.
(set_rm_size): Likewise. Rework conditional statement. Adjust for
TYPE_RM_SIZE change.
(make_type_from_size): Adjust for TYPE_RM_SIZE change.
(rm_size): Fix nits in comments. Rework conditional statements.
* misc.c (gnat_print_type): Adjust for TYPE_RM_SIZE change.
* trans.c (Attribute_to_gnu): Fix nits in comments.
* utils.c (gnat_init_decl_processing): Use more appropriate function
to initialize the size_type_node. Adjust for TYPE_RM_SIZE change.
2009-04-21 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set force_global
for imported subprograms.
......@@ -6,7 +6,7 @@
* *
* C Header File *
* *
* Copyright (C) 1992-2008, Free Software Foundation, Inc. *
* Copyright (C) 1992-2009, Free Software Foundation, Inc. *
* *
* 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- *
......@@ -162,6 +162,10 @@ struct lang_type GTY(()) {tree t; };
cico parameter passing mechanism refer to the routine gnat_to_gnu_entity. */
#define TYPE_CI_CO_LIST(NODE) TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
/* For integral types, this is the RM Size of the type. */
#define TYPE_RM_SIZE(NODE) \
TYPE_LANG_SLOT_1 (TREE_CHECK3 (NODE, ENUMERAL_TYPE, BOOLEAN_TYPE, INTEGER_TYPE))
/* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the
modulus. */
#define TYPE_MODULUS(NODE) GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
......@@ -182,13 +186,6 @@ struct lang_type GTY(()) {tree t; };
#define SET_TYPE_DIGITS_VALUE(NODE, X) \
SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X)
/* For numeric types, stores the RM_Size of the type. */
#define TYPE_RM_SIZE_NUM(NODE) TYPE_LANG_SLOT_1 (NUMERICAL_TYPE_CHECK (NODE))
#define TYPE_RM_SIZE(NODE) \
(INTEGRAL_TYPE_P (NODE) || TREE_CODE (NODE) == REAL_TYPE \
? TYPE_RM_SIZE_NUM (NODE) : 0)
/* For a RECORD_TYPE that is a fat pointer, point to the type for the
unconstrained object. Likewise for a RECORD_TYPE that is pointed
to by a thin pointer. */
......
......@@ -544,7 +544,7 @@ gnat_print_type (FILE *file, tree node, int indent)
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
print_node (file, "RM size", TYPE_RM_SIZE_NUM (node), indent + 4);
print_node (file, "RM size", TYPE_RM_SIZE (node), indent + 4);
break;
case INTEGER_TYPE:
......@@ -558,7 +558,7 @@ gnat_print_type (FILE *file, tree node, int indent)
else
print_node (file, "index type", TYPE_INDEX_TYPE (node), indent + 4);
print_node (file, "RM size", TYPE_RM_SIZE_NUM (node), indent + 4);
print_node (file, "RM size", TYPE_RM_SIZE (node), indent + 4);
break;
case ARRAY_TYPE:
......
......@@ -1297,7 +1297,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
/* If we're looking for the size of a field, return the field size.
Otherwise, if the prefix is an object, or if 'Object_Size or
'Max_Size_In_Storage_Elements has been specified, the result is the
GCC size of the type. Otherwise, the result is the RM_Size of the
GCC size of the type. Otherwise, the result is the RM size of the
type. */
if (TREE_CODE (gnu_prefix) == COMPONENT_REF)
gnu_result = DECL_SIZE (TREE_OPERAND (gnu_prefix, 1));
......@@ -1306,7 +1306,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
|| attribute == Attr_Max_Size_In_Storage_Elements)
{
/* If this is a padded type, the GCC size isn't relevant to the
programmer. Normally, what we want is the RM_Size, which was set
programmer. Normally, what we want is the RM size, which was set
from the specified size, but if it was not set, we want the size
of the relevant field. Using the MAX of those two produces the
right result in all case. Don't use the size of the field if it's
......
......@@ -515,18 +515,17 @@ gnat_init_decl_processing (void)
build_common_tree_nodes (true, true);
/* In Ada, we use a signed type for SIZETYPE. Use the signed type
corresponding to the size of Pmode. In most cases when ptr_mode and
Pmode differ, C will use the width of ptr_mode as sizetype. But we get
far better code using the width of Pmode. Make this here since we need
this before we can expand the GNAT types. */
size_type_node = gnat_type_for_size (GET_MODE_BITSIZE (Pmode), 0);
corresponding to the width of Pmode. In most cases when ptr_mode
and Pmode differ, C will use the width of ptr_mode for SIZETYPE.
But we get far better code using the width of Pmode. */
size_type_node = gnat_type_for_mode (Pmode, 0);
set_sizetype (size_type_node);
/* In Ada, we use an unsigned 8-bit type for the default boolean type. */
boolean_type_node = make_node (BOOLEAN_TYPE);
TYPE_PRECISION (boolean_type_node) = 1;
fixup_unsigned_type (boolean_type_node);
TYPE_RM_SIZE_NUM (boolean_type_node) = bitsize_int (1);
TYPE_RM_SIZE (boolean_type_node) = bitsize_int (1);
build_common_tree_nodes_2 (0);
......@@ -2230,7 +2229,7 @@ gnat_types_compatible_p (tree t1, tree t2)
&& TREE_TYPE (t1) == TREE_TYPE (t2)
&& (TYPE_DOMAIN (t1) == TYPE_DOMAIN (t2)
|| (TYPE_DOMAIN (t1)
&& TYPE_DOMAIN (t2)
&& TYPE_DOMAIN (t2)
&& tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (t1)),
TYPE_MIN_VALUE (TYPE_DOMAIN (t2)))
&& tree_int_cst_equal (TYPE_MAX_VALUE (TYPE_DOMAIN (t1)),
......@@ -5176,10 +5175,10 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
bool * ARG_UNUSED (no_add_attrs))
{
tree params;
/* Ensure we have a function type. */
gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
params = TYPE_ARG_TYPES (*node);
while (params && ! VOID_TYPE_P (TREE_VALUE (params)))
params = TREE_CHAIN (params);
......
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