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: Fix some x86 peepholes vs. the red-zone


On 04/12/2016 05:57 AM, Bernd Schmidt wrote:
With some changes I was working on, I produced a situation where one of
the x86 peepholes made an incorrect transformation. In the prologue
expansion code, we have

/* When using red zone we may start register saving before allocating
    the stack frame saving one cycle of the prologue.  However, avoid
    doing this if we have to probe the stack; at least on x86_64 the
    stack probe can turn into a call that clobbers a red zone location.

So, we can in some situations produce something like:

mov %ebx, -8(%rsp)
mov %edi, -16(%rsp)
subl $16, %rsp

which is fine if using a redzone. The problem is that there are
peepholes which convert sp subtractions into pushes, clobbering the
saved registers.

I've made these peepholes conditional on !x86_using_red_zone.
Bootstrapped and tested on x86_64-linux, ok (now or later)?
OK for stage1.  Uros's call whether or not to OK for the trunk right now.

jeff


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