PATCH: PR target/40838: gcc shouldn't assume that the stack is aligned

H.J. Lu hjl.tools@gmail.com
Tue Oct 20 19:10:00 GMT 2009


On Mon, Oct 19, 2009 at 5:48 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Mon, 19 Oct 2009, H.J. Lu wrote:
>
>> The issues are
>>
>> 1. The incoming stack alignment can't be changed after RTL expansion
>> starts.
>
> And that's the thing.  Just move the prologue expansion to after the body
> expansion (see cfgexpand.c) and you should be set.  No doubt you'll hit
> some ugly obstacles, but that should be the way forward.

Currently, pass_thread_prologue_and_epilogue is processed well after
the body expansion, IRA and some reload passes. I am not familiar
with middle-end to move it that far.

>> 2. When -mstackrealign is used, we want to use 4 byte incoming stack
>> alignment on functions which use SSE vector insns.
>> 3. SSE vector insns may be generated by intrinsics, vectorizer and
>> vector operations.
>
> All of these will be automatically taken care off when (1) is solved.  I
> really think it would be worth it.  Fiddling with stack alignment in the
> vectorizer (though that's the first alignment requirers you'll hit) is not
> going to fly in the long run.
>

The whole thing is to deal with a quirk in gcc implementation of i386
psABI when -mstackrealign is used. Sure, we may have to deal some
more cases. But I don't expect any long term issue.

-- 
H.J.



More information about the Gcc-patches mailing list