[CFT] Generic stack alignment for user variables

Richard Henderson rth@redhat.com
Fri Oct 1 22:55:00 GMT 2010


This patch implements the scheme described in

  http://gcc.gnu.org/ml/gcc-patches/2010-08/msg01406.html

Given that no target besides x86 actually implements general
stack realignment, this fixes the problem of ignoring the alignment
requirements of a given type when it's allocated on the stack.

This only handles DECLs; it makes no attempt to align the full
stack frame.  Which is ok so long as the target does not have
machine modes (think SSE) that require super-alignment.

An obvious future direction here is to define a

  __builtin_alloca_align (size_t size, size_t align)

and have all of the VLA allocations in gimplify.c and omp-low.c
use that instead of bare __builtin_alloca.  In some cases that
should be able to eliminate some extra padding and alignment code.
In others, it will provide proper alignment for super-aligned VLAs.

It has been tested on x86_64-mingw32 (which does not have the same
stack realignment support that the rest of the x86 port does), and
alpha-linux cross.  Native testing is proceeding on ppc64, sparc64,
and ia64-linux.

That said, please review and test on your platform.


r~
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: d-stackalign-1
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101001/ada7338e/attachment.ksh>


More information about the Gcc-patches mailing list