Re: [patch v2] Get rid of stack trampolines for nested functions (0/4)
> On ia64 I get this regression: > > FAIL: gcc.dg/Wtrampolines.c (test for warnings, line 31) > > Since ia64 never uses trampolines this is probably ok and the test > should be adjusted. This actually revealed a problem: the same regression should have appeared on PowerPC64/Linux (ELFv1 ABI) but it didn't because I botched the hookization of TARGET_CUSTOM_FUNCTION_DESCRIPTORS, which started as a good old macro: /* Use custom descriptors instead of trampolines if not AIX or ELFv1. */ #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS (DEFAULT_ABI != ABI_AIX) doesn't work as intended on PowerPC64 because DEFAULT_ABI is a variable... Corrective patch attached, tested on x86/Linux, x86-64/Linux, PowerPC/Linux, PowerPC64/Linux, IA-64/Linux and SPARC/Solaris, applied as obvious. * config/i386/i386.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Move to... * config/i386/i386.c (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): ...here. * config/ia64/ia64.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Move to... * config/ia64/ia64.c (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): ...here. * config/rs6000/rs6000.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Move to... * config/rs6000/rs6000.c (TARGET_CUSTOM_FUNCTION_DESCRIPTORS):...here. (rs6000_option_override_internal): Clear it if ABI_AIX. * config/sparc/sparc.h (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): Move to... * config/sparc/sparc.c (TARGET_CUSTOM_FUNCTION_DESCRIPTORS): ...here. testsuite/ * gcc.dg/Wtrampolines.c: XFAIL warning on ia64-*-* and powerpc64-*-*. * gnat.dg/trampoline4.adb: Minor tweak. -- Eric BotcazouIndex: config/i386/i386.c === --- config/i386/i386.c (revision 241222) +++ config/i386/i386.c (working copy) @@ -50833,6 +50833,9 @@ ix86_addr_space_zero_address_valid (addr #undef TARGET_HARD_REGNO_SCRATCH_OK #define TARGET_HARD_REGNO_SCRATCH_OK ix86_hard_regno_scratch_ok +#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-i386.h" Index: config/i386/i386.h === --- config/i386/i386.h (revision 241222) +++ config/i386/i386.h (working copy) @@ -2666,9 +2666,6 @@ extern void debug_dispatch_window (int); #define TARGET_SUPPORTS_WIDE_INT 1 -/* Use custom descriptors instead of trampolines when possible. */ -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 - /* Local variables: version-control: t Index: config/ia64/ia64.c === --- config/ia64/ia64.c (revision 241222) +++ config/ia64/ia64.c (working copy) @@ -649,6 +649,9 @@ static const struct attribute_spec ia64_ #undef TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P #define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P ia64_attribute_takes_identifier_p +#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 0 + struct gcc_target targetm = TARGET_INITIALIZER; /* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain Index: config/ia64/ia64.h === --- config/ia64/ia64.h (revision 241222) +++ config/ia64/ia64.h (working copy) @@ -1715,7 +1715,4 @@ struct GTY(()) machine_function /* Switch on code for querying unit reservations. */ #define CPU_UNITS_QUERY 1 -/* IA-64 already uses descriptors for its standard calling sequence. */ -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 0 - /* End of ia64.h */ Index: config/rs6000/rs6000.c === --- config/rs6000/rs6000.c (revision 241222) +++ config/rs6000/rs6000.c (working copy) @@ -1867,6 +1867,9 @@ static const struct attribute_spec rs600 #undef TARGET_OPTAB_SUPPORTED_P #define TARGET_OPTAB_SUPPORTED_P rs6000_optab_supported_p + +#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 /* Processor table. */ @@ -4862,6 +4865,10 @@ rs6000_option_override_internal (bool gl Linux and Darwin ABIs at the moment. For now, only AIX is fixed. */ if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) targetm.calls.split_complex_arg = NULL; + + /* The AIX and ELFv1 ABIs define standard function descriptors. */ + if (DEFAULT_ABI == ABI_AIX) + targetm.calls.custom_function_descriptors = 0; } /* Initialize rs6000_cost with the appropriate target costs. */ Index: config/rs6000/rs6000.h === --- config/rs6000/rs6000.h (revision 241222) +++ config/rs6000/rs6000.h (working copy) @@ -2922,9 +2922,6 @@ extern GTY(()) tree rs6000_builtin_decls #define TARGET_SUPPORTS_WIDE_INT 1 -/* Use custom descriptors instead of trampolines if not AIX or ELFv1. */ -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS (DEFAULT_ABI !=
Re: [patch v2] Get rid of stack trampolines for nested functions (0/4)
> On ia64 I get this regression: > > FAIL: gcc.dg/Wtrampolines.c (test for warnings, line 31) I managed to miss it in the test results... > Since ia64 never uses trampolines this is probably ok and the test > should be adjusted. Yes, will do, thanks for the heads up. -- Eric Botcazou
Re: [patch v2] Get rid of stack trampolines for nested functions (0/4)
On Okt 16 2016, Eric Botcazouwrote: >> this is the updated version of the patch initially posted at: >> https://gcc.gnu.org/ml/gcc-patches/2016-06/msg02016.html >> It takes into account Jeff's remarks, both on the code and the >> documentation. >> >> As discussed, I'm going to split it into 4 parts: common infrastructure, Ada >> front-end bits, individual back-end changes, testsuite. It was >> bootstrapped and regtested on x86_64-suse-linux but AdaCore has been using >> it on native platforms (Linux, Windows, Solaris, etc) and various >> architectures (x86, PowerPC, SPARC, ARM, etc) for years. > > I've installed part #1, #2, #4 and part #3 for x86, PowerPC, SPARC and IA-64. > The PowerPC and SPARC bits as approved, the x86 and IA-64 bits as obvious. On ia64 I get this regression: FAIL: gcc.dg/Wtrampolines.c (test for warnings, line 31) Since ia64 never uses trampolines this is probably ok and the test should be adjusted. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Re: [patch v2] Get rid of stack trampolines for nested functions (0/4)
> this is the updated version of the patch initially posted at: > https://gcc.gnu.org/ml/gcc-patches/2016-06/msg02016.html > It takes into account Jeff's remarks, both on the code and the > documentation. > > As discussed, I'm going to split it into 4 parts: common infrastructure, Ada > front-end bits, individual back-end changes, testsuite. It was > bootstrapped and regtested on x86_64-suse-linux but AdaCore has been using > it on native platforms (Linux, Windows, Solaris, etc) and various > architectures (x86, PowerPC, SPARC, ARM, etc) for years. I've installed part #1, #2, #4 and part #3 for x86, PowerPC, SPARC and IA-64. The PowerPC and SPARC bits as approved, the x86 and IA-64 bits as obvious. This was tested on x86/Linux, x86-64/Linux, PowerPC/Linux, PowerPC64/Linux, IA-64/Linux, SPARC/Solaris and SPARC64/Solaris. I'll repost the remaining bits for Aarch64, ARM, Alpha, MIPS and HP-PA. -- Eric Botcazou
[patch v2] Get rid of stack trampolines for nested functions (0/4)
Hi, this is the updated version of the patch initially posted at: https://gcc.gnu.org/ml/gcc-patches/2016-06/msg02016.html It takes into account Jeff's remarks, both on the code and the documentation. As discussed, I'm going to split it into 4 parts: common infrastructure, Ada front-end bits, individual back-end changes, testsuite. It was bootstrapped and regtested on x86_64-suse-linux but AdaCore has been using it on native platforms (Linux, Windows, Solaris, etc) and various architectures (x86, PowerPC, SPARC, ARM, etc) for years. ada/gcc-interface/misc.c |2 ada/gcc-interface/trans.c | 40 +++- builtins.c| 62 + builtins.def |2 calls.c | 101 +++--- cfgexpand.c |1 common.opt|5 + config/aarch64/aarch64.h |4 config/alpha/alpha.h |3 config/arm/arm.c | 27 +- config/arm/arm.h |4 config/i386/i386.h|3 config/ia64/ia64.h|3 config/mips/mips.h|4 config/pa/pa.h|3 config/rs6000/rs6000.h|3 config/sparc/sparc.h |3 defaults.h| 11 ++ doc/invoke.texi | 24 + doc/tm.texi | 18 doc/tm.texi.in|2 gimple.c |4 gimple.h | 21 langhooks-def.h |2 langhooks.h |4 rtl.h |5 + rtlanal.c |3 target.def| 19 testsuite/gnat.dg/trampoline3.adb | 22 testsuite/gnat.dg/trampoline4.adb | 23 + tree-core.h |9 ++ tree-nested.c | 169 ++-- tree.c|9 +- tree.h| 10 ++ 34 files changed, 574 insertions(+), 51 deletions(-) -- Eric Botcazou