[PATCH] (was Re: i386 alignment tweaks...)

Jakub Jelinek jakub@redhat.com
Mon Jun 5 22:04:00 GMT 2000


On Mon, Jun 05, 2000 at 05:58:54PM -0700, Richard Henderson wrote:
> The patch is largely ok.
> 
> > @@ -2310,6 +2312,7 @@ layout_vtable_decl (binfo, n)
> >  	 fails on Sparc unless you have 8-byte alignment.  */
> >        DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
> >  				 DECL_ALIGN (vtable));
> > +      DECL_USER_ALIGN (vtable) |= TYPE_USER_ALIGN (double_type_node);
> 
> This shouldn't be.  The user cannot set double_type_node.
> There are a handfull of other examples of this.

Ok, will change that.

> 
> >  /* The published ABIs say that doubles should be aligned on word
> >     boundaries, so lower the aligment for structure fields unless
> > -   -malign-double is set.  */
> > -/* BIGGEST_FIELD_ALIGNMENT is also used in libobjc, where it must be
> > -   constant.  Use the smaller value in that context.  */
> > -#ifndef IN_TARGET_LIBS
> > -#define BIGGEST_FIELD_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
> > -#else
> > -#define BIGGEST_FIELD_ALIGNMENT 32
> > -#endif
> > +   -malign-double is set or unless it was overriden by attribute aligned.  */
> > +#define BIGGEST_DEFAULT_FIELD_ALIGNMENT (TARGET_ALIGN_DOUBLE ? 64 : 32)
> 
> I don't think renaming the option is a good idea.  You'd need to change
> all the other ports as well, for no apparent gain.  Just change the
> documentation for the macro to read "except if overridden by the user".

My point was that I did not want to break binary compatibility on arches
which use already BIGGEST_FIELD_ALIGNMENT (vax, os2 on i386, etc.).
The difference between BIGGEST_FIELD_ALIGNMENT and
BIGGEST_DEFAULT_FIELD_ALIGNMENT (well, I should put it into info) is:
a) BIGGEST_FIELD_ALIGNMENT applies to structures only, while
BIGGEST_DEFAULT_FIELD_ALIGNMENT applies to structures and unions
b) BIGGEST_FIELD_ALIGNMENT overrides users __attribute__
The latter can be changed, because I doubt too many people use
__attribute__ on those targets when it does not work anyway, but the former
worries me. It will mean certain unions which don't use any GNU extensions
will be no longer binary compatible.
I want to keep BIGGEST_FIELD_ALIGNMENT on vax/i386-os2 and other arches
because it worked that way for a long time. Only the i386
BIGGEST_FIELD_ALIGNMENT was changing the previous behaviour (because there
was no BIGGEST_FIELD_ALIGNMENT at all).

	Jakub


More information about the Gcc-patches mailing list