From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91500 invoked by alias); 17 Oct 2016 22:35:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 91489 invoked by uid 89); 17 Oct 2016 22:35:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=sk:option_, sk:OPTION_, trampoline, dg-warning X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Oct 2016 22:35:18 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id D59AF812EB; Tue, 18 Oct 2016 00:35:15 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iIM2WjAvT_da; Tue, 18 Oct 2016 00:35:15 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 8E20B812EA; Tue, 18 Oct 2016 00:35:15 +0200 (CEST) From: Eric Botcazou To: Andreas Schwab Cc: gcc-patches@gcc.gnu.org Subject: Re: [patch v2] Get rid of stack trampolines for nested functions (0/4) Date: Mon, 17 Oct 2016 22:35:00 -0000 Message-ID: <105483915.2OVkdGptPy@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-42-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: References: <1518726.5fkcUnkpqM@arcturus.home> <1655866.vCpVy9sPsK@polaris> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2914931.q37jDOy6jF" Content-Transfer-Encoding: 7Bit X-SW-Source: 2016-10/txt/msg01372.txt.bz2 This is a multi-part message in MIME format. --nextPart2914931.q37jDOy6jF Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 1560 > 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 Botcazou --nextPart2914931.q37jDOy6jF Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 5557 Index: 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 != ABI_AIX) - #if (GCC_VERSION >= 3000) #pragma GCC poison TARGET_FLOAT128 OPTION_MASK_FLOAT128 MASK_FLOAT128 #endif Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 241222) +++ config/sparc/sparc.c (working copy) @@ -866,6 +866,9 @@ char sparc_hard_reg_printed[8]; #undef TARGET_FIXED_CONDITION_CODE_REGS #define TARGET_FIXED_CONDITION_CODE_REGS sparc_fixed_condition_code_regs +#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 + struct gcc_target targetm = TARGET_INITIALIZER; /* Return the memory reference contained in X if any, zero otherwise. */ Index: config/sparc/sparc.h =================================================================== --- config/sparc/sparc.h (revision 241222) +++ config/sparc/sparc.h (working copy) @@ -1813,6 +1813,3 @@ extern int sparc_indent_opcode; #define SPARC_LOW_FE_EXCEPT_VALUES 0 #define TARGET_SUPPORTS_WIDE_INT 1 - -/* Use custom descriptors instead of trampolines when possible. */ -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1 Index: testsuite/gcc.dg/Wtrampolines.c =================================================================== --- testsuite/gcc.dg/Wtrampolines.c (revision 241222) +++ testsuite/gcc.dg/Wtrampolines.c (working copy) @@ -28,7 +28,7 @@ void foo (void) double a (int k, pfun x1, pfun x2, pfun x3, pfun x4, pfun x5) { - double b (void) /* { dg-warning "trampoline generated for nested function 'b'" } */ + double b (void) /* { dg-warning "trampoline generated for nested function 'b'" "standard descriptors" { xfail ia64-*-* powerpc64-*-* } } */ { k = k - 1; return a (k, b, x1, x2, x3, x4 ); Index: testsuite/gnat.dg/trampoline4.adb =================================================================== --- testsuite/gnat.dg/trampoline4.adb (revision 241222) +++ testsuite/gnat.dg/trampoline4.adb (working copy) @@ -1,6 +1,6 @@ -- { dg-do compile { target *-*-linux* } } -- { dg-options "-ftrampolines -gnatws" } --- { dg-skip-if "native descriptors" { ia64-*-* powerpc64-*-* } } +-- { dg-skip-if "standard descriptors" { ia64-*-* powerpc64-*-* } } procedure Trampoline4 is --nextPart2914931.q37jDOy6jF--