\f
/* SAVE_EXPRs for sizes of types and decls, waiting to be expanded. */
-static tree pending_sizes;
+static GTY(()) tree pending_sizes;
/* Nonzero means cannot safely call expand_expr now,
so put variable sizes onto `pending_sizes' instead. */
}
if (immediate_size_expand)
- /* NULL_RTX is not defined; neither is the rtx type.
+ /* 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_RTX, VOIDmode, 0),
VOIDmode, 0);
case MODE_RANDOM:
if (mode == BLKmode)
- break;
+ break;
/* ... fall through ... */
&& (DECL_ALIGN (decl) == 0
|| (! (code == FIELD_DECL && DECL_PACKED (decl))
&& TYPE_ALIGN (type) > DECL_ALIGN (decl))))
- {
+ {
DECL_ALIGN (decl) = TYPE_ALIGN (type);
DECL_USER_ALIGN (decl) = 0;
}
}
}
- /* See if we can use an ordinary integer mode for a bit-field.
+ /* See if we can use an ordinary integer mode for a bit-field.
Conditions are: a fixed size that is correct for another mode
and occupying a complete byte or bytes on proper boundary. */
if (code == FIELD_DECL && DECL_BIT_FIELD (decl)
/* 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
- responsibility of the caller to call `free' for the storage returned.
+ responsibility of the caller to call `free' for the storage returned.
Note that garbage collection is not permitted until we finish laying
out the record. */
start_record_layout (t)
tree t;
{
- record_layout_info rli
+ record_layout_info rli
= (record_layout_info) xmalloc (sizeof (struct record_layout_info_s));
rli->t = t;
= size_binop (PLUS_EXPR, *poffset,
size_binop (MULT_EXPR, convert (sizetype, extra_aligns),
size_int (off_align / BITS_PER_UNIT)));
-
+
*pbitpos
= size_binop (FLOOR_MOD_EXPR, *pbitpos, bitsize_int (off_align));
}
unsigned int desired_align;
layout_decl (field, 0);
-
+
DECL_FIELD_OFFSET (field) = size_zero_node;
DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;
SET_DECL_OFFSET_ALIGN (field, BIGGEST_ALIGNMENT);
entire union to have `int' alignment. */
if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field))
{
- rli->record_align = MAX (rli->record_align,
+ rli->record_align = MAX (rli->record_align,
TYPE_ALIGN (TREE_TYPE (field)));
rli->unpadded_align = MAX (rli->unpadded_align,
TYPE_ALIGN (TREE_TYPE (field)));
if (TREE_CODE (rli->t) == UNION_TYPE)
rli->offset = size_binop (MAX_EXPR, rli->offset, DECL_SIZE_UNIT (field));
else if (TREE_CODE (rli->t) == QUAL_UNION_TYPE)
- rli->offset = fold (build (COND_EXPR, sizetype,
+ rli->offset = fold (build (COND_EXPR, sizetype,
DECL_QUALIFIER (field),
DECL_SIZE_UNIT (field), rli->offset));
}
unsigned int user_align;
/* The type of this field. */
tree type = TREE_TYPE (field);
-
+
if (TREE_CODE (field) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK)
return;
}
else
desired_align = 1;
- }
+ }
else
#ifdef PCC_BITFIELD_TYPE_MATTERS
if (PCC_BITFIELD_TYPE_MATTERS && type != error_mark_node
if (warn_padded && TREE_CONSTANT (unpadded_size)
&& simple_cst_equal (unpadded_size, TYPE_SIZE (rli->t)) == 0)
warning ("padding struct size to alignment boundary");
-
+
if (warn_packed && TREE_CODE (rli->t) == RECORD_TYPE
&& TYPE_PACKED (rli->t) && ! rli->packed_maybe_necessary
&& TREE_CONSTANT (unpadded_size))
return;
bitpos = int_bit_position (field);
-
+
/* Must be BLKmode if any field crosses a word boundary,
since extract_bit_field can't handle that in registers. */
if (bitpos / BITS_PER_WORD
/* With some targets, eg. c4x, it is sub-optimal
to access an aligned BLKmode structure as a scalar. */
- /* On ia64-*-hpux we need to ensure that we don't change the
- mode of a structure containing a single field or else we
- will pass it incorrectly. Since a structure with a single
- field causes mode to get set above we can't allow the
- check for mode == VOIDmode in this case. Perhaps
- MEMBER_TYPE_FORCES_BLK should be extended to include mode
- as an argument and the check could be put in there for c4x. */
-
- if ((mode == VOIDmode || FUNCTION_ARG_REG_LITTLE_ENDIAN)
- && MEMBER_TYPE_FORCES_BLK (field))
+ if (MEMBER_TYPE_FORCES_BLK (field, mode))
return;
#endif /* MEMBER_TYPE_FORCES_BLK */
}
TYPE_MODE (type) = BLKmode;
if (TYPE_SIZE (type) != 0
#ifdef MEMBER_TYPE_FORCES_BLK
- && ! MEMBER_TYPE_FORCES_BLK (type)
+ && ! MEMBER_TYPE_FORCES_BLK (type, VOIDmode)
#endif
/* BLKmode elements force BLKmode aggregate;
else extract/store fields may lose. */
/* Compute the final TYPE_SIZE, TYPE_ALIGN, etc. for TYPE. For
records and unions, finish_record_layout already called this
function. */
- if (TREE_CODE (type) != RECORD_TYPE
+ if (TREE_CODE (type) != RECORD_TYPE
&& TREE_CODE (type) != UNION_TYPE
&& TREE_CODE (type) != QUAL_UNION_TYPE)
finalize_type_size (type);
TYPE_REFERENCE_TO (sizetype_tab[i]) = 0;
}
- ggc_add_tree_root ((tree *) &sizetype_tab, ARRAY_SIZE (sizetype_tab));
-
/* Go down each of the types we already made and set the proper type
for the sizes in them. */
for (t = early_type_list; t != 0; t = TREE_CHAIN (t))
return mode;
}
-/* This function is run once to initialize stor-layout.c. */
-
-void
-init_stor_layout_once ()
-{
- ggc_add_tree_root (&pending_sizes, 1);
-}
+#include "gt-stor-layout.h"