[Re-send, since I never saw the original arrive on the list.] After the first version passed Kai's testing, we chatted on IRC about various other bits that might be relevant to the winx64 abi issues.
The conditional call to ix86_eax_live_at_start_p seemed to be harmless either way, but confusing as a conditional. It seems least confusing to make the call unconditional. Finally, adjust the comment for ACCUMULATE_OUTGOING_ARGS to match reality. r~ PR target/59927 * calls.c (expand_call): Don't double-push for reg_parm_stack_space. * config/i386/i386.c (init_cumulative_args): Remove sorry for 64-bit ms-abi vs -mno-accumulate-outgoing-args. (ix86_expand_prologue): Unconditionally call ix86_eax_live_at_start_p. * config/i386/i386.h (ACCUMULATE_OUTGOING_ARGS): Fix comment with respect to ms-abi.
diff --git a/gcc/calls.c b/gcc/calls.c index d574a95..f392319 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2955,6 +2955,7 @@ expand_call (tree exp, rtx target, int ignore) /* If we push args individually in reverse order, perform stack alignment before the first push (the last arg). */ if (PUSH_ARGS_REVERSED && argblock == 0 + && adjusted_args_size.constant > reg_parm_stack_space && adjusted_args_size.constant != unadjusted_args_size) { /* When the stack adjustment is pending, we get better code diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 1b7bb3e..0a15e44 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6110,10 +6110,6 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */ cum->caller = caller; /* Set up the number of registers to use for passing arguments. */ - - if (TARGET_64BIT && cum->call_abi == MS_ABI && !ACCUMULATE_OUTGOING_ARGS) - sorry ("ms_abi attribute requires -maccumulate-outgoing-args " - "or subtarget optimization implying it"); cum->nregs = ix86_regparm; if (TARGET_64BIT) { @@ -11032,15 +11028,14 @@ ix86_expand_prologue (void) if (TARGET_64BIT) r10_live = (DECL_STATIC_CHAIN (current_function_decl) != 0); - if (!TARGET_64BIT_MS_ABI) - eax_live = ix86_eax_live_at_start_p (); - /* Note that SEH directives need to continue tracking the stack - pointer even after the frame pointer has been set up. */ + eax_live = ix86_eax_live_at_start_p (); if (eax_live) { insn = emit_insn (gen_push (eax)); allocate -= UNITS_PER_WORD; + /* Note that SEH directives need to continue tracking the stack + pointer even after the frame pointer has been set up. */ if (sp_is_cfa_reg || TARGET_SEH) { if (sp_is_cfa_reg) diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 0e757c9c..b605ae2 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1537,12 +1537,12 @@ enum reg_class mode the difference is less drastic but visible. FIXME: Unlike earlier implementations, the size of unwind info seems to - actually grouw with accumulation. Is that because accumulated args + actually grow with accumulation. Is that because accumulated args unwind info became unnecesarily bloated? - - 64-bit MS ABI seem to require 16 byte alignment everywhere except for - function prologue and epilogue. This is not possible without - ACCUMULATE_OUTGOING_ARGS. + + With the 64-bit MS ABI, we can generate correct code with or without + accumulated args, but because of OUTGOING_REG_PARM_STACK_SPACE the code + generated without accumulated args is terrible. If stack probes are required, the space used for large function arguments on the stack must also be probed, so enable