recommended alignment for local i386 FP variables patch (version 2)

Jeffrey A Law law@hurl.cygnus.com
Wed Feb 3 20:40:00 GMT 1999


  In message <199901270647.BAA16917@jwlab.FEITH.COM>you write:
  > [ This version addresses the alignment of more complex data types. ]
  > 
  > This patch causes gcc to use the recommended Intel alignment for
  > i386 FP variables when allocating them within the frame.
  > 
  > Notes:
  > 
  >   1)  This patch * does not * address the issue of aligning the frame,
  >       just the issue of aligning the variables within the frame.  There
  >       are two ways of aligning the frame which I address in two other
  >       separate patches.
Right.  However, this is probably still a reasonable thing to do -- it
helps cut down on some of the variability in homes for variables on the
stack.  This can help us get more consistent FP benchmark results.

I realize it doesn't solve the whole problem, but it does address one
side of the equation.

  >   2)  This patch is probably necessary for PREFERRED_STACK_BOUNDARY to
  >       be useful.
Yup.  The plan all along, regardless of whether or not we use
PREFERRED_STACK_BOUNDARY or align the stack in the prologue, was to have
code which would align items better relative to the start of the frame.

  >   3) It may be desirable to use DATA_ALIGNMENT instead of defining a
  >      new macro (LOCAL_ALIGNMENT).  I defined a new macro so I could
  >      use it to control the changes I made (in a separate patch) to reload.
Maybe, maybe not.  Wasted space on the stack is generally more important
than wasted space in the static store.  We may (or may not) want throttle
alignment of stack items to 64bits, with the exception of XFmode items which
we'd want to align to 128bits.  Opinions on this would be greatly appreciated.


A few additional notes.

    /* First try to find an available, already-allocated temporary that is the
       exact size we require.  */
    for (p = temp_slots; p; p = p->next)
!     if (p->align == align && p->size == size && GET_MODE (p->slot) == mode
! 	&& ! p->in_use)
        break;
This should probably say the "exact size and alignment we desire".  Or 
change the align test to p->align > align and an appropriate change to the
comment.  Similarly for code which follows that looks for slots larger than
the one we wanted.

In your change to stmt.c, you're caling assign_temp and claiming that the
result must be addressable.  It might be best to only make it addressable if
absolutely necessary.  Addressable stack slots can inhibit some optimizations.


Otherwise it looks pretty good.

jeff



More information about the Gcc-patches mailing list