summaryrefslogtreecommitdiffstats
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-07 21:05:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-07 21:05:16 +0000
commit77d0f168ac0b07d083251fd187aacc0dba5eb036 (patch)
tree7249cbfca426d8f5536a573cc0ed13427c382e6b /gcc/stor-layout.c
parentb251a88aec7938d49d28ef096fdca9c9774a4516 (diff)
downloadppe42-gcc-77d0f168ac0b07d083251fd187aacc0dba5eb036.tar.gz
ppe42-gcc-77d0f168ac0b07d083251fd187aacc0dba5eb036.zip
* stor-layout.c (place_union_field): Apply ADJUST_FIELD_ALIGN
to type_align when PCC_BITFIELD_TYPE_MATTERS. Only apply ADJUST_FIELD_ALIGN if not DECL_USER_ALIGN resp. TYPE_USER_ALIGN. (place_field): Likewise. * config/i386/i386.c (x86_field_alignment): Don't check DECL_USER_ALIGN here. * config/rs6000/rs6000.c (rs6000_field_alignment): New. * config/rs6000/rs6000-protos.h (rs6000_field_alignment): New prototype. * config/rs6000/rs6000.h (ADJUST_FIELD_ALIGN): Define. * config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Remove. * config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Remove. * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Remove. * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Remove. * doc/tm.texi (ADJUST_FIELD_ALIGN): Update description. * gcc.dg/i386-bitfield1.c: New test. * g++.dg/abi/bitfield3.C: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56107 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 753e41d29ad..5a4041e5af0 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -671,7 +671,8 @@ place_union_field (rli, field)
#endif
#ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ if (! DECL_USER_ALIGN (field))
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
#endif
TYPE_USER_ALIGN (rli->t) |= DECL_USER_ALIGN (field);
@@ -685,10 +686,14 @@ place_union_field (rli, field)
entire union to have `int' alignment. */
if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field))
{
- rli->record_align = MAX (rli->record_align,
- TYPE_ALIGN (TREE_TYPE (field)));
- rli->unpadded_align = MAX (rli->unpadded_align,
- TYPE_ALIGN (TREE_TYPE (field)));
+ unsigned int type_align = TYPE_ALIGN (TREE_TYPE (field));
+
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (TREE_TYPE (field)))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+ rli->record_align = MAX (rli->record_align, type_align);
+ rli->unpadded_align = MAX (rli->unpadded_align, type_align);
}
#endif
@@ -785,7 +790,8 @@ place_field (rli, field)
#endif
#ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ if (! user_align)
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
#endif
/* Record must have at least as much alignment as any field.
@@ -829,6 +835,11 @@ place_field (rli, field)
{
unsigned int type_align = TYPE_ALIGN (type);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
else if (DECL_PACKED (field))
@@ -917,6 +928,11 @@ place_field (rli, field)
HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0);
HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
/* A bit field may not span more units of alignment of its type
than its type itself. Advance to next boundary if necessary. */
if ((((offset * BITS_PER_UNIT + bit_offset + field_size +
@@ -946,6 +962,11 @@ place_field (rli, field)
HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0);
HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
/* ??? This test is opposite the test in the containing if
OpenPOWER on IntegriCloud