Commit 13c1cd82 by Paul Brook Committed by Paul Brook

stor-layout.c (update_alignment_for_field): Use targetm.align_anon_bitfield.

	* stor-layout.c (update_alignment_for_field): Use
	targetm.align_anon_bitfield.
	* target-def.h (TARGET_ALIGN_ANON_BITFIELD): Define.
	(TARGET_INITIALIZER): Use it.
	* target.h (struct gcc_target): Add align_anon_bitfield.
	* config/arm/arm.c (arm_align_anon_bitfield):  New function.
	(TARGET_ALIGN_ANON_BITFIELD): Define.
	* doc/tm.texi: Document TARGET_ALIGN_ANON_BITFIELD.

From-SVN: r81838
parent ce8fc97b
2004-05-14 Paul Brook <paul@codesourcery.com>
* stor-layout.c (update_alignment_for_field): Use
targetm.align_anon_bitfield.
* target-def.h (TARGET_ALIGN_ANON_BITFIELD): Define.
(TARGET_INITIALIZER): Use it.
* target.h (struct gcc_target): Add align_anon_bitfield.
* config/arm/arm.c (arm_align_anon_bitfield): New function.
(TARGET_ALIGN_ANON_BITFIELD): Define.
* doc/tm.texi: Document TARGET_ALIGN_ANON_BITFIELD.
2004-05-13 Zack Weinberg <zack@codesourcery.com>
* tree.def (documentation): Remove mention of class 'b'.
......
......@@ -160,6 +160,7 @@ static void arm_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool arm_promote_prototypes (tree);
static bool arm_default_short_enums (void);
static bool arm_align_anon_bitfield (void);
/* Initialize the GCC target structure. */
......@@ -260,6 +261,9 @@ static bool arm_default_short_enums (void);
#undef TARGET_DEFAULT_SHORT_ENUMS
#define TARGET_DEFAULT_SHORT_ENUMS arm_default_short_enums
#undef TARGET_ALIGN_ANON_BITFIELD
#define TARGET_ALIGN_ANON_BITFIELD arm_align_anon_bitfield
struct gcc_target targetm = TARGET_INITIALIZER;
/* Obstack for minipool constant handling. */
......@@ -14565,3 +14569,12 @@ arm_default_short_enums (void)
{
return TARGET_AAPCS_BASED;
}
/* AAPCS requires that anonymous bitfields affect structure alignment. */
static bool
arm_align_anon_bitfield (void)
{
return TARGET_AAPCS_BASED;
}
......@@ -1301,6 +1301,13 @@ Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited
to aligning a bit-field within the structure.
@end defmac
@deftypefn {Target Hook} bool TARGET_ALIGN_ANON_BITFIELDS (void)
When @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determine
whether unnamed bitfields affect the alignment of the containing
structure. The hook should return true if the structure should inherit
the alignment requirements of an unnamed bitfield's type.
@end deftypefn
@defmac MEMBER_TYPE_FORCES_BLK (@var{field}, @var{mode})
Return 1 if a structure or array containing @var{field} should be accessed using
@code{BLKMODE}.
......
......@@ -771,8 +771,10 @@ update_alignment_for_field (record_layout_info rli, tree field,
else if (is_bitfield && PCC_BITFIELD_TYPE_MATTERS)
{
/* Named bit-fields cause the entire structure to have the
alignment implied by their type. */
if (DECL_NAME (field) != 0)
alignment implied by their type. Some targets also apply the same
rules to unnamed bitfields. */
if (DECL_NAME (field) != 0
|| targetm.align_anon_bitfield ())
{
unsigned int type_align = TYPE_ALIGN (type);
......
......@@ -310,6 +310,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
#define TARGET_ALIGN_ANON_BITFIELD hook_bool_void_false
#define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
#define TARGET_MANGLE_FUNDAMENTAL_TYPE hook_constcharptr_tree_null
......@@ -384,6 +385,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_INSERT_ATTRIBUTES, \
TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P, \
TARGET_MS_BITFIELD_LAYOUT_P, \
TARGET_ALIGN_ANON_BITFIELD, \
TARGET_INIT_BUILTINS, \
TARGET_EXPAND_BUILTIN, \
TARGET_MANGLE_FUNDAMENTAL_TYPE, \
......
......@@ -307,6 +307,9 @@ struct gcc_target
Microsoft Visual C++ bitfield layout rules. */
bool (* ms_bitfield_layout_p) (tree record_type);
/* Return true if anonymous bitfields affect structure alignment. */
bool (* align_anon_bitfield) (void);
/* Set up target-specific built-in functions. */
void (* init_builtins) (void);
......
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