if (immediate_size_expand)
/* NULL_RTX is not defined; neither is the rtx type.
Also, we would like to pass const0_rtx here, but don't have it. */
- expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0),
+ expand_expr (size, expand_expr (integer_zero_node, NULL_RTX, VOIDmode, 0),
VOIDmode, 0);
else if (cfun != 0 && cfun->x_dont_save_pending_sizes_p)
/* The front-end doesn't want us to keep a list of the expressions
}
}
\f
+/* Hook for a front-end function that can modify the record layout as needed
+ immediately before it is finalized. */
+
+void (*lang_adjust_rli) PARAMS ((record_layout_info)) = 0;
+
+void
+set_lang_adjust_rli (f)
+ void (*f) PARAMS ((record_layout_info));
+{
+ lang_adjust_rli = f;
+}
+
/* Begin laying out type T, which may be a RECORD_TYPE, UNION_TYPE, or
QUAL_UNION_TYPE. Return a pointer to a struct record_layout_info which
is to be passed to all other layout functions for this record. It is the
declaration, for example) use it -- otherwise, start with a
one-byte alignment. */
rli->record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (t));
- rli->unpacked_align = rli->record_align;
+ rli->unpacked_align = rli->unpadded_align = rli->record_align;
rli->offset_align = MAX (rli->record_align, BIGGEST_ALIGNMENT);
#ifdef STRUCTURE_SIZE_BOUNDARY
print_node_brief (stderr, "\noffset", rli->offset, 0);
print_node_brief (stderr, " bitpos", rli->bitpos, 0);
- fprintf (stderr, "\nrec_align = %u, unpack_align = %u, off_align = %u\n",
- rli->record_align, rli->unpacked_align, rli->offset_align);
+ fprintf (stderr, "\naligns: rec = %u, unpack = %u, unpad = %u, off = %u\n",
+ rli->record_align, rli->unpacked_align, rli->unpadded_align,
+ rli->offset_align);
if (rli->packed_maybe_necessary)
fprintf (stderr, "packed may be necessary\n");
/* Union must be at least as aligned as any field requires. */
rli->record_align = MAX (rli->record_align, desired_align);
+ rli->unpadded_align = MAX (rli->unpadded_align, desired_align);
#ifdef PCC_BITFIELD_TYPE_MATTERS
/* On the m88000, a bit field of declare type `int' forces the
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->record_align = MAX (rli->record_align,
+ TYPE_ALIGN (TREE_TYPE (field)));
+ rli->unpadded_align = MAX (rli->unpadded_align,
+ TYPE_ALIGN (TREE_TYPE (field)));
+ }
#endif
/* We assume the union's size will be a multiple of a byte so we don't
type_align = MIN (type_align, BITS_PER_UNIT);
rli->record_align = MAX (rli->record_align, type_align);
+ rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field));
if (warn_packed)
- rli->unpacked_align = MAX (rli->unpacked_align,
- TYPE_ALIGN (type));
+ rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
}
}
else
{
rli->record_align = MAX (rli->record_align, desired_align);
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
+ rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field));
}
if (warn_packed && DECL_PACKED (field))
case OFFSET_TYPE:
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
- TYPE_MODE (type) = ptr_mode;
+ /* A pointer might be MODE_PARTIAL_INT,
+ but ptrdiff_t must be integral. */
+ TYPE_MODE (type) = mode_for_size (POINTER_SIZE, MODE_INT, 0);
break;
case FUNCTION_TYPE:
if (TREE_CODE (type) == QUAL_UNION_TYPE)
TYPE_FIELDS (type) = nreverse (TYPE_FIELDS (type));
+ if (lang_adjust_rli)
+ (*lang_adjust_rli) (rli);
+
/* Finish laying out the record. */
finish_record_layout (rli);
}