From f830ddc257d1d708801f1a42b181f462da14637a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 10 Feb 2014 17:12:38 -0800 Subject: [PATCH] re PR target/59927 (ICE sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it) 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. From-SVN: r207677 --- gcc/ChangeLog | 10 ++++++++++ gcc/calls.c | 1 + gcc/config/i386/i386.c | 11 +++-------- gcc/config/i386/i386.h | 10 +++++----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a5ad4facea7b..45224820220f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2014-02-10 Richard Henderson + + 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. + 2014-02-10 Bernd Edlinger PR middle-end/60080 diff --git a/gcc/calls.c b/gcc/calls.c index d574a95b9287..f392319cfddf 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 1b7bb3e9a0f5..0a15e442bef1 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 0e757c9c4aaf..b605ae22aba5 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 -- 2.47.3