I appear to have forgotten to cc gcc-patches, sorry about that. There are currently three cases where we issue a warning when disabling -mcall-ms2sysv-xlogues for a function, but I never added a proper warning, so there's no mechanism for disabling it. This is something that I meant to address sooner. I'm thinking that it's better to just remove the warning entirely and document these cases, rather than adding a new warning. Any thoughts?
These are the conditions: * the use of -fsplit-stack, * the use of static call chains (not sure if we can ever have that), and * if the function calls __buildin_eh_return. Some of these cases can likely be supported, but they are just on the "not yet tested" list. 2017-06-11 Daniel Santos <daniel.san...@pobox.com * config/i386/i386.c (warn_once_call_ms2sysv_xlogues): Remove. (ix86_compute_frame_layout): Don't call warn_once_call_ms2sysv_xlogues. (ix86_expand_call): Likewise. Thanks, Daniel Signed-off-by: Daniel Santos <daniel.san...@pobox.com> --- gcc/config/i386/i386.c | 26 +++----------------------- gcc/doc/invoke.texi | 25 ++++++++++++++++++++----- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d5c2d46bf5e..2dc6e53c765 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -12772,18 +12772,6 @@ ix86_builtin_setjmp_frame_value (void) return stack_realign_fp ? hard_frame_pointer_rtx : virtual_stack_vars_rtx; } -/* Emits a warning for unsupported msabi to sysv pro/epilogues. */ -static void warn_once_call_ms2sysv_xlogues (const char *feature) -{ - static bool warned_once = false; - if (!warned_once) - { - warning (0, "-mcall-ms2sysv-xlogues is not compatible with %s", - feature); - warned_once = true; - } -} - /* When using -fsplit-stack, the allocation routines set a field in the TCB to the bottom of the stack plus this much space, measured in bytes. */ @@ -12814,18 +12802,10 @@ ix86_compute_frame_layout (void) gcc_assert (TARGET_SSE); gcc_assert (!ix86_using_red_zone ()); - if (crtl->calls_eh_return) + if (crtl->calls_eh_return || ix86_static_chain_on_stack) { gcc_assert (!reload_completed); m->call_ms2sysv = false; - warn_once_call_ms2sysv_xlogues ("__builtin_eh_return"); - } - - else if (ix86_static_chain_on_stack) - { - gcc_assert (!reload_completed); - m->call_ms2sysv = false; - warn_once_call_ms2sysv_xlogues ("static call chains"); } /* Finally, compute which registers the stub will manage. */ @@ -29290,9 +29270,9 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1, else if (ix86_function_ms_hook_prologue (current_function_decl)) ; - /* TODO: Cases not yet examined. */ + /* TODO: Compatibility not yet examined. */ else if (flag_split_stack) - warn_once_call_ms2sysv_xlogues ("-fsplit-stack"); + ; else { diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c1168823af7..eec02b43a4f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -25389,11 +25389,26 @@ using the function attributes @code{ms_abi} and @code{sysv_abi}. @opindex mno-call-ms2sysv-xlogues Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By -default, the code for saving and restoring these registers is emitted inline, -resulting in fairly lengthy prologues and epilogues. Using -@option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that -use stubs in the static portion of libgcc to perform these saves and restores, -thus reducing function size at the cost of a few extra instructions. +default, the instructions for saving and restoring these registers are emitted +inline, resulting in fairly lengthy pro- and epilogues. Using +@option{-mcall-ms2sysv-xlogues} emits pro- and epilogues that use stubs in the +static portion of libgcc to perform these saves and restores, thus reducing +function size at the cost of executing a few extra instructions. This cost is +theoretically mitigated or eliminated by reduced instruction cache utilization, +temporal locality of the stubs, and the stubs' use of MOV instructions over +PUSH and POP. + +This option is not supported with SEH, so it is completely unavailable on +Windows. It is also silently disabled if a function: + +@enumerate +@item is built with @option{-mno-sse2} or @option{-fsplit-stack}, +@item has @code{__attribute__ ((ms_hook_prologue))}, or +@item either throws an exception or explicitly calls @code{__builtin_eh_return}. +@end enumerate + +Support for @option{-fsplit-stack} and @code{__builtin_eh_return} may be +added at some time in the future, but has not yet been tested. @item -mtls-dialect=@var{type} @opindex mtls-dialect -- 2.11.0