Commit feec4372 by Eric Botcazou Committed by Eric Botcazou

ada-tree.def: Fix formatting nits.

	* gcc-interface/ada-tree.def: Fix formatting nits.
	(REGION_STMT): Delete.
	(HANDLER_STMT): Likewise.
	* gcc-interface/ada-tree.h: Fix formatting nits.
	(IS_STMT): Delete.
	(REGION_STMT_BODY): Likewise.
	(REGION_STMT_HANDLE): Likewise.
	(REGION_STMT_BLOCK): Likewise.
	(HANDLER_STMT_ARG): Likewise.
	(HANDLER_STMT_LIST): Likewise.
	(HANDLER_STMT_BLOCK): Likewise.
	* gcc-interface/gigi.h (fp_prec_to_size): Update comment.
	(fp_size_to_prec): Likewise.
	(largest_move_alignment): Delete.
	(gnat_compute_largest_alignment): Likewise.
	Fix minor nits.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
	Remove redundant code.
	<E_Array_Type>: Remove redundant assert.
	<E_Array_Subtype>: Exit early from index computation in pathological
	cases.
	Rewrite conditional assignment.
	(make_type_from_size): Likewise.
	* gcc-interface/misc.c (largest_move_alignment): Delete.
	(gnat_finish_incomplete_decl): Likewise.
	(LANG_HOOKS_FINISH_INCOMPLETE_DECL): Likewise.
	(asm_out_file): Likewise
	(gnat_print_type) <INTEGER_TYPE>: Fall through to ENUMERAL_TYPE case.
	(gnat_dwarf_name): Move around.
	* gcc-interface/trans.c (Attribute_to_gnu): Fix minor nits.
	(gigi): Remove call to gnat_compute_largest_alignment.
	* utils.c (create_field_decl): Rewrite conditional assignment.
	Fix minor nits.

From-SVN: r146551
parent 7d83f4f5
2009-04-22 Eric Botcazou <ebotcazou@adacore.com> 2009-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.def: Fix formatting nits.
(REGION_STMT): Delete.
(HANDLER_STMT): Likewise.
* gcc-interface/ada-tree.h: Fix formatting nits.
(IS_STMT): Delete.
(REGION_STMT_BODY): Likewise.
(REGION_STMT_HANDLE): Likewise.
(REGION_STMT_BLOCK): Likewise.
(HANDLER_STMT_ARG): Likewise.
(HANDLER_STMT_LIST): Likewise.
(HANDLER_STMT_BLOCK): Likewise.
* gcc-interface/gigi.h (fp_prec_to_size): Update comment.
(fp_size_to_prec): Likewise.
(largest_move_alignment): Delete.
(gnat_compute_largest_alignment): Likewise.
Fix minor nits.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
Remove redundant code.
<E_Array_Type>: Remove redundant assert.
<E_Array_Subtype>: Exit early from index computation in pathological
cases.
Rewrite conditional assignment.
(make_type_from_size): Likewise.
* gcc-interface/misc.c (largest_move_alignment): Delete.
(gnat_finish_incomplete_decl): Likewise.
(LANG_HOOKS_FINISH_INCOMPLETE_DECL): Likewise.
(asm_out_file): Likewise
(gnat_print_type) <INTEGER_TYPE>: Fall through to ENUMERAL_TYPE case.
(gnat_dwarf_name): Move around.
* gcc-interface/trans.c (Attribute_to_gnu): Fix minor nits.
(gigi): Remove call to gnat_compute_largest_alignment.
* utils.c (create_field_decl): Rewrite conditional assignment.
Fix minor nits.
2009-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Compute is_type predicate * gcc-interface/decl.c (gnat_to_gnu_entity): Compute is_type predicate
on entry. Defer common processing for types. Reorder and clean up. on entry. Defer common processing for types. Reorder and clean up.
Compute the equivalent GNAT node and the default size for types only. Compute the equivalent GNAT node and the default size for types only.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* Specification * * Specification *
* * * *
* 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 * * 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- *
...@@ -23,17 +23,15 @@ ...@@ -23,17 +23,15 @@
* * * *
****************************************************************************/ ****************************************************************************/
/* A type that is an unconstrained array itself. This node is never passed /* A type that is an unconstrained array. This node is never passed to GCC.
to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE is
is the type of a record containing the template and data. */ the type of a record containing the template and data. */
DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", tcc_type, 0) DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", tcc_type, 0)
/* A reference to an unconstrained array. This node only exists as an /* A reference to an unconstrained array. This node only exists as an
intermediate node during the translation of a GNAT tree to a GCC tree; intermediate node during the translation of a GNAT tree to a GCC tree;
it is never passed to GCC. The only field used is operand 0, which it is never passed to GCC. The only field used is operand 0, which
is the fat pointer object. */ is the fat pointer object. */
DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref",
tcc_reference, 1) tcc_reference, 1)
...@@ -51,7 +49,7 @@ DEFTREECODE (MINUS_NOMOD_EXPR, "minus_nomod_expr", tcc_binary, 2) ...@@ -51,7 +49,7 @@ DEFTREECODE (MINUS_NOMOD_EXPR, "minus_nomod_expr", tcc_binary, 2)
/* Same as ADDR_EXPR, except that if the operand represents a bit field, /* Same as ADDR_EXPR, except that if the operand represents a bit field,
return the address of the byte containing the bit. This is used return the address of the byte containing the bit. This is used
for the 'Address attribute and never shows up in the tree. */ for the Address attribute and never shows up in the tree. */
DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1) DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1)
/* Here are the tree codes for the statement types known to Ada. These /* Here are the tree codes for the statement types known to Ada. These
...@@ -64,10 +62,10 @@ DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1) ...@@ -64,10 +62,10 @@ DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1)
DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1) DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1)
/* A loop. LOOP_STMT_TOP_COND and LOOP_STMT_BOT_COND are the tests to exit a /* A loop. LOOP_STMT_TOP_COND and LOOP_STMT_BOT_COND are the tests to exit a
loop at the top and bottom, respectively. LOOP_STMT_UPDATE is the statement loop at the top and bottom respectively. LOOP_STMT_UPDATE is the statement
to update the loop iterator at the continue point. LOOP_STMT_BODY are the to update the loop iterator at the continue point. LOOP_STMT_BODY are the
statements in the body of the loop. LOOP_STMT_LABEL points to the LABEL_DECL statements in the body of the loop. LOOP_STMT_LABEL points to the
of the end label of the loop. */ LABEL_DECL of the end label of the loop. */
DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5) DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5)
/* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if /* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if
...@@ -75,15 +73,3 @@ DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5) ...@@ -75,15 +73,3 @@ DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5)
the loop is unconditionally exited. EXIT_STMT_LABEL is the end label the loop is unconditionally exited. EXIT_STMT_LABEL is the end label
corresponding to the loop to exit. */ corresponding to the loop to exit. */
DEFTREECODE (EXIT_STMT, "exit_stmt", tcc_statement, 2) DEFTREECODE (EXIT_STMT, "exit_stmt", tcc_statement, 2)
/* A exception region. REGION_STMT_BODY is the statement to be executed
inside the region. REGION_STMT_HANDLE is a statement that represents
the exception handlers (usually a BLOCK_STMT of HANDLE_STMTs).
REGION_STMT_BLOCK is the BLOCK node for the declarative region, if any. */
DEFTREECODE (REGION_STMT, "region_stmt", tcc_statement, 3)
/* An exception handler. HANDLER_STMT_ARG is the value to pass to
expand_start_catch, HANDLER_STMT_LIST is the list of statements for the
handler itself, and HANDLER_STMT_BLOCK is the BLOCK node for this
binding. */
DEFTREECODE (HANDLER_STMT, "handler_stmt", tcc_statement, 3)
...@@ -30,8 +30,8 @@ union lang_tree_node ...@@ -30,8 +30,8 @@ union lang_tree_node
{ {
union tree_node GTY((tag ("0"))) t; union tree_node GTY((tag ("0"))) t;
}; };
struct lang_decl GTY(()) {tree t; }; struct lang_decl GTY(()) { tree t; };
struct lang_type GTY(()) {tree t; }; struct lang_type GTY(()) { tree t; };
/* Define macros to get and set the tree in TYPE_ and DECL_LANG_SPECIFIC. */ /* Define macros to get and set the tree in TYPE_ and DECL_LANG_SPECIFIC. */
#define GET_TYPE_LANG_SPECIFIC(NODE) \ #define GET_TYPE_LANG_SPECIFIC(NODE) \
...@@ -154,12 +154,12 @@ struct lang_type GTY(()) {tree t; }; ...@@ -154,12 +154,12 @@ struct lang_type GTY(()) {tree t; };
/* True if TYPE can alias any other types. */ /* True if TYPE can alias any other types. */
#define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE) #define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE)
/* This field is only defined for FUNCTION_TYPE nodes. If the Ada /* This field is only defined for FUNCTION_TYPE nodes. If the Ada subprogram
subprogram contains no parameters passed by copy in/copy out then this contains no parameters passed by copy in/copy out then this field is zero.
field is 0. Otherwise it points to a list of nodes used to specify the Otherwise it points to a list of nodes used to specify the return values
return values of the out (or in out) parameters that qualify to be passed of the out (or in out) parameters that qualify to be passed by copy in/
by copy in copy out. It is a CONSTRUCTOR. For a full description of the copy out. For a full description of the copy in/copy out parameter passing
cico parameter passing mechanism refer to the routine gnat_to_gnu_entity. */ mechanism refer to the routine gnat_to_gnu_entity. */
#define TYPE_CI_CO_LIST(NODE) TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE)) #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. */ /* For integral types, this is the RM Size of the type. */
...@@ -298,12 +298,9 @@ struct lang_type GTY(()) {tree t; }; ...@@ -298,12 +298,9 @@ struct lang_type GTY(()) {tree t; };
discriminant number. */ discriminant number. */
#define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE)) #define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
/* Define fields and macros for statements. /* Define fields and macros for statements. */
#define IS_ADA_STMT(NODE) \
Start by defining which tree codes are used for statements. */ (STATEMENT_CLASS_P (NODE) && TREE_CODE (NODE) >= STMT_STMT)
#define IS_STMT(NODE) (STATEMENT_CLASS_P (NODE))
#define IS_ADA_STMT(NODE) (IS_STMT (NODE) \
&& TREE_CODE (NODE) >= STMT_STMT)
#define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0) #define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0)
#define LOOP_STMT_TOP_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0) #define LOOP_STMT_TOP_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0)
...@@ -313,9 +310,3 @@ struct lang_type GTY(()) {tree t; }; ...@@ -313,9 +310,3 @@ struct lang_type GTY(()) {tree t; };
#define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 4) #define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 4)
#define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0) #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0)
#define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1) #define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1)
#define REGION_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 0)
#define REGION_STMT_HANDLE(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 1)
#define REGION_STMT_BLOCK(NODE) TREE_OPERAND_CHECK_CODE (NODE, REGION_STMT, 2)
#define HANDLER_STMT_ARG(NODE) TREE_OPERAND_CHECK_CODE (NODE, HANDLER_STMT, 0)
#define HANDLER_STMT_LIST(NODE) TREE_OPERAND_CHECK_CODE (NODE, HANDLER_STMT, 1)
#define HANDLER_STMT_BLOCK(NODE) TREE_OPERAND_CHECK_CODE(NODE, HANDLER_STMT, 2)
...@@ -363,7 +363,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -363,7 +363,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
else else
max_esize = LONG_LONG_TYPE_SIZE; max_esize = LONG_LONG_TYPE_SIZE;
esize = MIN (esize, max_esize); if (esize > max_esize)
esize = max_esize;
} }
else else
esize = LONG_LONG_TYPE_SIZE; esize = LONG_LONG_TYPE_SIZE;
...@@ -1578,13 +1579,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1578,13 +1579,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_BIASED_REPRESENTATION_P (gnu_type) TYPE_BIASED_REPRESENTATION_P (gnu_type)
= Has_Biased_Representation (gnat_entity); = Has_Biased_Representation (gnat_entity);
/* This should be an unsigned type if the lower bound is constant /* This should be an unsigned type if the base type is unsigned or
and non-negative or if the base type is unsigned; a signed type if the lower bound is constant and non-negative (as computed by
otherwise. */ layout_type) or if the type is biased. */
TYPE_UNSIGNED (gnu_type) TYPE_UNSIGNED (gnu_type) = (TYPE_UNSIGNED (TREE_TYPE (gnu_type))
= (TYPE_UNSIGNED (TREE_TYPE (gnu_type))
|| (TREE_CODE (TYPE_MIN_VALUE (gnu_type)) == INTEGER_CST
&& TREE_INT_CST_HIGH (TYPE_MIN_VALUE (gnu_type)) >= 0)
|| TYPE_BIASED_REPRESENTATION_P (gnu_type) || TYPE_BIASED_REPRESENTATION_P (gnu_type)
|| Is_Unsigned_Type (gnat_entity)); || Is_Unsigned_Type (gnat_entity));
...@@ -1979,14 +1977,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1979,14 +1977,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_NONALIASED_COMPONENT (tem) = 1; TYPE_NONALIASED_COMPONENT (tem) = 1;
} }
/* If an alignment is specified, use it if valid. But ignore it for /* If an alignment is specified, use it if valid. But ignore it
types that represent the unpacked base type for packed arrays. If for the original type of packed array types. If the alignment
the alignment was requested with an explicit user alignment clause, was requested with an explicit alignment clause, state so. */
state so. */
if (No (Packed_Array_Type (gnat_entity)) if (No (Packed_Array_Type (gnat_entity))
&& Known_Alignment (gnat_entity)) && Known_Alignment (gnat_entity))
{ {
gcc_assert (Present (Alignment (gnat_entity)));
TYPE_ALIGN (tem) TYPE_ALIGN (tem)
= validate_alignment (Alignment (gnat_entity), gnat_entity, = validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (tem)); TYPE_ALIGN (tem));
...@@ -2124,13 +2120,19 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2124,13 +2120,19 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& TREE_CODE (gnu_min) == INTEGER_CST && TREE_CODE (gnu_min) == INTEGER_CST
&& TREE_CODE (gnu_max) == INTEGER_CST && TREE_CODE (gnu_max) == INTEGER_CST
&& TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max) && TREE_OVERFLOW (gnu_min) && TREE_OVERFLOW (gnu_max)
&& (!TREE_OVERFLOW && !TREE_OVERFLOW
(fold_build2 (MINUS_EXPR, gnu_index_subtype, (fold_build2 (MINUS_EXPR, gnu_index_subtype,
TYPE_MAX_VALUE (gnu_index_subtype), TYPE_MAX_VALUE (gnu_index_subtype),
TYPE_MIN_VALUE (gnu_index_subtype))))) TYPE_MIN_VALUE (gnu_index_subtype))))
{ {
TREE_OVERFLOW (gnu_min) = 0; TREE_OVERFLOW (gnu_min) = 0;
TREE_OVERFLOW (gnu_max) = 0; TREE_OVERFLOW (gnu_max) = 0;
if (tree_int_cst_lt (gnu_max, gnu_min))
{
gnu_min = size_one_node;
gnu_max = size_zero_node;
}
gnu_high = gnu_max;
} }
/* Similarly, if the range is null, use bounds of 1..0 for /* Similarly, if the range is null, use bounds of 1..0 for
...@@ -2144,42 +2146,59 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2144,42 +2146,59 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& (TREE_OVERFLOW (gnu_min) || TREE_OVERFLOW (gnu_max)) && (TREE_OVERFLOW (gnu_min) || TREE_OVERFLOW (gnu_max))
&& tree_int_cst_lt (TYPE_MAX_VALUE (gnu_index_subtype), && tree_int_cst_lt (TYPE_MAX_VALUE (gnu_index_subtype),
TYPE_MIN_VALUE (gnu_index_subtype))) TYPE_MIN_VALUE (gnu_index_subtype)))
gnu_min = size_one_node, gnu_max = size_zero_node; {
gnu_min = size_one_node;
/* Now compute the size of this bound. We need to provide gnu_max = size_zero_node;
GCC with an upper bound to use but have to deal with the gnu_high = gnu_max;
"superflat" case. There are three ways to do this. If we }
can prove that the array can never be superflat, we can
just use the high bound of the index subtype. If we can
prove that the low bound minus one can't overflow, we
can do this as MAX (hb, lb - 1). Otherwise, we have to use
the expression hb >= lb ? hb : lb - 1. */
gnu_high = size_binop (MINUS_EXPR, gnu_min, size_one_node);
/* See if the base array type is already flat. If it is, we /* See if the base array type is already flat. If it is, we
are probably compiling an ACVC test, but it will cause the are probably compiling an ACATS test, but it will cause the
code below to malfunction if we don't handle it specially. */ code below to malfunction if we don't handle it specially. */
if (TREE_CODE (gnu_base_min) == INTEGER_CST else if (TREE_CODE (gnu_base_min) == INTEGER_CST
&& TREE_CODE (gnu_base_max) == INTEGER_CST && TREE_CODE (gnu_base_max) == INTEGER_CST
&& !TREE_OVERFLOW (gnu_base_min) && !TREE_OVERFLOW (gnu_base_min)
&& !TREE_OVERFLOW (gnu_base_max) && !TREE_OVERFLOW (gnu_base_max)
&& tree_int_cst_lt (gnu_base_max, gnu_base_min)) && tree_int_cst_lt (gnu_base_max, gnu_base_min))
gnu_high = size_zero_node, gnu_min = size_one_node; {
gnu_min = size_one_node;
gnu_max = size_zero_node;
gnu_high = gnu_max;
}
else
{
/* Now compute the size of this bound. We need to provide
GCC with an upper bound to use but have to deal with the
"superflat" case. There are three ways to do this. If
we can prove that the array can never be superflat, we
can just use the high bound of the index subtype. If we
can prove that the low bound minus one can't overflow,
we can do this as MAX (hb, lb - 1). Otherwise, we have
to use the expression hb >= lb ? hb : lb - 1. */
gnu_high = size_binop (MINUS_EXPR, gnu_min, size_one_node);
/* If gnu_high is now an integer which overflowed, the array /* If gnu_high is now an integer which overflowed, the array
cannot be superflat. */ cannot be superflat. */
else if (TREE_CODE (gnu_high) == INTEGER_CST if (TREE_CODE (gnu_high) == INTEGER_CST
&& TREE_OVERFLOW (gnu_high)) && TREE_OVERFLOW (gnu_high))
gnu_high = gnu_max; gnu_high = gnu_max;
/* gnu_high cannot overflow if the subtype is unsigned since
sizetype is signed, or if it is now a constant that hasn't
overflowed. */
else if (TYPE_UNSIGNED (gnu_base_subtype) else if (TYPE_UNSIGNED (gnu_base_subtype)
|| TREE_CODE (gnu_high) == INTEGER_CST) || TREE_CODE (gnu_high) == INTEGER_CST)
gnu_high = size_binop (MAX_EXPR, gnu_max, gnu_high); gnu_high = size_binop (MAX_EXPR, gnu_max, gnu_high);
else else
gnu_high gnu_high
= build_cond_expr = build_cond_expr (sizetype,
(sizetype, build_binary_op (GE_EXPR, integer_type_node, build_binary_op (GE_EXPR,
integer_type_node,
gnu_max, gnu_min), gnu_max, gnu_min),
gnu_max, gnu_high); gnu_max, gnu_high);
}
gnu_index_type[index] gnu_index_type[index]
= create_index_type (gnu_min, gnu_high, gnu_index_subtype, = create_index_type (gnu_min, gnu_high, gnu_index_subtype,
...@@ -7338,7 +7357,8 @@ make_type_from_size (tree type, tree size_tree, bool for_biased) ...@@ -7338,7 +7357,8 @@ make_type_from_size (tree type, tree size_tree, bool for_biased)
break; break;
biased_p |= for_biased; biased_p |= for_biased;
size = MIN (size, LONG_LONG_TYPE_SIZE); if (size > LONG_LONG_TYPE_SIZE)
size = LONG_LONG_TYPE_SIZE;
if (TYPE_UNSIGNED (type) || biased_p) if (TYPE_UNSIGNED (type) || biased_p)
new_type = make_unsigned_type (size); new_type = make_unsigned_type (size);
......
...@@ -25,30 +25,6 @@ ...@@ -25,30 +25,6 @@
/* Declare all functions and types used by gigi. */ /* Declare all functions and types used by gigi. */
/* The largest alignment, in bits, that is needed for using the widest
move instruction. */
extern unsigned int largest_move_alignment;
/* Compute the alignment of the largest mode that can be used for copying
objects. */
extern void gnat_compute_largest_alignment (void);
/* GNU_TYPE is a type. Determine if it should be passed by reference by
default. */
extern bool default_pass_by_ref (tree gnu_type);
/* GNU_TYPE is the type of a subprogram parameter. Determine from the type
if it should be passed by reference. */
extern bool must_pass_by_ref (tree gnu_type);
/* Initialize DUMMY_NODE_TABLE. */
extern void init_dummy_type (void);
/* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a
GCC type corresponding to that entity. GNAT_ENTITY is assumed to
refer to an Ada type. */
extern tree gnat_to_gnu_type (Entity_Id gnat_entity);
/* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
entity, this routine returns the equivalent GCC tree for that entity entity, this routine returns the equivalent GCC tree for that entity
(an ..._DECL node) and associates the ..._DECL node with the input GNAT (an ..._DECL node) and associates the ..._DECL node with the input GNAT
...@@ -71,6 +47,10 @@ extern tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, ...@@ -71,6 +47,10 @@ extern tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr,
FIELD_DECL. */ FIELD_DECL. */
extern tree gnat_to_gnu_field_decl (Entity_Id gnat_entity); extern tree gnat_to_gnu_field_decl (Entity_Id gnat_entity);
/* Similar, but GNAT_ENTITY is assumed to refer to a GNAT type. Return
the GCC type corresponding to that entity. */
extern tree gnat_to_gnu_type (Entity_Id gnat_entity);
/* Wrap up compilation of T, a TYPE_DECL, possibly deferring it. */ /* Wrap up compilation of T, a TYPE_DECL, possibly deferring it. */
extern void rest_of_type_decl_compilation (tree t); extern void rest_of_type_decl_compilation (tree t);
...@@ -98,7 +78,7 @@ extern void add_decl_expr (tree gnu_decl, Entity_Id gnat_entity); ...@@ -98,7 +78,7 @@ extern void add_decl_expr (tree gnu_decl, Entity_Id gnat_entity);
/* Mark nodes rooted at *TP with TREE_VISITED and types as having their /* Mark nodes rooted at *TP with TREE_VISITED and types as having their
sized gimplified. We use this to indicate all variable sizes and sized gimplified. We use this to indicate all variable sizes and
positions in global types may not be shared by any subprogram. */ positions in global types may not be shared by any subprogram. */
extern void mark_visited (tree *); extern void mark_visited (tree *tp);
/* Finalize any From_With_Type incomplete types. We do this after processing /* Finalize any From_With_Type incomplete types. We do this after processing
our compilation unit and after processing its spec, if this is a body. */ our compilation unit and after processing its spec, if this is a body. */
...@@ -110,7 +90,7 @@ extern void finalize_from_with_types (void); ...@@ -110,7 +90,7 @@ extern void finalize_from_with_types (void);
for its representation, return GNAT_ENTITY. If a type is supposed to for its representation, return GNAT_ENTITY. If a type is supposed to
exist, but does not, abort unless annotating types, in which case exist, but does not, abort unless annotating types, in which case
return Empty. If GNAT_ENTITY is Empty, return Empty. */ return Empty. If GNAT_ENTITY is Empty, return Empty. */
extern Entity_Id Gigi_Equivalent_Type (Entity_Id); extern Entity_Id Gigi_Equivalent_Type (Entity_Id gnat_entity);
/* Given GNAT_ENTITY, elaborate all expressions that are required to /* Given GNAT_ENTITY, elaborate all expressions that are required to
be elaborated at the point of its definition, but do nothing else. */ be elaborated at the point of its definition, but do nothing else. */
...@@ -120,9 +100,6 @@ extern void elaborate_entity (Entity_Id gnat_entity); ...@@ -120,9 +100,6 @@ extern void elaborate_entity (Entity_Id gnat_entity);
any entities on its entity chain similarly. */ any entities on its entity chain similarly. */
extern void mark_out_of_scope (Entity_Id gnat_entity); extern void mark_out_of_scope (Entity_Id gnat_entity);
/* Make a dummy type corresponding to GNAT_TYPE. */
extern tree make_dummy_type (Entity_Id gnat_type);
/* Get the unpadded version of a GNAT type. */ /* Get the unpadded version of a GNAT type. */
extern tree get_unpadded_type (Entity_Id gnat_entity); extern tree get_unpadded_type (Entity_Id gnat_entity);
...@@ -227,7 +204,7 @@ extern tree gnat_to_gnu (Node_Id gnat_node); ...@@ -227,7 +204,7 @@ extern tree gnat_to_gnu (Node_Id gnat_node);
/* GNU_STMT is a statement. We generate code for that statement. */ /* GNU_STMT is a statement. We generate code for that statement. */
extern void gnat_expand_stmt (tree gnu_stmt); extern void gnat_expand_stmt (tree gnu_stmt);
/* ??? missing documentation */ /* Generate GIMPLE in place for the expression at *EXPR_P. */
extern int gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, extern int gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p ATTRIBUTE_UNUSED); gimple_seq *post_p ATTRIBUTE_UNUSED);
...@@ -244,7 +221,7 @@ extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus); ...@@ -244,7 +221,7 @@ extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus);
/* Post an error message. MSG is the error message, properly annotated. /* Post an error message. MSG is the error message, properly annotated.
NODE is the node at which to post the error and the node to use for the NODE is the node at which to post the error and the node to use for the
"&" substitution. */ "&" substitution. */
extern void post_error (const char *, Node_Id); extern void post_error (const char *msg, Node_Id node);
/* Similar, but NODE is the node at which to post the error and ENT /* Similar, but NODE is the node at which to post the error and ENT
is the node to use for the "&" substitution. */ is the node to use for the "&" substitution. */
...@@ -273,7 +250,7 @@ extern tree protect_multiple_eval (tree exp); ...@@ -273,7 +250,7 @@ extern tree protect_multiple_eval (tree exp);
/* Return a label to branch to for the exception type in KIND or NULL_TREE /* Return a label to branch to for the exception type in KIND or NULL_TREE
if none. */ if none. */
extern tree get_exception_label (char); extern tree get_exception_label (char kind);
/* Current node being treated, in case gigi_abort or Check_Elaboration_Code /* Current node being treated, in case gigi_abort or Check_Elaboration_Code
called. */ called. */
...@@ -496,6 +473,9 @@ extern tree convert (tree type, tree expr); ...@@ -496,6 +473,9 @@ extern tree convert (tree type, tree expr);
/* Routines created solely for the tree translator's sake. Their prototypes /* Routines created solely for the tree translator's sake. Their prototypes
can be changed as desired. */ can be changed as desired. */
/* Initialize the association of GNAT nodes to GCC trees. */
extern void init_gnat_to_gnu (void);
/* GNAT_ENTITY is a GNAT tree node for a defining identifier. /* GNAT_ENTITY is a GNAT tree node for a defining identifier.
GNU_DECL is the GCC tree which is to be associated with GNU_DECL is the GCC tree which is to be associated with
GNAT_ENTITY. Such gnu tree node is always an ..._DECL node. GNAT_ENTITY. Such gnu tree node is always an ..._DECL node.
...@@ -512,8 +492,11 @@ extern tree get_gnu_tree (Entity_Id gnat_entity); ...@@ -512,8 +492,11 @@ extern tree get_gnu_tree (Entity_Id gnat_entity);
/* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */ /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */
extern bool present_gnu_tree (Entity_Id gnat_entity); extern bool present_gnu_tree (Entity_Id gnat_entity);
/* Initialize tables for above routines. */ /* Initialize the association of GNAT nodes to GCC trees as dummies. */
extern void init_gnat_to_gnu (void); extern void init_dummy_type (void);
/* Make a dummy type corresponding to GNAT_TYPE. */
extern tree make_dummy_type (Entity_Id gnat_type);
/* Record TYPE as a builtin type for Ada. NAME is the name of the type. */ /* Record TYPE as a builtin type for Ada. NAME is the name of the type. */
extern void record_builtin_type (const char *name, tree type); extern void record_builtin_type (const char *name, tree type);
...@@ -600,7 +583,7 @@ extern tree create_type_decl (tree type_name, tree type, ...@@ -600,7 +583,7 @@ extern tree create_type_decl (tree type_name, tree type,
it indicates whether to always allocate storage to the variable. it indicates whether to always allocate storage to the variable.
GNAT_NODE is used for the position of the decl. */ GNAT_NODE is used for the position of the decl. */
tree extern tree
create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, 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 const_flag, bool public_flag, bool extern_flag,
bool static_flag, bool const_decl_allowed_p, bool static_flag, bool const_decl_allowed_p,
...@@ -629,11 +612,11 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init, ...@@ -629,11 +612,11 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
/* Given a DECL and ATTR_LIST, apply the listed attributes. */ /* Given a DECL and ATTR_LIST, apply the listed attributes. */
extern void process_attributes (tree decl, struct attrib *attr_list); extern void process_attributes (tree decl, struct attrib *attr_list);
/* Record a global renaming pointer. */ /* Record DECL as a global renaming pointer. */
void record_global_renaming_pointer (tree); extern void record_global_renaming_pointer (tree decl);
/* Invalidate the global renaming pointers. */ /* Invalidate the global renaming pointers. */
void invalidate_global_renaming_pointers (void); extern void invalidate_global_renaming_pointers (void);
/* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its /* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its
type, and RECORD_TYPE is the type of the parent. PACKED is nonzero if type, and RECORD_TYPE is the type of the parent. PACKED is nonzero if
...@@ -743,13 +726,13 @@ extern tree maybe_unconstrained_array (tree exp); ...@@ -743,13 +726,13 @@ extern tree maybe_unconstrained_array (tree exp);
If NOTRUNC_P is true, truncation operations should be suppressed. */ If NOTRUNC_P is true, truncation operations should be suppressed. */
extern tree unchecked_convert (tree type, tree expr, bool notrunc_p); extern tree unchecked_convert (tree type, tree expr, bool notrunc_p);
/* Return the appropriate GCC tree code for the specified GNAT type, /* Return the appropriate GCC tree code for the specified GNAT_TYPE,
the latter being a record type as predicated by Is_Record_Type. */ the latter being a record type as predicated by Is_Record_Type. */
extern enum tree_code tree_code_for_record_type (Entity_Id); extern enum tree_code tree_code_for_record_type (Entity_Id gnat_type);
/* Return true if GNU_TYPE is suitable as the type of a non-aliased /* Return true if GNU_TYPE is suitable as the type of a non-aliased
component of an aggregate type. */ component of an aggregate type. */
extern bool type_for_nonaliased_component_p (tree); extern bool type_for_nonaliased_component_p (tree gnu_type);
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical /* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical
operation. operation.
...@@ -870,6 +853,14 @@ extern tree gnat_builtin_function (tree decl); ...@@ -870,6 +853,14 @@ extern tree gnat_builtin_function (tree decl);
Return the first node found, if any, or NULL_TREE otherwise. */ Return the first node found, if any, or NULL_TREE otherwise. */
extern tree builtin_decl_for (tree name); extern tree builtin_decl_for (tree name);
/* GNU_TYPE is a type. Determine if it should be passed by reference by
default. */
extern bool default_pass_by_ref (tree gnu_type);
/* GNU_TYPE is the type of a subprogram parameter. Determine from the type
if it should be passed by reference. */
extern bool must_pass_by_ref (tree gnu_type);
/* This function is called by the front end to enumerate all the supported /* This function is called by the front end to enumerate all the supported
modes for the machine. We pass a function which is called back with modes for the machine. We pass a function which is called back with
the following integer parameters: the following integer parameters:
...@@ -884,9 +875,10 @@ extern tree builtin_decl_for (tree name); ...@@ -884,9 +875,10 @@ extern tree builtin_decl_for (tree name);
extern void enumerate_modes (void (*f) (int, int, int, int, int, int, extern void enumerate_modes (void (*f) (int, int, int, int, int, int,
unsigned int)); unsigned int));
/* These are temporary function to deal with recent GCC changes related to /* Return the size of the FP mode with precision PREC. */
FP type sizes and precisions. */
extern int fp_prec_to_size (int prec); extern int fp_prec_to_size (int prec);
/* Return the precision of the FP mode with size SIZE. */
extern int fp_size_to_prec (int size); extern int fp_size_to_prec (int size);
/* These functions return the basic data type sizes and related parameters /* These functions return the basic data type sizes and related parameters
......
...@@ -72,14 +72,7 @@ ...@@ -72,14 +72,7 @@
#include "opts.h" #include "opts.h"
#include "options.h" #include "options.h"
extern FILE *asm_out_file;
/* The largest alignment, in bits, that is needed for using the widest
move instruction. */
unsigned int largest_move_alignment;
static bool gnat_init (void); static bool gnat_init (void);
static void gnat_finish_incomplete_decl (tree);
static unsigned int gnat_init_options (unsigned int, const char **); static unsigned int gnat_init_options (unsigned int, const char **);
static int gnat_handle_option (size_t, const char *, int); static int gnat_handle_option (size_t, const char *, int);
static bool gnat_post_options (const char **); static bool gnat_post_options (const char **);
...@@ -118,8 +111,6 @@ static tree gnat_type_max_size (const_tree); ...@@ -118,8 +111,6 @@ static tree gnat_type_max_size (const_tree);
#define LANG_HOOKS_PUSHDECL gnat_return_tree #define LANG_HOOKS_PUSHDECL gnat_return_tree
#undef LANG_HOOKS_WRITE_GLOBALS #undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations #define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL gnat_finish_incomplete_decl
#undef LANG_HOOKS_GET_ALIAS_SET #undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set
#undef LANG_HOOKS_MARK_ADDRESSABLE #undef LANG_HOOKS_MARK_ADDRESSABLE
...@@ -153,18 +144,14 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; ...@@ -153,18 +144,14 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
are incompatible with regular GDB versions, so we must make sure to only are incompatible with regular GDB versions, so we must make sure to only
produce them on explicit request. This is eventually reflected into the produce them on explicit request. This is eventually reflected into the
use_gnu_debug_info_extensions common flag for later processing. */ use_gnu_debug_info_extensions common flag for later processing. */
static int gnat_dwarf_extensions = 0; static int gnat_dwarf_extensions = 0;
/* Command-line argc and argv. /* Command-line argc and argv. These variables are global
These variables are global, since they are imported and used in since they are imported in back_end.adb. */
back_end.adb */
unsigned int save_argc; unsigned int save_argc;
const char **save_argv; const char **save_argv;
/* gnat standard argc argv */ /* GNAT argc and argv. */
extern int gnat_argc; extern int gnat_argc;
extern char **gnat_argv; extern char **gnat_argv;
...@@ -202,8 +189,8 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -202,8 +189,8 @@ gnat_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
/* Decode all the language specific options that cannot be decoded by GCC. /* Decode all the language specific options that cannot be decoded by GCC.
The option decoding phase of GCC calls this routine on the flags that The option decoding phase of GCC calls this routine on the flags that
it cannot decode. This routine returns the number of consecutive arguments it cannot decode. Return the number of consecutive arguments from ARGV
from ARGV that it successfully decoded; 0 indicates failure. */ that have been successfully decoded or 0 on failure. */
static int static int
gnat_handle_option (size_t scode, const char *arg, int value) gnat_handle_option (size_t scode, const char *arg, int value)
...@@ -427,34 +414,6 @@ gnat_init (void) ...@@ -427,34 +414,6 @@ gnat_init (void)
return true; return true;
} }
/* This function is called indirectly from toplev.c to handle incomplete
declarations, i.e. VAR_DECL nodes whose DECL_SIZE is zero. To be precise,
compile_file in toplev.c makes an indirect call through the function pointer
incomplete_decl_finalize_hook which is initialized to this routine in
init_decl_processing. */
static void
gnat_finish_incomplete_decl (tree dont_care ATTRIBUTE_UNUSED)
{
gcc_unreachable ();
}
/* Compute the alignment of the largest mode that can be used for copying
objects. */
void
gnat_compute_largest_alignment (void)
{
enum machine_mode mode;
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
if (optab_handler (mov_optab, mode)->insn_code != CODE_FOR_nothing)
largest_move_alignment = MIN (BIGGEST_ALIGNMENT,
MAX (largest_move_alignment,
GET_MODE_ALIGNMENT (mode)));
}
/* If we are using the GCC mechanism to process exception handling, we /* If we are using the GCC mechanism to process exception handling, we
have to register the personality routine for Ada and to initialize have to register the personality routine for Ada and to initialize
various language dependent hooks. */ various language dependent hooks. */
...@@ -506,7 +465,7 @@ gnat_init_gcc_eh (void) ...@@ -506,7 +465,7 @@ gnat_init_gcc_eh (void)
#endif #endif
} }
/* Language hooks, first one to print language-specific items in a DECL. */ /* Print language-specific items in declaration NODE. */
static void static void
gnat_print_decl (FILE *file, tree node, int indent) gnat_print_decl (FILE *file, tree node, int indent)
...@@ -533,6 +492,8 @@ gnat_print_decl (FILE *file, tree node, int indent) ...@@ -533,6 +492,8 @@ gnat_print_decl (FILE *file, tree node, int indent)
} }
} }
/* Print language-specific items in type NODE. */
static void static void
gnat_print_type (FILE *file, tree node, int indent) gnat_print_type (FILE *file, tree node, int indent)
{ {
...@@ -542,11 +503,6 @@ gnat_print_type (FILE *file, tree node, int indent) ...@@ -542,11 +503,6 @@ gnat_print_type (FILE *file, tree node, int indent)
print_node (file, "ci_co_list", TYPE_CI_CO_LIST (node), indent + 4); print_node (file, "ci_co_list", TYPE_CI_CO_LIST (node), indent + 4);
break; break;
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
print_node (file, "RM size", TYPE_RM_SIZE (node), indent + 4);
break;
case INTEGER_TYPE: case INTEGER_TYPE:
if (TYPE_MODULAR_P (node)) if (TYPE_MODULAR_P (node))
print_node (file, "modulus", TYPE_MODULUS (node), indent + 4); print_node (file, "modulus", TYPE_MODULUS (node), indent + 4);
...@@ -558,6 +514,10 @@ gnat_print_type (FILE *file, tree node, int indent) ...@@ -558,6 +514,10 @@ gnat_print_type (FILE *file, tree node, int indent)
else else
print_node (file, "index type", TYPE_INDEX_TYPE (node), indent + 4); print_node (file, "index type", TYPE_INDEX_TYPE (node), indent + 4);
/* ... fall through ... */
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
print_node (file, "RM size", TYPE_RM_SIZE (node), indent + 4); print_node (file, "RM size", TYPE_RM_SIZE (node), indent + 4);
break; break;
...@@ -583,13 +543,7 @@ gnat_print_type (FILE *file, tree node, int indent) ...@@ -583,13 +543,7 @@ gnat_print_type (FILE *file, tree node, int indent)
} }
} }
static const char * /* Return the name to be printed for DECL. */
gnat_dwarf_name (tree t, int verbosity ATTRIBUTE_UNUSED)
{
gcc_assert (DECL_P (t));
return (const char *) IDENTIFIER_POINTER (DECL_NAME (t));
}
static const char * static const char *
gnat_printable_name (tree decl, int verbosity) gnat_printable_name (tree decl, int verbosity)
...@@ -604,10 +558,19 @@ gnat_printable_name (tree decl, int verbosity) ...@@ -604,10 +558,19 @@ gnat_printable_name (tree decl, int verbosity)
Set_Identifier_Casing (ada_name, (char *) DECL_SOURCE_FILE (decl)); Set_Identifier_Casing (ada_name, (char *) DECL_SOURCE_FILE (decl));
return ggc_strdup (Name_Buffer); return ggc_strdup (Name_Buffer);
} }
else
return ada_name; return ada_name;
} }
/* Return the name to be used in DWARF debug info for DECL. */
static const char *
gnat_dwarf_name (tree decl, int verbosity ATTRIBUTE_UNUSED)
{
gcc_assert (DECL_P (decl));
return (const char *) IDENTIFIER_POINTER (DECL_NAME (decl));
}
/* Do nothing (return the tree node passed). */ /* Do nothing (return the tree node passed). */
static tree static tree
...@@ -810,6 +773,8 @@ enumerate_modes (void (*f) (int, int, int, int, int, int, unsigned int)) ...@@ -810,6 +773,8 @@ enumerate_modes (void (*f) (int, int, int, int, int, int, unsigned int))
} }
} }
/* Return the size of the FP mode with precision PREC. */
int int
fp_prec_to_size (int prec) fp_prec_to_size (int prec)
{ {
...@@ -823,6 +788,8 @@ fp_prec_to_size (int prec) ...@@ -823,6 +788,8 @@ fp_prec_to_size (int prec)
gcc_unreachable (); gcc_unreachable ();
} }
/* Return the precision of the FP mode with size SIZE. */
int int
fp_size_to_prec (int size) fp_size_to_prec (int size)
{ {
......
...@@ -301,7 +301,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, ...@@ -301,7 +301,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
/* Initialize ourselves. */ /* Initialize ourselves. */
init_code_table (); init_code_table ();
init_gnat_to_gnu (); init_gnat_to_gnu ();
gnat_compute_largest_alignment ();
init_dummy_type (); init_dummy_type ();
/* If we are just annotating types, give VOID_TYPE zero sizes to avoid /* If we are just annotating types, give VOID_TYPE zero sizes to avoid
...@@ -1058,7 +1057,7 @@ Pragma_to_gnu (Node_Id gnat_node) ...@@ -1058,7 +1057,7 @@ Pragma_to_gnu (Node_Id gnat_node)
return gnu_result; return gnu_result;
} }
/* Subroutine of gnat_to_gnu to translate gnat_node, an N_Attribute, /* Subroutine of gnat_to_gnu to translate GNAT_NODE, an N_Attribute node,
to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to to a GCC tree, which is returned. GNU_RESULT_TYPE_P is a pointer to
where we should place the result type. ATTRIBUTE is the attribute ID. */ where we should place the result type. ATTRIBUTE is the attribute ID. */
...@@ -1075,20 +1074,19 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1075,20 +1074,19 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
/* If the input is a NULL_EXPR, make a new one. */ /* If the input is a NULL_EXPR, make a new one. */
if (TREE_CODE (gnu_prefix) == NULL_EXPR) if (TREE_CODE (gnu_prefix) == NULL_EXPR)
{ {
*gnu_result_type_p = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
return build1 (NULL_EXPR, *gnu_result_type_p, *gnu_result_type_p = gnu_result_type;
TREE_OPERAND (gnu_prefix, 0)); return build1 (NULL_EXPR, gnu_result_type, TREE_OPERAND (gnu_prefix, 0));
} }
switch (attribute) switch (attribute)
{ {
case Attr_Pos: case Attr_Pos:
case Attr_Val: case Attr_Val:
/* These are just conversions until since representation clauses for /* These are just conversions since representation clauses for
enumerations are handled in the front end. */ enumeration types are handled in the front-end. */
{ {
bool checkp = Do_Range_Check (First (Expressions (gnat_node))); bool checkp = Do_Range_Check (First (Expressions (gnat_node)));
gnu_result = gnat_to_gnu (First (Expressions (gnat_node))); gnu_result = gnat_to_gnu (First (Expressions (gnat_node)));
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = convert_with_check (Etype (gnat_node), gnu_result, gnu_result = convert_with_check (Etype (gnat_node), gnu_result,
...@@ -1098,8 +1096,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1098,8 +1096,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Pred: case Attr_Pred:
case Attr_Succ: case Attr_Succ:
/* These just add or subject the constant 1. Representation clauses for /* These just add or subtract the constant 1 since representation
enumerations are handled in the front-end. */ clauses for enumeration types are handled in the front-end. */
gnu_expr = gnat_to_gnu (First (Expressions (gnat_node))); gnu_expr = gnat_to_gnu (First (Expressions (gnat_node)));
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
...@@ -1117,16 +1115,15 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1117,16 +1115,15 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
} }
gnu_result gnu_result
= build_binary_op (attribute == Attr_Pred = build_binary_op (attribute == Attr_Pred ? MINUS_EXPR : PLUS_EXPR,
? MINUS_EXPR : PLUS_EXPR,
gnu_result_type, gnu_expr, gnu_result_type, gnu_expr,
convert (gnu_result_type, integer_one_node)); convert (gnu_result_type, integer_one_node));
break; break;
case Attr_Address: case Attr_Address:
case Attr_Unrestricted_Access: case Attr_Unrestricted_Access:
/* Conversions don't change something's address but can cause us to miss /* Conversions don't change addresses but can cause us to miss the
the COMPONENT_REF case below, so strip them off. */ COMPONENT_REF case below, so strip them off. */
gnu_prefix = remove_conversions (gnu_prefix, gnu_prefix = remove_conversions (gnu_prefix,
!Must_Be_Byte_Aligned (gnat_node)); !Must_Be_Byte_Aligned (gnat_node));
...@@ -1237,9 +1234,9 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1237,9 +1234,9 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
/* If this is an unconstrained array, we know the object must have been /* If this is an unconstrained array, we know the object has been
allocated with the template in front of the object. So compute the allocated with the template in front of the object. So compute
template address.*/ the template address. */
if (TYPE_FAT_POINTER_P (TREE_TYPE (gnu_ptr))) if (TYPE_FAT_POINTER_P (TREE_TYPE (gnu_ptr)))
gnu_ptr gnu_ptr
= convert (build_pointer_type = convert (build_pointer_type
...@@ -1273,7 +1270,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1273,7 +1270,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Max_Size_In_Storage_Elements: case Attr_Max_Size_In_Storage_Elements:
gnu_expr = gnu_prefix; gnu_expr = gnu_prefix;
/* Remove NOPS from gnu_expr and conversions from gnu_prefix. /* Remove NOPs from GNU_EXPR and conversions from GNU_PREFIX.
We only use GNU_EXPR to see if a COMPONENT_REF was involved. */ We only use GNU_EXPR to see if a COMPONENT_REF was involved. */
while (TREE_CODE (gnu_expr) == NOP_EXPR) while (TREE_CODE (gnu_expr) == NOP_EXPR)
gnu_expr = TREE_OPERAND (gnu_expr, 0); gnu_expr = TREE_OPERAND (gnu_expr, 0);
...@@ -1351,8 +1348,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1351,8 +1348,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
gcc_assert (gnu_result); gcc_assert (gnu_result);
/* Deal with a self-referential size by returning the maximum size for a /* Deal with a self-referential size by returning the maximum size for
type and by qualifying the size with the object for 'Size of an a type and by qualifying the size with the object for 'Size of an
object. */ object. */
if (CONTAINS_PLACEHOLDER_P (gnu_result)) if (CONTAINS_PLACEHOLDER_P (gnu_result))
{ {
...@@ -1663,8 +1660,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1663,8 +1660,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
break; break;
} }
/* If this has a PLACEHOLDER_EXPR, qualify it by the object /* If this has a PLACEHOLDER_EXPR, qualify it by the object we are
we are handling. */ handling. */
gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix); gnu_result = SUBSTITUTE_PLACEHOLDER_IN_EXPR (gnu_result, gnu_prefix);
break; break;
} }
...@@ -1714,8 +1711,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1714,8 +1711,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
break; break;
case Attr_Null_Parameter: case Attr_Null_Parameter:
/* This is just a zero cast to the pointer type for /* This is just a zero cast to the pointer type for our prefix and
our prefix and dereferenced. */ dereferenced. */
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result gnu_result
= build_unary_op (INDIRECT_REF, NULL_TREE, = build_unary_op (INDIRECT_REF, NULL_TREE,
...@@ -1755,8 +1752,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1755,8 +1752,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
default: default:
/* Say we have an unimplemented attribute. Then set the value to be /* Say we have an unimplemented attribute. Then set the value to be
returned to be a zero and hope that's something we can convert to the returned to be a zero and hope that's something we can convert to
type of this attribute. */ the type of this attribute. */
post_error ("unimplemented attribute", gnat_node); post_error ("unimplemented attribute", gnat_node);
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = integer_zero_node; gnu_result = integer_zero_node;
......
...@@ -1472,10 +1472,13 @@ create_field_decl (tree field_name, tree field_type, tree record_type, ...@@ -1472,10 +1472,13 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
DECL_BIT_FIELD (field_decl) = 1; DECL_BIT_FIELD (field_decl) = 1;
DECL_SIZE (field_decl) = size; DECL_SIZE (field_decl) = size;
if (!packed && !pos) if (!packed && !pos)
DECL_ALIGN (field_decl) {
= (TYPE_ALIGN (record_type) != 0 if (TYPE_ALIGN (record_type) != 0
? MIN (TYPE_ALIGN (record_type), TYPE_ALIGN (field_type)) && TYPE_ALIGN (record_type) < TYPE_ALIGN (field_type))
: TYPE_ALIGN (field_type)); DECL_ALIGN (field_decl) = TYPE_ALIGN (record_type);
else
DECL_ALIGN (field_decl) = TYPE_ALIGN (field_type);
}
} }
DECL_PACKED (field_decl) = pos ? DECL_BIT_FIELD (field_decl) : packed; DECL_PACKED (field_decl) = pos ? DECL_BIT_FIELD (field_decl) : packed;
...@@ -1636,7 +1639,7 @@ process_attributes (tree decl, struct attrib *attr_list) ...@@ -1636,7 +1639,7 @@ process_attributes (tree decl, struct attrib *attr_list)
} }
} }
/* Record a global renaming pointer. */ /* Record DECL as a global renaming pointer. */
void void
record_global_renaming_pointer (tree decl) record_global_renaming_pointer (tree decl)
...@@ -4520,7 +4523,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) ...@@ -4520,7 +4523,7 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
return expr; return expr;
} }
/* Return the appropriate GCC tree code for the specified GNAT type, /* Return the appropriate GCC tree code for the specified GNAT_TYPE,
the latter being a record type as predicated by Is_Record_Type. */ the latter being a record type as predicated by Is_Record_Type. */
enum tree_code enum tree_code
......
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