* gcc-interface/decl.c (gnat_to_gnu_entity): Constify a few variables.
<object>: Do not create the fake PARM_DECL if no debug info is needed.
Do not create the corresponding VAR_DECL of a CONST_DECL for debugging
purposes if no debug info is needed.
Fix formatting. Reorder and add comments.
* gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Reference>: Constify
variable and remove obsolete comment.
* gcc-interface/utils.c (convert_vms_descriptor64): Tweak comment.
(convert_vms_descriptor32): Likewise.
(convert): Remove dead code.
<UNCONSTRAINED_ARRAY_REF>: Pass the field instead of its name to build
the reference to the P_ARRAY pointer.
<POINTER_TYPE>: Likewise.
(maybe_unconstrained_array) <UNCONSTRAINED_ARRAY_TYPE>: Likewise.
(gnat_init_decl_processing): Delete, move contents to...
* gcc-interface/misc.c (gnat_init): ...here.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158428
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-04-16 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/gigi.h (gnat_init_decl_processing): Delete.
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Constify a few variables.
+ <object>: Do not create the fake PARM_DECL if no debug info is needed.
+ Do not create the corresponding VAR_DECL of a CONST_DECL for debugging
+ purposes if no debug info is needed.
+ Fix formatting. Reorder and add comments.
+ * gcc-interface/trans.c (gnat_to_gnu) <N_Attribute_Reference>: Constify
+ variable and remove obsolete comment.
+ * gcc-interface/utils.c (convert_vms_descriptor64): Tweak comment.
+ (convert_vms_descriptor32): Likewise.
+ (convert): Remove dead code.
+ <UNCONSTRAINED_ARRAY_REF>: Pass the field instead of its name to build
+ the reference to the P_ARRAY pointer.
+ <POINTER_TYPE>: Likewise.
+ (maybe_unconstrained_array) <UNCONSTRAINED_ARRAY_TYPE>: Likewise.
+ (gnat_init_decl_processing): Delete, move contents to...
+ * gcc-interface/misc.c (gnat_init): ...here.
+
+2010-04-16 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/trans.c (unchecked_conversion_nop): Handle function
calls. Return true for conversion from a record subtype to its type.
bool maybe_present = false;
/* True if we made GNU_DECL and its type here. */
bool this_made_decl = false;
- /* True if debug info is requested for this entity. */
- bool debug_info_p = Needs_Debug_Info (gnat_entity);
- /* True if this entity is to be considered as imported. */
- bool imported_p = (Is_Imported (gnat_entity)
- && No (Address_Clause (gnat_entity)));
/* Size and alignment of the GCC node, if meaningful. */
unsigned int esize = 0, align = 0;
/* Contains the list of attributes directly attached to the entity. */
(TREE_TYPE (TYPE_FIELDS (gnu_type))), 1)))
static_p = true;
+ /* Now create the variable or the constant and set various flags. */
gnu_decl
= create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_expr, const_flag, Is_Public (gnat_entity),
if (TREE_CODE (gnu_decl) == CONST_DECL)
DECL_CONST_ADDRESS_P (gnu_decl) = constructor_address_p (gnu_expr);
- /* If this is declared in a block that contains a block with an
- exception handler, we must force this variable in memory to
- suppress an invalid optimization. */
- if (Has_Nested_Block_With_Handler (Scope (gnat_entity))
- && Exception_Mechanism != Back_End_Exceptions)
+ /* If this object is declared in a block that contains a block with an
+ exception handler, and we aren't using the GCC exception mechanism,
+ we must force this variable in memory in order to avoid an invalid
+ optimization. */
+ if (Exception_Mechanism != Back_End_Exceptions
+ && Has_Nested_Block_With_Handler (Scope (gnat_entity)))
TREE_ADDRESSABLE (gnu_decl) = 1;
/* If we are defining an object with variable size or an object with
debug_info_p, false);
/* If it is passed by reference, force BLKmode to ensure that objects
-+ of this type will always be put in memory. */
+ of this type will always be put in memory. */
if (Is_By_Reference_Type (gnat_entity))
SET_TYPE_MODE (gnu_type, BLKmode);
gnat_init (void)
{
/* Do little here, most of the standard declarations are set up after the
- front-end has been run. Use the same `char' as C, this doesn't really
- matter since we'll use the explicit `unsigned char' for Character. */
- build_common_tree_nodes (flag_signed_char);
-
- /* In Ada, we use the unsigned type corresponding to the width of Pmode as
- SIZETYPE. In most cases when ptr_mode and Pmode differ, C will use the
- width of ptr_mode for SIZETYPE, but we get better code using the width
- of Pmode. Note that, although we manipulate negative offsets for some
- internal constructs and rely on compile time overflow detection in size
- computations, using unsigned types for SIZETYPEs is fine since they are
- treated specially by the middle-end, in particular sign-extended. */
- size_type_node = gnat_type_for_mode (Pmode, 1);
+ front-end has been run. */
+ build_common_tree_nodes (true, true);
+
+ /* In Ada, we use a signed type for SIZETYPE. Use the signed type
+ 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);
- TYPE_NAME (sizetype) = get_identifier ("size_type");
/* In Ada, we use an unsigned 8-bit type for the default boolean type. */
boolean_type_node = make_unsigned_type (8);
SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1));
build_common_tree_nodes_2 (0);
- sbitsize_one_node = sbitsize_int (1);
- sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT);
boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
ptr_void_type_node = build_pointer_type (void_type_node);
}
}
\f
-/* Do little here. Set up the standard declarations later after the
- front end has been run. */
-
-void
-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 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_unsigned_type (8);
- TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
- SET_TYPE_RM_MAX_VALUE (boolean_type_node,
- build_int_cst (boolean_type_node, 1));
- SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1));
-
- build_common_tree_nodes_2 (0);
- boolean_true_node = TYPE_MAX_VALUE (boolean_type_node);
-
- ptr_void_type_node = build_pointer_type (void_type_node);
-}
-\f
/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */
void
new_exp = TREE_OPERAND (exp, 0);
new_exp
= build_unary_op (INDIRECT_REF, NULL_TREE,
- build_component_ref (TREE_OPERAND (exp, 0),
- get_identifier ("P_ARRAY"),
- NULL_TREE, false));
+ build_component_ref (new_exp, NULL_TREE,
+ TYPE_FIELDS
+ (TREE_TYPE (new_exp)),
+ false));
TREE_READONLY (new_exp) = TREE_READONLY (exp);
return new_exp;
}