Ian, would you mind looking at this please? A combination of my -mcall-ms2sysv-xlogues patch with Bernd's patch is causing problems when ix86_expand_split_stack_prologue() calls ix86_expand_call().

On 05/15/2017 06:46 PM, Daniel Santos wrote:
Rather or not m->call_ms2sysv is set determines which stack layout is used when ix86_compute_frame_layout() runs. But if we can run expand_call after the final time ix86_compute_frame_layout() then we have a problem. It looks like ix86_expand_split_stack_prologue is the only function that manually calls ix86_expand_call, but maybe it would be better to modify the test to something like this:

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a78819d6b3f..c36383f6962 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -29325,7 +29325,7 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
        }

       /* Set here, but it may get cleared later.  */
-      if (TARGET_CALL_MS2SYSV_XLOGUES)
+      if (TARGET_CALL_MS2SYSV_XLOGUES && !reload_completed)
        cfun->machine->call_ms2sysv = true;
     }



Actually, I think this is wrong. I happened to recall looking at the morestack code last year and remembered that it was all assembly. I looked at it again and I don't see that it calls anything outside of it's implementation file (libgcc/config/i386/morestack.S) except for _Unwind_Resume and the calling function its self (I think it calls its caller). It saves and restores rsi and rdi and doesn't use any sse registers, so it doesn't need to clobber all of the regs in the x86_64_ms_sysv_extra_clobbered_registers array. I'm guessing that this should have it's own pattern instead of calling ix86_expand_call in the first place.

Of course, I'm the new guy here, so please enlighten me if I'm wrong.

Thanks,
Daniel

Reply via email to