public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
To: Evgeny Karpov <Evgeny.Karpov@microsoft.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "richard.sandiford@arm.com" <richard.sandiford@arm.com>,
	"10walls@gmail.com" <10walls@gmail.com>,
	Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	"mark@harmstone.com" <mark@harmstone.com>,
	Zac Walker <zacwalker@microsoft.com>,
	Ron Riddle <Ron.Riddle@microsoft.com>,
	Radek Barton <radek.barton@microsoft.com>
Subject: Re: [PATCH v1 03/13] aarch64: Mark x18 register as a fixed register for MS ABI
Date: Thu, 22 Feb 2024 11:55:25 +0000	[thread overview]
Message-ID: <c0825629-1bf6-48a7-be1b-e45b5f1bdc78@arm.com> (raw)
In-Reply-To: <VI1PR83MB0431809D3F653B39481E740DF8572@VI1PR83MB0431.EURPRD83.prod.outlook.com>

On 21/02/2024 18:30, Evgeny Karpov wrote:
> 
+/* X18 reserved for the TEB on Windows.  */
+#ifdef TARGET_ARM64_MS_ABI
+# define FIXED_X18 1
+# define CALL_USED_X18 0
+#else
+# define FIXED_X18 0
+# define CALL_USED_X18 1
+#endif

I'm not overly keen on ifdefs like this (and the one below), it can get quite confusing if we have to support more than a couple of ABIs.  Perhaps we could create a couple of new headers, one for the EABI (which all existing targets would then need to include) and one for the MS ABI.  Then the mingw port would use that instead of the EABI header.

An alternative is to make all this dynamic, based on the setting of the aarch64_calling_abi enum and to make the adjustments in aarch64_conditional_register_usage.

+# define CALL_USED_X18 0

Is that really correct?  If the register is really reserved, but some code modifies it anyway, this will cause the compiler to restore the old value at the end of a function; generally, for a reserved register, code that knows what it's doing would want to make permanent changes to this value.

+#ifdef TARGET_ARM64_MS_ABI
+# define STATIC_CHAIN_REGNUM		R17_REGNUM
+#else
+# define STATIC_CHAIN_REGNUM		R18_REGNUM
+#endif

If we went the enum way, we'd want something like

#define STATIC_CHAIN_REGNUM (calling_abi == AARCH64_CALLING_ABI_MS ? R17_REGNUM : R18_REGNUM)

R.

  reply	other threads:[~2024-02-22 11:55 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 17:47 [PATCH v1 00/13] Add aarch64-w64-mingw32 target Evgeny Karpov
2024-02-21 18:16 ` [PATCH v1 01/13] Introduce " Evgeny Karpov
2024-02-21 18:23   ` Andrew Pinski
2024-02-23 14:15     ` Evgeny Karpov
2024-02-23 22:02       ` Fangrui Song
2024-02-22 11:33   ` Richard Earnshaw (lists)
2024-02-21 18:26 ` [PATCH v1 00/13] Add " Maxim Kuvyrkov
2024-02-22 22:03   ` Evgeny Karpov
2024-02-21 18:26 ` [PATCH v1 02/13] aarch64: The aarch64-w64-mingw32 target implements Evgeny Karpov
2024-02-22 11:40   ` Richard Earnshaw (lists)
2024-02-23 14:22     ` Evgeny Karpov
2024-02-23 17:49       ` Richard Sandiford
2024-02-23 17:54         ` Andrew Pinski
2024-02-25 21:15           ` Mark Harmstone
2024-02-23 20:37         ` Martin Storsjö
2024-02-23 21:47           ` Evgeny Karpov
2024-02-23 21:32         ` Evgeny Karpov
2024-02-21 18:30 ` [PATCH v1 03/13] aarch64: Mark x18 register as a fixed register for MS ABI Evgeny Karpov
2024-02-22 11:55   ` Richard Earnshaw (lists) [this message]
2024-02-22 17:45     ` Andrew Pinski
2024-02-22 18:15       ` Iain Sandoe
2024-02-23 16:10       ` Jacek Caban
2024-02-26 16:34         ` Evgeny Karpov
2024-02-23 16:56     ` Richard Sandiford
2024-02-26 17:03       ` Evgeny Karpov
2024-02-26 16:07     ` Evgeny Karpov
2024-02-22 13:11   ` Richard Earnshaw (lists)
2024-02-22 15:06     ` [EXTERNAL] " Evgeny Karpov
2024-02-21 18:32 ` [PATCH v1 04/13] aarch64: Add aarch64-w64-mingw32 COFF Evgeny Karpov
2024-02-23 17:01   ` Richard Sandiford
2024-02-26 18:16     ` Evgeny Karpov
2024-02-21 18:34 ` [PATCH v1 05/13] Reuse MinGW from i386 for AArch64 Evgeny Karpov
2024-02-21 18:50   ` Andrew Pinski
2024-02-22 15:39     ` Evgeny Karpov
2024-02-21 21:34   ` rep.dot.nop
2024-02-22 11:11     ` Richard Earnshaw (lists)
2024-02-22 15:56       ` Evgeny Karpov
2024-02-23 20:59         ` Bernhard Reutner-Fischer
2024-02-22 17:54       ` Joseph Myers
2024-02-25 21:12       ` Mark Harmstone
2024-02-26  8:17         ` Bernhard Reutner-Fischer
2024-02-26 18:31           ` Evgeny Karpov
2024-02-21 18:35 ` [PATCH v1 06/13] Rename section and encoding functions from i386 which will be used in aarch64 Evgeny Karpov
2024-02-21 18:36 ` [PATCH v1 07/13] Exclude i386 functionality from aarch64 build Evgeny Karpov
2024-02-21 18:36 ` [PATCH v1 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 Evgeny Karpov
2024-02-22 13:23   ` Richard Earnshaw (lists)
2024-02-25 18:52     ` Evgeny Karpov
2024-02-23 17:15   ` Richard Sandiford
2024-02-27 21:17     ` Evgeny Karpov
2024-02-28  1:00       ` Andrew Pinski
2024-02-29 16:45         ` Evgeny Karpov
2024-02-29 17:35           ` Andrew Pinski (QUIC)
2024-02-29 17:46             ` Maxim Kuvyrkov
2024-02-29 17:55               ` Andrew Pinski (QUIC)
2024-02-29 17:59                 ` Richard Earnshaw (lists)
2024-03-01 13:10                   ` Maxim Kuvyrkov
2024-02-29 18:32                 ` Evgeny Karpov
2024-02-28  2:12       ` NightStrike
2024-02-21 18:37 ` [PATCH v1 09/13] aarch64: Add SEH to machine_function Evgeny Karpov
2024-02-21 18:38 ` [PATCH v1 10/13] Rename "x86 Windows Options" to "Cygwin and MinGW Options" Evgeny Karpov
2024-02-22 13:32   ` Richard Earnshaw (lists)
2024-02-27 20:04     ` Evgeny Karpov
2024-02-21 18:39 ` [PATCH v1 11/13] aarch64: Build and add objects for Cygwin and MinGW for AArch64 Evgeny Karpov
2024-02-21 18:40 ` [PATCH v1 12/13] aarch64: Add aarch64-w64-mingw32 target to libatomic Evgeny Karpov
2024-02-21 18:40 ` [PATCH v1 13/13] Add aarch64-w64-mingw32 target to libgcc Evgeny Karpov
2024-02-22 13:36   ` Richard Earnshaw (lists)
2024-02-25 19:14     ` Evgeny Karpov
2024-02-22 13:39 ` [PATCH v1 00/13] Add aarch64-w64-mingw32 target Richard Earnshaw (lists)
2024-02-23 18:00   ` Richard Sandiford
2024-02-29 15:45     ` Evgeny Karpov
2024-02-27 20:32   ` Evgeny Karpov
2024-02-22 18:11 ` Mark Harmstone
2024-02-22 22:16   ` Evgeny Karpov
2024-02-26  1:29 ` NightStrike
2024-02-29 16:25   ` Evgeny Karpov
2024-02-29 18:09     ` NightStrike
2024-02-29 19:34 ` Evgeny Karpov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0825629-1bf6-48a7-be1b-e45b5f1bdc78@arm.com \
    --to=richard.earnshaw@arm.com \
    --cc=10walls@gmail.com \
    --cc=Evgeny.Karpov@microsoft.com \
    --cc=Ron.Riddle@microsoft.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mark@harmstone.com \
    --cc=maxim.kuvyrkov@linaro.org \
    --cc=radek.barton@microsoft.com \
    --cc=richard.sandiford@arm.com \
    --cc=zacwalker@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).