This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Generic stack alignment for user variables, v2


On Wed, Oct 6, 2010 at 8:57 AM, Richard Henderson <rth@redhat.com> 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:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46325



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]