aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/decl.c52
-rw-r--r--gcc/ada/gcc-interface/utils.c37
2 files changed, 46 insertions, 43 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index c1f409d..8ea72b5 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -1888,8 +1888,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
This means that bit-packed arrays are given "ceil" alignment for
their size by default, which may seem counter-intuitive but makes
it possible to overlay them on modular types easily. */
- TYPE_ALIGN (gnu_type)
- = align > 0 ? align : TYPE_ALIGN (gnu_field_type);
+ SET_TYPE_ALIGN (gnu_type,
+ align > 0 ? align : TYPE_ALIGN (gnu_field_type));
/* Propagate the reverse storage order flag to the record type so
that the required byte swapping is performed when retrieving the
@@ -1953,7 +1953,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_field_type);
TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_field_type);
SET_TYPE_ADA_SIZE (gnu_type, TYPE_RM_SIZE (gnu_field_type));
- TYPE_ALIGN (gnu_type) = align;
+ SET_TYPE_ALIGN (gnu_type, align);
relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY);
/* Don't declare the field as addressable since we won't be taking
@@ -2265,9 +2265,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (No (Packed_Array_Impl_Type (gnat_entity))
&& Known_Alignment (gnat_entity))
{
- TYPE_ALIGN (tem)
- = validate_alignment (Alignment (gnat_entity), gnat_entity,
- TYPE_ALIGN (tem));
+ SET_TYPE_ALIGN (tem,
+ validate_alignment (Alignment (gnat_entity),
+ gnat_entity,
+ TYPE_ALIGN (tem)));
if (Present (Alignment_Clause (gnat_entity)))
TYPE_USER_ALIGN (tem) = 1;
}
@@ -2296,7 +2297,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_POINTER_TO (gnu_type) = gnu_fat_type;
TYPE_REFERENCE_TO (gnu_type) = gnu_fat_type;
SET_TYPE_MODE (gnu_type, BLKmode);
- TYPE_ALIGN (gnu_type) = TYPE_ALIGN (tem);
+ SET_TYPE_ALIGN (gnu_type, TYPE_ALIGN (tem));
/* If the maximum size doesn't overflow, use it. */
if (gnu_max_size
@@ -3035,11 +3036,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Always set the alignment on the record type here so that it can
get the proper layout. */
if (has_align)
- TYPE_ALIGN (gnu_type)
- = validate_alignment (Alignment (gnat_entity), gnat_entity, 0);
+ SET_TYPE_ALIGN (gnu_type,
+ validate_alignment (Alignment (gnat_entity),
+ gnat_entity, 0));
else
{
- TYPE_ALIGN (gnu_type) = 0;
+ SET_TYPE_ALIGN (gnu_type, 0);
/* If a type needs strict alignment, the minimum size will be the
type size instead of the RM size (see validate_size). Cap the
@@ -3138,7 +3140,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
be created with a component clause below, then we need
to apply the same adjustment as in gnat_to_gnu_field. */
if (has_rep && TYPE_ALIGN (gnu_type) < TYPE_ALIGN (gnu_parent))
- TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_parent);
+ SET_TYPE_ALIGN (gnu_type, TYPE_ALIGN (gnu_parent));
/* Finally we fix up both kinds of twisted COMPONENT_REF we have
initially built. The discriminants must reference the fields
@@ -4565,8 +4567,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Set a default alignment to speed up accesses. But we
shouldn't increase the size of the structure too much,
lest it doesn't fit in return registers anymore. */
- TYPE_ALIGN (gnu_return_type)
- = get_mode_alignment (ptr_mode);
+ SET_TYPE_ALIGN (gnu_return_type,
+ get_mode_alignment (ptr_mode));
}
gnu_field
@@ -4613,8 +4615,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (mode != BLKmode)
{
SET_TYPE_MODE (gnu_return_type, mode);
- TYPE_ALIGN (gnu_return_type)
- = GET_MODE_ALIGNMENT (mode);
+ SET_TYPE_ALIGN (gnu_return_type,
+ GET_MODE_ALIGNMENT (mode));
TYPE_SIZE (gnu_return_type)
= bitsize_int (GET_MODE_BITSIZE (mode));
TYPE_SIZE_UNIT (gnu_return_type)
@@ -6796,7 +6798,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
const unsigned int type_align = TYPE_ALIGN (gnu_field_type);
if (TYPE_ALIGN (gnu_record_type) < type_align)
- TYPE_ALIGN (gnu_record_type) = type_align;
+ SET_TYPE_ALIGN (gnu_record_type, type_align);
/* If the position is not a multiple of the alignment of the type,
then error out and reset the position. */
@@ -7283,7 +7285,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
= make_node (unchecked_union ? UNION_TYPE : QUAL_UNION_TYPE);
TYPE_NAME (gnu_union_type) = gnu_union_name;
- TYPE_ALIGN (gnu_union_type) = 0;
+ SET_TYPE_ALIGN (gnu_union_type, 0);
TYPE_PACKED (gnu_union_type) = TYPE_PACKED (gnu_record_type);
TYPE_REVERSE_STORAGE_ORDER (gnu_union_type)
= TYPE_REVERSE_STORAGE_ORDER (gnu_record_type);
@@ -7336,7 +7338,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
/* Set the alignment of the inner type in case we need to make
inner objects into bitfields, but then clear it out so the
record actually gets only the alignment required. */
- TYPE_ALIGN (gnu_variant_type) = TYPE_ALIGN (gnu_record_type);
+ SET_TYPE_ALIGN (gnu_variant_type, TYPE_ALIGN (gnu_record_type));
TYPE_PACKED (gnu_variant_type) = TYPE_PACKED (gnu_record_type);
TYPE_REVERSE_STORAGE_ORDER (gnu_variant_type)
= TYPE_REVERSE_STORAGE_ORDER (gnu_record_type);
@@ -7568,9 +7570,9 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
SET_DECL_OFFSET_ALIGN (gnu_field, BIGGEST_ALIGNMENT);
DECL_FIELD_BIT_OFFSET (gnu_field) = bitsize_zero_node;
if (field_is_aliased (gnu_field))
- TYPE_ALIGN (gnu_record_type)
- = MAX (TYPE_ALIGN (gnu_record_type),
- TYPE_ALIGN (TREE_TYPE (gnu_field)));
+ SET_TYPE_ALIGN (gnu_record_type,
+ MAX (TYPE_ALIGN (gnu_record_type),
+ TYPE_ALIGN (TREE_TYPE (gnu_field))));
MOVE_FROM_FIELD_LIST_TO (gnu_zero_list);
continue;
}
@@ -7681,7 +7683,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
gnu_field_list = chainon (gnu_field_list, gnu_variant_part);
if (cancel_alignment)
- TYPE_ALIGN (gnu_record_type) = 0;
+ SET_TYPE_ALIGN (gnu_record_type, 0);
TYPE_ARTIFICIAL (gnu_record_type) = artificial;
@@ -8794,7 +8796,7 @@ create_variant_part_from (tree old_variant_part,
SET_TYPE_ADA_SIZE (new_union_type,
size_binop (MINUS_EXPR, TYPE_ADA_SIZE (record_type),
first_bit));
- TYPE_ALIGN (new_union_type) = TYPE_ALIGN (old_union_type);
+ SET_TYPE_ALIGN (new_union_type, TYPE_ALIGN (old_union_type));
relate_alias_sets (new_union_type, old_union_type, ALIAS_SET_COPY);
}
else
@@ -8891,7 +8893,7 @@ copy_and_substitute_in_size (tree new_type, tree old_type,
TYPE_SIZE (new_type) = TYPE_SIZE (old_type);
TYPE_SIZE_UNIT (new_type) = TYPE_SIZE_UNIT (old_type);
SET_TYPE_ADA_SIZE (new_type, TYPE_ADA_SIZE (old_type));
- TYPE_ALIGN (new_type) = TYPE_ALIGN (old_type);
+ SET_TYPE_ALIGN (new_type, TYPE_ALIGN (old_type));
relate_alias_sets (new_type, old_type, ALIAS_SET_COPY);
if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (new_type)))
@@ -9034,7 +9036,7 @@ substitute_in_type (tree t, tree f, tree r)
return t;
nt = build_nonshared_array_type (component, domain);
- TYPE_ALIGN (nt) = TYPE_ALIGN (t);
+ SET_TYPE_ALIGN (nt, TYPE_ALIGN (t));
TYPE_USER_ALIGN (nt) = TYPE_USER_ALIGN (t);
SET_TYPE_MODE (nt, TYPE_MODE (t));
TYPE_SIZE (nt) = SUBSTITUTE_IN_EXPR (TYPE_SIZE (t), f, r);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 9bd2773..d568dff 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -904,7 +904,7 @@ make_aligning_type (tree type, unsigned int align, tree size,
pos, 1, -1);
TYPE_FIELDS (record_type) = field;
- TYPE_ALIGN (record_type) = base_align;
+ SET_TYPE_ALIGN (record_type, base_align);
TYPE_USER_ALIGN (record_type) = 1;
TYPE_SIZE (record_type)
@@ -963,7 +963,7 @@ make_packable_type (tree type, bool in_record)
if (in_record && size <= MAX_FIXED_MODE_SIZE)
{
align = ceil_pow2 (size);
- TYPE_ALIGN (new_type) = align;
+ SET_TYPE_ALIGN (new_type, align);
new_size = (size + align - 1) & -align;
}
else
@@ -983,7 +983,7 @@ make_packable_type (tree type, bool in_record)
return type;
align = new_size & -new_size;
- TYPE_ALIGN (new_type) = MIN (TYPE_ALIGN (type), align);
+ SET_TYPE_ALIGN (new_type, MIN (TYPE_ALIGN (type), align));
}
TYPE_USER_ALIGN (new_type) = 1;
@@ -1295,7 +1295,7 @@ maybe_pad_type (tree type, tree size, unsigned int align,
else if (Present (gnat_entity))
TYPE_NAME (record) = create_concat_name (gnat_entity, "PAD");
- TYPE_ALIGN (record) = align ? align : orig_align;
+ SET_TYPE_ALIGN (record, align ? align : orig_align);
TYPE_SIZE (record) = size ? size : orig_size;
TYPE_SIZE_UNIT (record)
= convert (sizetype,
@@ -1650,7 +1650,7 @@ finish_fat_pointer_type (tree record_type, tree field_list)
{
/* Make sure we can put it into a register. */
if (STRICT_ALIGNMENT)
- TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
+ SET_TYPE_ALIGN (record_type, MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE));
/* Show what it really is. */
TYPE_FAT_POINTER_P (record_type) = 1;
@@ -1697,7 +1697,8 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
that just means some initializations; otherwise, layout the record. */
if (rep_level > 0)
{
- TYPE_ALIGN (record_type) = MAX (BITS_PER_UNIT, TYPE_ALIGN (record_type));
+ SET_TYPE_ALIGN (record_type, MAX (BITS_PER_UNIT,
+ TYPE_ALIGN (record_type)));
if (!had_size_unit)
TYPE_SIZE_UNIT (record_type) = size_zero_node;
@@ -1775,7 +1776,7 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
maximum alignment, if any. */
if (TYPE_ALIGN (record_type) >= align)
{
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field), align);
+ SET_DECL_ALIGN (field, MAX (DECL_ALIGN (field), align));
DECL_BIT_FIELD (field) = 0;
}
else if (!had_align
@@ -1784,8 +1785,8 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
&& (!TYPE_MAX_ALIGN (record_type)
|| TYPE_MAX_ALIGN (record_type) >= align))
{
- TYPE_ALIGN (record_type) = align;
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field), align);
+ SET_TYPE_ALIGN (record_type, align);
+ SET_DECL_ALIGN (field, MAX (DECL_ALIGN (field), align));
DECL_BIT_FIELD (field) = 0;
}
}
@@ -1808,8 +1809,8 @@ finish_record_type (tree record_type, tree field_list, int rep_level,
/* A type must be as aligned as its most aligned field that is not
a bit-field. But this is already enforced by layout_type. */
if (rep_level > 0 && !DECL_BIT_FIELD (field))
- TYPE_ALIGN (record_type)
- = MAX (TYPE_ALIGN (record_type), DECL_ALIGN (field));
+ SET_TYPE_ALIGN (record_type,
+ MAX (TYPE_ALIGN (record_type), DECL_ALIGN (field)));
switch (code)
{
@@ -1980,7 +1981,7 @@ rest_of_record_type_compilation (tree record_type)
= concat_name (orig_name, TREE_CODE (record_type) == QUAL_UNION_TYPE
? "XVU" : "XVE");
TYPE_NAME (new_record_type) = new_name;
- TYPE_ALIGN (new_record_type) = BIGGEST_ALIGNMENT;
+ SET_TYPE_ALIGN (new_record_type, BIGGEST_ALIGNMENT);
TYPE_STUB_DECL (new_record_type)
= create_type_stub_decl (new_name, new_record_type);
DECL_IGNORED_P (TYPE_STUB_DECL (new_record_type))
@@ -2072,7 +2073,7 @@ rest_of_record_type_compilation (tree record_type)
if (align != 0 && TYPE_ALIGN (field_type) > align)
{
field_type = copy_node (field_type);
- TYPE_ALIGN (field_type) = align;
+ SET_TYPE_ALIGN (field_type, align);
}
var = true;
}
@@ -2620,7 +2621,7 @@ create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
|| (!pos
&& AGGREGATE_TYPE_P (type)
&& aggregate_type_contains_array_p (type))))
- DECL_ALIGN (field_decl) = BITS_PER_UNIT;
+ SET_DECL_ALIGN (field_decl, BITS_PER_UNIT);
/* If a size is specified, use it. Otherwise, if the record type is packed
compute a size to use, which may differ from the object's natural size.
@@ -2667,9 +2668,9 @@ create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
{
if (TYPE_ALIGN (record_type) != 0
&& TYPE_ALIGN (record_type) < TYPE_ALIGN (type))
- DECL_ALIGN (field_decl) = TYPE_ALIGN (record_type);
+ SET_DECL_ALIGN (field_decl, TYPE_ALIGN (record_type));
else
- DECL_ALIGN (field_decl) = TYPE_ALIGN (type);
+ SET_DECL_ALIGN (field_decl, TYPE_ALIGN (type));
}
}
@@ -2685,10 +2686,10 @@ create_field_decl (tree name, tree type, tree record_type, tree size, tree pos,
: packed && TYPE_MODE (type) != BLKmode ? BITS_PER_UNIT : 0);
if (bit_align > DECL_ALIGN (field_decl))
- DECL_ALIGN (field_decl) = bit_align;
+ SET_DECL_ALIGN (field_decl, bit_align);
else if (!bit_align && TYPE_ALIGN (type) > DECL_ALIGN (field_decl))
{
- DECL_ALIGN (field_decl) = TYPE_ALIGN (type);
+ SET_DECL_ALIGN (field_decl, TYPE_ALIGN (type));
DECL_USER_ALIGN (field_decl) = TYPE_USER_ALIGN (type);
}
}