This is the mail archive of the
mailing list for the GCC project.
Re: [RFA] Generic stack alignment for user variables, v2
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 5 Nov 2010 20:32:06 -0700
- Subject: Re: [RFA] Generic stack alignment for user variables, v2
- References: <4CA666D1.firstname.lastname@example.org> <4CAC9C54.email@example.com>
On Wed, Oct 6, 2010 at 8:57 AM, Richard Henderson <firstname.lastname@example.org> wrote:
> On 10/01/2010 03:55 PM, Richard Henderson wrote:
>> 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.
> The patch has now passed bootstrap and testing on i686, x86_64, ppc64,
> sparc64, and ia64-linux.
> The last failures that Jack Howarth mentioned elsewhere in this thread
> were common to all i686 targets as I hadn't realized the MINIMUM_ALIGNMENT
> hook could actually reduce the alignment of a variable. ?Thus the full
> difference between this and the most recently posted fragment is
> -+ ? ? ?/* Make sure we're only increasing alignment. ?*/
> -+ ? ? ?gcc_assert (DECL_ALIGN (decl) <= align);
> ++ ? ? ?/* One would think that we could assert that we're not decreasing
> ++ ? ? ? alignment here, but (at least) the i386 port does exactly this
> ++ ? ? ? via the MINIMUM_ALIGNMENT hook. ?*/
This patch caused: