diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2012-05-06 10:41:03 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-05-06 10:41:03 +0000 |
commit | 842d4ee2add5d9bc624857c3545d27f70e2fd37b (patch) | |
tree | 2b6e941a54364ab5cb9615c2ee43302a788c946f /gcc/ada/gcc-interface/gigi.h | |
parent | 6295740973a67863a7a941c8d3f83d92b117abbc (diff) | |
download | gcc-842d4ee2add5d9bc624857c3545d27f70e2fd37b.zip gcc-842d4ee2add5d9bc624857c3545d27f70e2fd37b.tar.gz gcc-842d4ee2add5d9bc624857c3545d27f70e2fd37b.tar.bz2 |
gigi.h (make_packable_type): Declare.
* gcc-interface/gigi.h (make_packable_type): Declare.
(make_type_from_size): Likewise.
(relate_alias_sets): Likewise.
(maybe_pad_type): Adjust.
(init_gnat_to_gnu): Delete.
(destroy_gnat_to_gnu): Likewise.
(init_dummy_type): Likewise.
(destroy_dummy_type): Likewise.
(init_gnat_utils): Declare.
(destroy_gnat_utils): Likewise.
(ceil_pow2): New inline function.
* gcc-interface/decl.c (gnat_to_gnu_entity): Use ceil_pow2.
<object>: Pass True for the final processing of alignment and size.
<E_Subprogram_Type>: Only create the TYPE_DECL for a padded return
type if necessary.
(round_up_to_align): Delete.
(ceil_alignment): Likewise.
(relate_alias_sets): Move to...
(make_aligning_type): Likewise.
(make_packable_type): Likewise.
(maybe_pad_type): Likewise.
(make_type_from_size): Likewise.
* gcc-interface/utils.c (MAX_BITS_PER_WORD): Delete.
(struct pad_type_hash): New type.
(pad_type_hash_table): New static variable.
(init_gnat_to_gnu): Merge into...
(init_dummy_type): Likewise.
(init_gnat_utils): ...this. New function.
(destroy_gnat_to_gnu): Merge into...
(destroy_dummy_type): Likewise.
(destroy_gnat_utils): ...this. New function.
(pad_type_hash_marked_p): New function.
(pad_type_hash_hash): Likewise.
(pad_type_hash_eq): Likewise.
(relate_alias_sets): ...here.
(make_aligning_type): Likewise.
(make_packable_type): Likewise.
(maybe_pad_type): Likewise. Change same_rm_size parameter into
set_rm_size; do not set TYPE_ADA_SIZE if it is false. Do not set
null as Ada size. Do not set TYPE_VOLATILE on the padded type. If it
is complete and has constant size, canonicalize it. Bail out earlier
if a warning need not be issued.
(make_type_from_size): Likewise.
<INTEGER_TYPE>: Bail out if size is too large
(gnat_types_compatible_p): Do not deal with padded types.
(convert): Compare main variants for padded types.
* gcc-interface/trans.c (gigi): Call {init|destroy}_gnat_utils.
(gnat_to_gnu): Do not convert at the end for a call to a function that
returns an unconstrained type with default discriminant.
(Attribute_to_gnu) <Attr_Size>: Simplify handling of padded objects.
* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Likewise.
Do not use the padded type if it is BLKmode and the inner type is
non-BLKmode.
From-SVN: r187206
Diffstat (limited to 'gcc/ada/gcc-interface/gigi.h')
-rw-r--r-- | gcc/ada/gcc-interface/gigi.h | 62 |
1 files changed, 46 insertions, 16 deletions
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index fb1106f..e2aac80 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -123,18 +123,48 @@ extern tree get_minimal_subprog_decl (Entity_Id gnat_entity); extern tree make_aligning_type (tree type, unsigned int align, tree size, unsigned int base_align, int room); +/* TYPE is a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE that is being used + as the field type of a packed record if IN_RECORD is true, or as the + component type of a packed array if IN_RECORD is false. See if we can + rewrite it either as a type that has a non-BLKmode, which we can pack + tighter in the packed record case, or as a smaller type. If so, return + the new type. If not, return the original type. */ +extern tree make_packable_type (tree type, bool in_record); + +/* Given a type TYPE, return a new type whose size is appropriate for SIZE. + If TYPE is the best type, return it. Otherwise, make a new type. We + only support new integral and pointer types. FOR_BIASED is true if + we are making a biased type. */ +extern tree make_type_from_size (tree type, tree size_tree, bool for_biased); + /* Ensure that TYPE has SIZE and ALIGN. Make and return a new padded type if needed. We have already verified that SIZE and TYPE are large enough. GNAT_ENTITY is used to name the resulting record and to issue a warning. - IS_COMPONENT_TYPE is true if this is being done for the component type - of an array. IS_USER_TYPE is true if we must complete the original type. - DEFINITION is true if this type is being defined. SAME_RM_SIZE is true - if the RM size of the resulting type is to be set to SIZE too; otherwise, - it's set to the RM size of the original type. */ + IS_COMPONENT_TYPE is true if this is being done for the component type of + an array. IS_USER_TYPE is true if the original type needs to be completed. + DEFINITION is true if this type is being defined. SET_RM_SIZE is true if + the RM size of the resulting type is to be set to SIZE too. */ extern tree maybe_pad_type (tree type, tree size, unsigned int align, Entity_Id gnat_entity, bool is_component_type, bool is_user_type, bool definition, - bool same_rm_size); + bool set_rm_size); + +enum alias_set_op +{ + ALIAS_SET_COPY, + ALIAS_SET_SUBSET, + ALIAS_SET_SUPERSET +}; + +/* Relate the alias sets of GNU_NEW_TYPE and GNU_OLD_TYPE according to OP. + If this is a multi-dimensional array type, do this recursively. + + OP may be + - ALIAS_SET_COPY: the new set is made a copy of the old one. + - ALIAS_SET_SUPERSET: the new set is made a superset of the old one. + - ALIAS_SET_SUBSET: the new set is made a subset of the old one. */ +extern void relate_alias_sets (tree gnu_new_type, tree gnu_old_type, + enum alias_set_op op); /* Given a GNU tree and a GNAT list of choices, generate an expression to test the value passed against the list of choices. */ @@ -497,11 +527,11 @@ extern tree convert_to_index_type (tree expr); /* Routines created solely for the tree translator's sake. Their prototypes can be changed as desired. */ -/* Initialize the association of GNAT nodes to GCC trees. */ -extern void init_gnat_to_gnu (void); +/* Initialize data structures of the utils.c module. */ +extern void init_gnat_utils (void); -/* Destroy the association of GNAT nodes to GCC trees. */ -extern void destroy_gnat_to_gnu (void); +/* Destroy data structures of the utils.c module. */ +extern void destroy_gnat_utils (void); /* GNAT_ENTITY is a GNAT tree node for a defining identifier. GNU_DECL is the GCC tree which is to be associated with @@ -519,12 +549,6 @@ extern tree get_gnu_tree (Entity_Id gnat_entity); /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */ extern bool present_gnu_tree (Entity_Id gnat_entity); -/* Initialize the association of GNAT nodes to GCC trees as dummies. */ -extern void init_dummy_type (void); - -/* Destroy the association of GNAT nodes to GCC trees as dummies. */ -extern void destroy_dummy_type (void); - /* Make a dummy type corresponding to GNAT_TYPE. */ extern tree make_dummy_type (Entity_Id gnat_type); @@ -1008,3 +1032,9 @@ extern void enumerate_modes (void (*f) (const char *, int, int, int, int, int, /* Convenient shortcuts. */ #define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE) + +static inline unsigned HOST_WIDE_INT +ceil_pow2 (unsigned HOST_WIDE_INT x) +{ + return (unsigned HOST_WIDE_INT) 1 << (floor_log2 (x - 1) + 1); +} |