From patchwork Fri Jan 10 17:22:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Carlotti X-Patchwork-Id: 104506 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D09AA385AC2C for ; Fri, 10 Jan 2025 17:23:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2062a.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::62a]) by sourceware.org (Postfix) with ESMTPS id E5776385AC19 for ; Fri, 10 Jan 2025 17:23:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E5776385AC19 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E5776385AC19 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::62a ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1736529794; cv=pass; b=M2B1dDGFYVeGjSvAYMJVcF2uhZPseuzCur4S1iaHA0LgaWi/b4wDMTzj8diMRsE54Mu1WckjTlxfzxj18F0RgvewJKZB5f8/7G+kqZTwyqldPwV37OMmvn2Qvo2P20ZB5EglpUEIauDCHZEl3hRiFClX8MvwqknLbUnptU5+Rps= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1736529794; c=relaxed/simple; bh=0Mau5VZg/Brbb/WJPnTF1ChiynoMKKGmGCvjbfBpHj0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wUoeJ73Ca6k9es4j7EVr2jJEJmjVtsJSkkO8mdnCKWRJ3tTvIMXBzss1OJraGRj3R05+vA5EmTD7vFM4Fzur5FTsyTj4s0ZNXKwgROjM2nXfOQoPZ7kxkAgJsqv3wHBjV5KJDwNBrqaxfDEN0CM+Md1pDsUbUSnaY3SwpUmAK1o= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TT4JTkYGsUWrAwLe67Qums4DlGhtWxhhxRc4rDfCBQM4FgUD6YriD20ZfQ8QD5gJbIU9vpZ66pUyLNHTWluYnvXPuV814+4yA0OHWdZJineq/NrqU97Q90EU61ZVPETay+AMHBZZa7lSJZTUqKuxFL5SKHJeSdv4SkAzo+W9vWyfFS4QTcS/A3MDdZMsxrJLsful0Usy2Fu8ioHmWiWoOSVK/RdenwRzI820e9yh3gYzegP/n5JoKWQwson5Sf2Pb/JjgJYioQEzbb8xZDjM/FR364GHQd/98qQioikFVZe2OxoDP9wwJONOgeTiy1PlT+WUCELAcA4vVU+Te88lIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ig3xHl+mxpp/p94vr+ggz1nKJUvmZCEhZUofBVXdDO0=; b=KsmNzwSbFWrZOe/nQjxp6ZkZadwRJudb5hd+nX8WxyaVNKazhBAEIsqmHYUC3JHcWJnl+A/x0PcwiMlC9Ocb3br6RDlCTiRTAKTIjvizIVi8vhC4CDzIEa3rt+rtu5Sqg6EX9QPchIUF4wbk3/evw4eo6ja8kUEuu2GpNwy4WEo6wA5TpFcSc93rjN0ukLaz8qW59TlJMSnO3kVYfPwUqGWy2lt3JjaTaW8ZbMF/h9Ila6G5pzVZYLJsDeaKcH/jMcCuW86L5rAHOBUaZ/yqfFQBR4u8Svub5+DbHqso8Ak/ud9LEJQJT6j5vHNVBNYGhBUXRb7Kb1YGVg5haPxOkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ig3xHl+mxpp/p94vr+ggz1nKJUvmZCEhZUofBVXdDO0=; b=Ihg204GgpvC9iCQP9l6oOUZDlS+eh8+okKm26ZKniYtCG0F6D2W4YdmmRX0YH3unYOEAo4hT0CR06MrwTtpSxxUDYC9SxX+bP0x9UwkgiwUq2GpjD/SVMwwSgIF0E/mXeWmtaZX1+N1W7uO/+Wm/ZpzM884A3z8849C2ZcpVW68= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DU0PR08MB8255.eurprd08.prod.outlook.com (2603:10a6:10:411::9) by PA4PR08MB7457.eurprd08.prod.outlook.com (2603:10a6:102:2a4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.14; Fri, 10 Jan 2025 17:22:57 +0000 Received: from DU0PR08MB8255.eurprd08.prod.outlook.com ([fe80::cbc8:c020:6a1b:d27a]) by DU0PR08MB8255.eurprd08.prod.outlook.com ([fe80::cbc8:c020:6a1b:d27a%3]) with mapi id 15.20.8335.011; Fri, 10 Jan 2025 17:22:57 +0000 Date: Fri, 10 Jan 2025 17:22:55 +0000 From: Andrew Carlotti To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford , Kyrylo Tkachov Subject: [PATCH 04/11] aarch64: Rename info structs in aarch64-common.cc Message-ID: References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO2P265CA0275.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::23) To DU0PR08MB8255.eurprd08.prod.outlook.com (2603:10a6:10:411::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR08MB8255:EE_|PA4PR08MB7457:EE_ X-MS-Office365-Filtering-Correlation-Id: ca5efa35-e6fe-4187-6819-08dd319b6d05 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: 01kG7MQ0IIRMDqjiFIo1ms+YMAw5xMHHQhbTQmr20cS9Dk6llyz+DjUEHA9Clo79fovzm84PbYQbukkETeiOh12TIQ4W0sKFKAtScx8WmS9Gngma101W691auS02S1aV0kMapM/SryiXTGiBbWasU0Xr033Bbq+wKBa1hYeGhIz5Gyt+JYP7SBD52zle+h0WVYlqdS3eW08J0NRZzoMOiRcNGcnFSsjUXJf3NpHupnJNKADA4zl/xUSnSHTZdK680BJlseDuPzidIE0UCQAUl9JOeTup9ySbM6qFNVHclZkrYYes7LTnO7IXCEr1WZXTU1LmAAwxj2LNVY2rLWRcDgr6fljXPv4eOth/kvBhvQbGpITH1h+TXqYM21raUo1SN+BMj8wjOqbfS6fGQMZxdoQAPx2X9L7DTCiGSnjPLyiMFSuql6Afq0HJtI6AN+bV4Z1FFfkIov18Qp+8BluN2kUNUw2jCLcHwbyX9+M6THOF8edXLM4f8s+KLIlFEx6U9otc3d/gK3jSQufW+RSy1AFpGw2ybgOKBjPuZ9UaWrlLRntfVwQ6k5CS+lhBRZGMCkSKjfbc/DwK9tV+aSoIG+u7SnIyYprzF2/FvZvod8lxbODaV3Cc5rkwPcR1IF32hFHymCU90UCPuhvnDZAWjwZONyh53kN2/e2MMjt/+BsDnNcEnpcp3q7CAfKo0DfFP7CG6C/ju6V76wUoHRaGKTpG4eRGQsSsOFR+0a6KN+FYNKkGQn7ihsGt4+nAU3XN5nsHcc9wPeGnKpuWVAG9Hc5B0/VjG5crHnf4twwqCHrsuXq+hMDQ5txB1z1CVnmhcbsWu533nLOgyRI1VmaO6y1d0qioE46jm7+gypigelD8iAXIUkv2zOYFn9cxDGgcqnZ5tUJ/mfnT7ir3eujK2++sUVw4e00o2iJRJIo5DiQHnzu6vQEIMXXJ0dRadbwwGUeRhqJaomPPVl3tE08USiWL1yZXnBkaNAKNskTXsn31be4pggBZE1ZtKnjTmFXn+diEpTnGzbK/GPRWjg/NsX0APdqZ/yysl/IyyYbFTvWSBk5JV3kKyXS3XhDwxlQpvK6DPQ03UVhL9oicAY1BetP7DCYWlMc1YhvLs0MOzpQg4+RxvTZklakQYc7RT8ZRYbfkH+rc0/3sAoZU+ConCxH7A8oiJPzNTJBCMXbj2cyuavp0rHVNHSHG8u7QMKozcfeKAx/HlGguFRpvYhV3deDkM76xBC5D2fXV6fjolaR4JoVss6NjnDmupOLhSWqCC+jr0W/sJbnke3xA0Y0hd29U8+2uqXUKgvNIa2t8UX27NNAcy7f71juHqlKEsLYbpJOFpvfyhYPHgtKzlOhtlGx0LeNK59oPaL1ZPiBRmJAi+/hiOzKXGWQaYQLg6Zon X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR08MB8255.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pvl8cfcJflTdLHYFpsxsKZha1zXwYiBDnLtTr8I4LhmnrPOdYIXYonfxkqLPiNM+p0O1anxQJoTOHTRW+mLhaWDR0cjVd86vXdpEAUY9O2urEJQ+x5LNcRnDNTG1S4Q2abfsybRxdNoUqQ1qX3BPHOTQ2GGV7hwZqMH0a8fYc9tVGvgRxFR63cJaloyPok+QhvuCbWltdg2AiTSNdZbefsQmWXHsHs18IMlyUDeECznBg655RWJyZAsEPMUip+CAOJGrgXyb5LDjSzOP5BsQYC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s7CDCPGvLEah9yO7R3gA9Q5YwYAKCQeRpo+70xhz0DtPh+Gcb9wyirqV51Rh+huyd6y0DITB5JQVgDApTrfUDG1jTNrVT1gQ+X3iGkv9cnPnKMxIqC2bnhiSZ1u+0dslWFOrs3T1QUp9sImwTJTLb8jBWfjSedXuZvkBsrs6NEnq00NFk+lUgUtSZ2LfM9F+4yQYutokH5Ur0uoM6uN2kBwd28sNGO7J2ha1NBKjyUSUs0Ppn2QUKKyL/ZZp4UQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca5efa35-e6fe-4187-6819-08dd319b6d05 X-MS-Exchange-CrossTenant-AuthSource: DU0PR08MB8255.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2025 17:22:57.6075 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9sVgimiPtQ1SgfwP6j7TBnXSTDvv/NV8/8y/+qKV5xjxSeGO0f1AOGgVYdlkdc8JwBANkNpiWtyZlgkIbDreHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7457 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Also add a (currently unused) processor field to processor_info, and change name from "" to NULL for the terminating array entries. gcc/ChangeLog: * common/config/aarch64/aarch64-common.cc (struct aarch64_option_extension): Rename to.. (struct extension_info): ...this. (all_extensions): Update type name. (struct arch_info): Rename to... (struct arch_to_arch_name): ...this, and rename name field. (all_architectures): Update type names, and move before... (struct processor_name_to_arch): ...this. Rename to... (struct processor_info): ...this, rename name field and add cpu field. (all_cores): Update type name, and set new field. (aarch64_parse_extension): Update names. (aarch64_get_all_extension_candidates): Ditto. (aarch64_rewrite_selected_cpu): Ditto. diff --git a/gcc/common/config/aarch64/aarch64-common.cc b/gcc/common/config/aarch64/aarch64-common.cc index 75600548fdc6ba6383174ba81202a3a079a2bf27..4f4e363539b7b9311bfcb7a8b30b706000e50352 100644 --- a/gcc/common/config/aarch64/aarch64-common.cc +++ b/gcc/common/config/aarch64/aarch64-common.cc @@ -145,8 +145,9 @@ aarch64_handle_option (struct gcc_options *opts, } } + /* An ISA extension in the co-processor and main instruction set space. */ -struct aarch64_option_extension +struct extension_info { /* The extension name to pass on to the assembler. */ const char *name; @@ -159,7 +160,7 @@ struct aarch64_option_extension }; /* ISA extensions in AArch64. */ -static constexpr aarch64_option_extension all_extensions[] = +static constexpr extension_info all_extensions[] = { #define AARCH64_OPT_EXTENSION(NAME, IDENT, C, D, E, FEATURE_STRING) \ {NAME, AARCH64_FL_##IDENT, feature_deps::IDENT ().explicit_on, \ @@ -168,38 +169,41 @@ static constexpr aarch64_option_extension all_extensions[] = {NULL, 0, 0, 0} }; -struct processor_name_to_arch +struct arch_info { - const char *processor_name; + const char *name; aarch64_arch arch; aarch64_feature_flags flags; }; -struct arch_to_arch_name +/* Map architecture revisions to their string representation. */ +static constexpr arch_info all_architectures[] = +{ +#define AARCH64_ARCH(NAME, B, ARCH_IDENT, D, E) \ + {NAME, AARCH64_ARCH_##ARCH_IDENT, feature_deps::ARCH_IDENT ().enable}, +#include "config/aarch64/aarch64-arches.def" + {NULL, aarch64_no_arch, 0} +}; + +struct processor_info { + const char *name; + aarch64_cpu processor; aarch64_arch arch; - const char *arch_name; aarch64_feature_flags flags; }; /* Map processor names to the architecture revision they implement and the default set of architectural feature flags they support. */ -static constexpr processor_name_to_arch all_cores[] = +static constexpr processor_info all_cores[] = { #define AARCH64_CORE(NAME, CORE_IDENT, C, ARCH_IDENT, E, F, G, H, I) \ - {NAME, AARCH64_ARCH_##ARCH_IDENT, feature_deps::cpu_##CORE_IDENT}, + {NAME, AARCH64_CPU_##CORE_IDENT, AARCH64_ARCH_##ARCH_IDENT, \ + feature_deps::cpu_##CORE_IDENT}, #include "config/aarch64/aarch64-cores.def" - {"", aarch64_no_arch, 0} + {NULL, aarch64_no_cpu, aarch64_no_arch, 0} }; -/* Map architecture revisions to their string representation. */ -static constexpr arch_to_arch_name all_architectures[] = -{ -#define AARCH64_ARCH(NAME, B, ARCH_IDENT, D, E) \ - {AARCH64_ARCH_##ARCH_IDENT, NAME, feature_deps::ARCH_IDENT ().enable}, -#include "config/aarch64/aarch64-arches.def" - {aarch64_no_arch, "", 0} -}; /* Parse the architecture extension string STR and update ISA_FLAGS with the architecture features turned on or off. Return a @@ -212,7 +216,7 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, std::string *invalid_extension) { /* The extension string is parsed left to right. */ - const struct aarch64_option_extension *opt = NULL; + const struct extension_info *opt = NULL; /* Flag to say whether we are adding or removing an extension. */ int adding_ext = -1; @@ -276,7 +280,7 @@ aarch64_parse_extension (const char *str, aarch64_feature_flags *isa_flags, void aarch64_get_all_extension_candidates (auto_vec *candidates) { - const struct aarch64_option_extension *opt; + const struct extension_info *opt; for (opt = all_extensions; opt->name != NULL; opt++) candidates->safe_push (opt->name); } @@ -396,16 +400,16 @@ aarch64_rewrite_selected_cpu (const char *name) processor = original_string; } - const struct processor_name_to_arch* p_to_a; + const struct processor_info* p_to_a; for (p_to_a = all_cores; p_to_a->arch != aarch64_no_arch; p_to_a++) { - if (p_to_a->processor_name == processor) + if (p_to_a->name == processor) break; } - const struct arch_to_arch_name* a_to_an; + const struct arch_info* a_to_an; for (a_to_an = all_architectures; a_to_an->arch != aarch64_no_arch; a_to_an++) @@ -423,7 +427,7 @@ aarch64_rewrite_selected_cpu (const char *name) aarch64_feature_flags extensions = p_to_a->flags; aarch64_parse_extension (extension_str.c_str (), &extensions, NULL); - std::string outstr = a_to_an->arch_name + std::string outstr = a_to_an->name + aarch64_get_extension_string_for_isa_flags (extensions, a_to_an->flags);