From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75195 invoked by alias); 9 Nov 2018 18:09:10 -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 75172 invoked by uid 89); 9 Nov 2018 18:09:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=validated, badly, dedicated, H*r:224 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; Fri, 09 Nov 2018 18:09:06 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 1DA0782273; Fri, 9 Nov 2018 19:09:03 +0100 (CET) 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 BkrYAsNqY7Bv; Fri, 9 Nov 2018 19:09:03 +0100 (CET) Received: from [IPv6:2a02:2ab8:224:1:f5df:dbcf:c92f:6499] (unknown [IPv6:2a02:2ab8:224:1:f5df:dbcf:c92f:6499]) (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 950EB81368; Fri, 9 Nov 2018 19:09:02 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [patch] allow target config to state r18 is fixed on aarch64 From: Olivier Hainque In-Reply-To: Date: Fri, 09 Nov 2018 18:09:00 -0000 Cc: Olivier Hainque , GCC Patches , nd , Kyrylo Tkachov , Richard Earnshaw , James Greenhalgh Content-Transfer-Encoding: quoted-printable Message-Id: <42AD5419-370A-45B0-92EF-83F84CFD7EB9@adacore.com> References: To: Wilco Dijkstra X-SW-Source: 2018-11/txt/msg00761.txt.bz2 Hello Wilco, Would you have further thoughts on the patches proposed in=20 https://gcc.gnu.org/ml/gcc-patches/2018-10/msg01453.html ? There was: 1) * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG) : Redefine as R9_REGNUM instead of 9. (PROBE_STACK_SECOND_REG): Redefine as R10_REGNUM instead of 10. 2) * config/aarch64/aarch64.h (FIXED_R18): New internal configuration macro, defaulted to 0. (FIXED_REGISTERS): Use it. (STATIC_CHAIN_REGNUM): Use r11 instead of r18. and 3) * config/aarch64/aarch64.c (aarch64_override_options): Once arch, cpu and tune were validated, insert SUBTARGET_OVERRIDE_OPTIONS if defined. Thanks a lot in advance! With Kind Regards, Olivier > On 23 Oct 2018, at 19:13, Olivier Hainque wrote: >=20 > Hi Wilco, >=20 >> On 18 Oct 2018, at 19:08, Wilco Dijkstra wrote: >=20 >>> I wondered if we could set it to R11 unconditionally and picked >>> the way ensuring no change for !vxworks ports, especially since I >>> don't have means to test more than what I described above. >>=20 >> Yes it should always be the same register, there is no gain in switching >> it dynamically. I'd suggest to use X9 since X8 is the last register used= for >> arguments (STATIC_CHAIN_REGNUM is passed when calling a nested >> function) and some of the higher registers may be used as temporaries in >> prolog/epilog. >=20 > Thanks for your feedback! I ported the patches > to gcc-8 and was able to get a functional toolchain > for aarch64-wrs-vxworks7 and aarch64-elf, passing > full Acats for a couple of runtime variants on VxWorks > (compiled for RTP or kernel mode) as well as a small > internal testsuite we have, dedicated to cross configurations. >=20 > All the patches apply directly on mainline. >=20 > As for the original patch, I also sanity checked that > "make all-gcc" passes (self tests included) there for > --target=3Daarch64-elf --enable-languages=3Dc >=20 >=20 > There are three changes to the common aarch64 port files. >=20 > It turns out that X9 doesn't work for STATIC_CHECK_REGNUM > because this conflicts with the registers used for -fstack-check: >=20 > /* The pair of scratch registers used for stack probing. */ > #define PROBE_STACK_FIRST_REG 9 > #define PROBE_STACK_SECOND_REG 10 >=20 > I didn't find that immediately (read, I first experienced a few > badly crashing test runs) because I searched for R9_REGNUM to check > for other uses, so the first patchlet attached simply adjusts > the two #defines above to use R9/R10_REGNUM. >=20 >=20 > 2018-10-23 Olivier Hainque >=20 > * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG) : Redefine as > R9_REGNUM instead of 9. > (PROBE_STACK_SECOND_REG): Redefine as R10_REGNUM instead of 10. >=20 >=20 > The second patch is the one which I proposed a few days ago > to allow a subtarget (in my case, the VxWorks port) to state that > R18 is to be considered fixed. Two changes compared to the original > patch: a comment attached to the default definition of FIXED_R18, > and the unconditional use of R11_REGNUM as an alternate STATIC_CHAIN_REGN= UM. >=20 > I suppose the latter could require extra testing than what I was > able to put in (since this is also changing for !vxworks configurations), > which Sam very kindly did on the first instance. >=20 > I didn't touch CALL_SAVED_REGISTERS since this is 1 for r18 already. > I also didn't see a strong reason to move to a more dynamic scheme, > through conditional_register_usage. >=20 > 2018-03-18 Olivier Hainque >=20 > * config/aarch64/aarch64.h (FIXED_R18): New internal > configuration macro, defaulted to 0. > (FIXED_REGISTERS): Use it. > (STATIC_CHAIN_REGNUM): Use r11 instead of r18. >=20 >=20 > The third patch proposes the introduction of support for a > conditional SUBTARGET_OVERRIDE_OPTIONS macro, as many other > architectures have, and which is needed by all VxWorks ports. >=20 > In the current state, this one could possibly impact only > VxWorks, as no other config file would define the macro. >=20 > I'm not 100% clear on the possible existence of rules regarding > the placement of this within the override_options functions. We used > something similar to what other ports do, and it worked just fine > for VxWorks. >=20 > 2018-10-23 Olivier Hainque >=20 > * config/aarch64/aarch64.c (aarch64_override_options): Once > arch, cpu and tune were validated, insert SUBTARGET_OVERRIDE_OPTIO= NS > if defined. >=20 > I'm happy to adjust any of all this if needed of course. >=20 > Thanks in advance for your feedback! >=20 > With Kind Regards, >=20 > Olivier >=20 >=20 > <0001-Use-R9-R10_REGNUM-to-designate-stack-checking-regist.patch.txt><000= 2-Introduce-FIXED_R18-in-aarch64.h.patch.txt><0003-Support-for-SUBTARGET_OV= ERRIDE_OPTIONS-in-aarch64.c.patch.txt>