From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 121EA3858C52 for ; Thu, 22 Feb 2024 18:15:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 121EA3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=googlemail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 121EA3858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708625756; cv=none; b=Oh2IunT6JWiJiBw7AQJwrxyfBhYKb0vlUIzTq3dolECdHmXgwQIg8Fr/SDPJxu2D6/HJoTENq+t0LuJZsGlRqGTtiWXfaHTg0is9Hggq/FFF69fGVkbST/j6YgdCD98PKLHUd7T5BEFrpnwc749B1VH6LvP3CYLUS8rutGi5Uzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708625756; c=relaxed/simple; bh=QBjFaJ5nWx3Pjug185M92o11W0SG+Hjld4TRBS9f9Ic=; h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To; b=j5/pdh9m6V76M+CyZClf2raa2jRDmj72+lUEuZJ5XFxSTfIoFtqudRSXhp01xTkhvdxDfOQN8EGxy1k8ouExIVWEXQdhqwPQ27NxYAOyzMoo26w8ovyk3LyiPR9JQvO3e0wzE5P4hD4Igj/DAef0Qp6iuFmyiEpl8h+fOh7xOAI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41275855dc4so216345e9.0 for ; Thu, 22 Feb 2024 10:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1708625754; x=1709230554; darn=gcc.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lIpOJnuziPiOd2IvrS+1HkeyV0zUfqXF1k0z8oJGizI=; b=DnxCCbf0l74dv97pJ/RsG+OI/CLjuuhErfB2lzZfd3eNGPwMrc0U4pWxzFrSByzEf5 L41096t9BGE5wBOtAva/EzeATg4+g+fk8acOtbTCiSlygwlV7ojOatn7+ek4PX/orwTl +K8KVmLGaV5pdoBh1c2eHQi3UXFwNVSyfeopRKMontaFjkOpGvPBC8yXwTKJeZKHguNh yuksW/fX36mecNeFKyRtzcPRXVWGAY2iC9azjWGPHIP4GcHXvpFGNYLBcI+O9RB2euVR p4KtpCRpK+iLGAll8tB0E8N6FV+ZZKe3GYK48lenIbJtt/JpcRAcMmERiLwQT1Z5GsNC U+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708625754; x=1709230554; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lIpOJnuziPiOd2IvrS+1HkeyV0zUfqXF1k0z8oJGizI=; b=PIGkqgkeaIOa5xH3YuwsrOD0D0W8SfhGdHvXpbDwi1IfBvCEdc1C+LJASYgD2HPaMb q+0B9i2R9gLrrD9gi/ehBmG40Lbdmh5Y4Ov1UNSNgkOgxCQ7Aqz2LON3fopne9KWM0wq z4MMJGzOAozND2aTLRdiCu6ijPU8GHngQ/t64HlZx90YQvDn2JQA6ZQTmONA1Buj7zkt HsSsSxOe40lkDoWPuqx5xzcJsc/Fv5nDO+s7+R/iMYGepr9XmOH043zBCYolOidlHY7X BtOlgAaFbL/KMll9eaQFZPXjOcGsQJ2pd53Kr6rOt3pv15/CqPyHWpTkV0dxwyBKjDJ7 9Mxg== X-Forwarded-Encrypted: i=1; AJvYcCWkmN8Ve2PA74hT7su5gZZijjrNqpmRpQ9oeNHHClcV+hfpPe/4JDqWLec3mDCvpyDpEhKY9ZNqm03Fx4rYo9xi52YImsSzUw== X-Gm-Message-State: AOJu0Yz4KN3fumwtIUAgPBsBh+3JTmfW75V8yr9PWM2gaZrd8LuS2ETv +TwfiucAy8hkE9jBUAMbpbUhB1nWiHvU4Kbek6Z1Z0eTYbgSzh85o+jgP1Ky834= X-Google-Smtp-Source: AGHT+IH2yKqxxd11vWrcNBkFK7bs91uaiZktgRMsG3wFmwaucphzC6FbJo9h9h1uJTaqKUqJSTFkuQ== X-Received: by 2002:a7b:c415:0:b0:412:e80:be4d with SMTP id k21-20020a7bc415000000b004120e80be4dmr15297441wmi.36.1708625753496; Thu, 22 Feb 2024 10:15:53 -0800 (PST) Received: from smtpclient.apple (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.googlemail.com with ESMTPSA id f7-20020a05600c490700b00412813505c2sm256551wmp.1.2024.02.22.10.15.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2024 10:15:53 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: [PATCH v1 03/13] aarch64: Mark x18 register as a fixed register for MS ABI From: Iain Sandoe In-Reply-To: Date: Thu, 22 Feb 2024 18:15:52 +0000 Cc: "Richard Earnshaw (lists)" , Evgeny Karpov , GCC Patches , Richard Sandiford , Jonathan Yong <10walls@gmail.com>, Maxim Kuvyrkov , "mark@harmstone.com" , Zac Walker , Ron Riddle , Radek Barton Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Andrew Pinski X-Mailer: Apple Mail (2.3696.120.41.1.4) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On 22 Feb 2024, at 17:45, Andrew Pinski wrote: >=20 > On Thu, Feb 22, 2024 at 3:56=E2=80=AFAM Richard Earnshaw (lists) > wrote: >>=20 >> On 21/02/2024 18:30, Evgeny Karpov wrote: >>>=20 >> +/* 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 >>=20 >> 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. >>=20 >> 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. >=20 > Dynamically might be needed also if we want to support ms_abi > attribute and/or -mabi=3Dms to support the wine folks. X18 is also reserved on Darwin - in my current branch I have it = non-dynamic too. Iain >=20 > Thanks, > Andrew Pinski >=20 >>=20 >> +# define CALL_USED_X18 0 >>=20 >> 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. >>=20 >> +#ifdef TARGET_ARM64_MS_ABI >> +# define STATIC_CHAIN_REGNUM R17_REGNUM >> +#else >> +# define STATIC_CHAIN_REGNUM R18_REGNUM >> +#endif >>=20 >> If we went the enum way, we'd want something like >>=20 >> #define STATIC_CHAIN_REGNUM (calling_abi =3D=3D = AARCH64_CALLING_ABI_MS ? R17_REGNUM : R18_REGNUM) >>=20 >> R.