[PATCH] IA-32 bitfields (take 3)

Richard Henderson rth@redhat.com
Wed Aug 7 08:26:00 GMT 2002


On Wed, Aug 07, 2002 at 10:56:41AM +0200, Jakub Jelinek wrote:
> 	* stor-layout.c (place_union_field): Apply ADJUST_FIELD_ALIGN
> 	to type_align when PCC_BITFIELD_TYPE_MATTERS.
> 	(place_field): Likewise.
> 	* config/i386/i386.c (x86_field_alignment): Don't check
> 	TARGET_ALIGN_DOUBLE for the second time.
> 	If field is a type, use TYPE_USER_ALIGN and the type itself
> 	instead of TREE_TYPE (field).
> 	Apply min for all MODE_INT and MODE_CLASS_INT modes.
> 	* config/rs6000/rs6000.c (rs6000_field_alignment): New.
> 	* config/rs6000/rs6000-protos.h (rs6000_field_alignment): New
> 	prototype.
> 	* config/rs6000/aix.h (ADJUST_FIELD_ALIGN): Use it.
> 	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Likewise.
> 	* config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise.
> 	* config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Handle if field is
> 	a type.
> 
> 	* gcc.dg/i386-bitfield1.c: New test.
> 	* g++.dg/abi/bitfield3.C: New test.

Looks nice.

Docs need updating.  And actually, I think the existing docs are
misleading wrt BIGGEST_FIELD_ALIGNMENT, since ADJUST_FIELD_ALIGN
is checked after BIGGEST_FIELD_ALIGNMENT not "instead of".  Also
be nice to mention that it is required that the user alignment
be tested.

> --- gcc/config/rs6000/sysv4.h.jj	2002-04-16 13:07:13.000000000 +0200
> +++ gcc/config/rs6000/sysv4.h	2002-08-07 10:30:08.000000000 +0200
> @@ -390,7 +390,9 @@ do {									\
>  /* An expression for the alignment of a structure field FIELD if the
>     alignment computed in the usual way is COMPUTED.  */
>  #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)				      \
> -	((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
> +	((TARGET_ALTIVEC						      \
> +	  && TREE_CODE (TYPE_P (FIELD) ? (FIELD) : TREE_TYPE (FIELD))	      \
> +	     == VECTOR_TYPE)						      \
>  	 ? 128 : COMPUTED)

Anyone notice that this is undefed just a couple lines below?
David, Geoff or Aldy, anyone know what's going on here?

Jakub, should this definition turn out to be required, my preference
would be to merge this into rs6000.c as well.  Should be able to
test abi == ABI_V4 after the user alignment checks and have only
one definition of ADJUST_FIELD_ALIGN in rs6000.h.


r~



More information about the Gcc-patches mailing list