Commit 78d55cc8 by Jason Merrill

stor-layout.c (do_type_align): New fn, split out from...

        * stor-layout.c (do_type_align): New fn, split out from...
        (layout_decl): ...here.  Do all alignment calculations for
        FIELD_DECLs here.
        (update_alignment_for_field): Not here.
        (start_record_layout, debug_rli): Remove unpadded_align.
        * tree.h (struct record_layout_info_s): Remove unpadded_align.
        * c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
        or DECL_MODE on the CONST_DECLs.
        (finish_struct): Don't mess with DECL_ALIGN.
        * cp/class.c (build_vtable): Set DECL_ALIGN here.
        (get_vtable_decl): Not here.
        (layout_vtable_decl): Or here.
        (create_vtable_ptr): Or here.
        (layout_class_type): Or here.
        (check_bitfield_decl): Don't mess with field alignment.
        * ada/misc.c (gnat_adjust_rli): #if 0.

From-SVN: r65207
parent d10f5ecf
2003-04-03 Jason Merrill <jason@redhat.com>
* stor-layout.c (do_type_align): New fn, split out from...
(layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
* tree.h (struct record_layout_info_s): Remove unpadded_align.
* c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
or DECL_MODE on the CONST_DECLs.
(finish_struct): Don't mess with DECL_ALIGN.
Thu Apr 3 18:57:19 CEST 2003 Jan Hubicka <jh@suse.cz>
* i386.c (print_operand): Do not bypass output_addr_const at flag_pic.
......
2003-04-03 Jason Merrill <jason@redhat.com>
* misc.c (gnat_adjust_rli): #if 0.
2003-03-31 Geert Bosch <bosch@gnat.com>
PR ada/10020
......@@ -19,8 +23,8 @@
2003-03-05 Olivier Hainque <hainque@gnat.com>
ada/9961
* raise.c (__gnat_Unwind_RaiseException): Add prototype to avoid
warning, and fix return type for the IN_RTS && !SJLJ case.
* raise.c (__gnat_Unwind_RaiseException): Add prototype to avoid
warning, and fix return type for the IN_RTS && !SJLJ case.
2003-03-04 Tom Tromey <tromey@redhat.com>
......
......@@ -563,8 +563,11 @@ gnat_expand_expr (exp, target, tmode, modifier)
static void
gnat_adjust_rli (rli)
record_layout_info rli;
record_layout_info rli ATTRIBUTE_UNUSED;
{
#if 0
/* This code seems to have no actual effect; record_align should already
reflect the largest alignment desired by a field. jason 2003-04-01 */
unsigned int record_align = rli->unpadded_align;
tree field;
......@@ -576,6 +579,7 @@ gnat_adjust_rli (rli)
if (TYPE_PACKED (rli->t))
rli->record_align = record_align;
#endif
}
/* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */
......
......@@ -5250,23 +5250,6 @@ finish_struct (t, fieldlist, attributes)
DECL_SIZE (x) = bitsize_int (width);
DECL_BIT_FIELD (x) = 1;
SET_DECL_C_BIT_FIELD (x);
if (width == 0
&& ! (* targetm.ms_bitfield_layout_p) (t))
{
/* field size 0 => force desired amount of alignment. */
#ifdef EMPTY_FIELD_BOUNDARY
DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
#endif
#ifdef PCC_BITFIELD_TYPE_MATTERS
if (PCC_BITFIELD_TYPE_MATTERS)
{
DECL_ALIGN (x) = MAX (DECL_ALIGN (x),
TYPE_ALIGN (TREE_TYPE (x)));
DECL_USER_ALIGN (x) |= TYPE_USER_ALIGN (TREE_TYPE (x));
}
#endif
}
}
}
......@@ -5564,11 +5547,6 @@ finish_enum (enumtype, values, attributes)
tree enu = TREE_PURPOSE (pair);
TREE_TYPE (enu) = enumtype;
DECL_SIZE (enu) = TYPE_SIZE (enumtype);
DECL_SIZE_UNIT (enu) = TYPE_SIZE_UNIT (enumtype);
DECL_ALIGN (enu) = TYPE_ALIGN (enumtype);
DECL_USER_ALIGN (enu) = TYPE_USER_ALIGN (enumtype);
DECL_MODE (enu) = TYPE_MODE (enumtype);
/* The ISO C Standard mandates enumerators to have type int,
even though the underlying type of an enum type is
......
2003-04-03 Jason Merrill <jason@redhat.com>
* class.c (build_vtable): Set DECL_ALIGN here.
(get_vtable_decl): Not here.
(layout_vtable_decl): Or here.
(create_vtable_ptr): Or here.
(layout_class_type): Or here.
(check_bitfield_decl): Don't mess with field alignment.
2003-04-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* operators.def (DEF_SIMPLE_OPERATOR, DEF_ASSN_OPERATOR,
......
......@@ -531,6 +531,11 @@ build_vtable (tree class_type, tree name, tree vtable_type)
DECL_VIRTUAL_P (decl) = 1;
DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
/* At one time the vtable info was grabbed 2 words at a time. This
fails on sparc unless you have 8-byte alignment. (tiemann) */
DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (decl));
import_export_vtable (decl, class_type, 0);
return decl;
......@@ -553,11 +558,6 @@ get_vtable_decl (tree type, int complete)
decl = build_vtable (type, get_vtable_name (type), vtbl_type_node);
CLASSTYPE_VTABLES (type) = decl;
/* At one time the vtable info was grabbed 2 words at a time. This
fails on sparc unless you have 8-byte alignment. (tiemann) */
DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (decl));
if (complete)
{
DECL_EXTERNAL (decl) = 1;
......@@ -2017,11 +2017,6 @@ layout_vtable_decl (tree binfo, int n)
TREE_TYPE (vtable) = atype;
DECL_SIZE (vtable) = DECL_SIZE_UNIT (vtable) = NULL_TREE;
layout_decl (vtable, 0);
/* At one time the vtable info was grabbed 2 words at a time. This
fails on SPARC unless you have 8-byte alignment. */
DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (vtable));
}
}
......@@ -2952,31 +2947,12 @@ check_bitfield_decl (tree field)
{
DECL_SIZE (field) = convert (bitsizetype, w);
DECL_BIT_FIELD (field) = 1;
if (integer_zerop (w)
&& ! (* targetm.ms_bitfield_layout_p) (DECL_FIELD_CONTEXT (field)))
{
#ifdef EMPTY_FIELD_BOUNDARY
DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
EMPTY_FIELD_BOUNDARY);
#endif
#ifdef PCC_BITFIELD_TYPE_MATTERS
if (PCC_BITFIELD_TYPE_MATTERS)
{
DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
TYPE_ALIGN (type));
DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
}
#endif
}
}
else
{
/* Non-bit-fields are aligned for their type. */
DECL_BIT_FIELD (field) = 0;
CLEAR_DECL_C_BIT_FIELD (field);
DECL_ALIGN (field) = MAX (DECL_ALIGN (field), TYPE_ALIGN (type));
DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type);
}
}
......@@ -4428,8 +4404,6 @@ create_vtable_ptr (tree t, tree* virtuals_p)
DECL_ARTIFICIAL (field) = 1;
DECL_FIELD_CONTEXT (field) = t;
DECL_FCONTEXT (field) = t;
DECL_ALIGN (field) = TYPE_ALIGN (vtbl_ptr_type_node);
DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (vtbl_ptr_type_node);
TYPE_VFIELD (t) = field;
......@@ -4950,8 +4924,6 @@ layout_class_type (tree t, tree *virtuals_p)
char_type_node);
DECL_BIT_FIELD (padding_field) = 1;
DECL_SIZE (padding_field) = padding;
DECL_ALIGN (padding_field) = 1;
DECL_USER_ALIGN (padding_field) = 0;
layout_nonempty_base_or_field (rli, padding_field,
NULL_TREE,
empty_base_offsets);
......
......@@ -1160,8 +1160,7 @@ make it all fit in fewer cache lines.
Alignment in bits to be given to a structure bit-field that follows an
empty field such as @code{int : 0;}.
Note that @code{PCC_BITFIELD_TYPE_MATTERS} also affects the alignment
that results from an empty field.
If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
@findex STRUCTURE_SIZE_BOUNDARY
@item STRUCTURE_SIZE_BOUNDARY
......
......@@ -2452,11 +2452,9 @@ typedef struct record_layout_info_s
tree bitpos;
/* The alignment of the record so far, in bits. */
unsigned int record_align;
/* The alignment of the record so far, not including padding, in bits. */
/* The alignment of the record so far, ignoring #pragma pack and
__attribute__ ((packed)), in bits. */
unsigned int unpacked_align;
/* The alignment of the record so far, allowing for the record to be
padded only at the end, in bits. */
unsigned int unpadded_align;
/* The previous field layed out. */
tree prev_field;
/* The static variables (i.e., class variables, as opposed to
......@@ -2464,6 +2462,8 @@ typedef struct record_layout_info_s
tree pending_statics;
/* Bits remaining in the current alignment group */
int remaining_in_alignment;
/* True if we've seen a packed field that didn't have normal
alignment anyway. */
int packed_maybe_necessary;
} *record_layout_info;
......
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