From patchwork Fri Sep 8 12:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Do Nascimento X-Patchwork-Id: 13803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp497928vqo; Fri, 8 Sep 2023 05:10:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/8sMhh9SSltuvtbdIWsyleUTtfkPN3b9zLnFmeuwD0vmXy9osSmecHzuFNasAPAKvhdZ+ X-Received: by 2002:a17:907:62a5:b0:96f:9cea:a34d with SMTP id nd37-20020a17090762a500b0096f9ceaa34dmr6266569ejc.21.1694175047171; Fri, 08 Sep 2023 05:10:47 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gh25-20020a170906e09900b009a210885fadsi1178739ejb.24.2023.09.08.05.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 05:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=golYnha3; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A64EA3858C5E for ; Fri, 8 Sep 2023 12:10:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A64EA3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694175045; bh=6efFuTN2UZhc8kK+tcV8hLfBUOZT5/eEtUSnWk1+73w=; h=Date:To:CC:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=golYnha3s8LoOej5k1zDsO86IswdCXGg3KswVtZp/bTRvMnCxvUfkQyHZ60PZDUiP YGyL+uNKGYKMMHABmih9kmm5f3W/C2hOYShy24+RgJwwci//HUxmgN5BSx/vsNPWBi BTEB/nVqxz4UCRcBNUQXnWhf4E1nzS/jo48zmGsU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by sourceware.org (Postfix) with ESMTPS id 32AF93858D38 for ; Fri, 8 Sep 2023 12:10:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32AF93858D38 Received: from AM6PR10CA0055.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::32) by AS2PR08MB9473.eurprd08.prod.outlook.com (2603:10a6:20b:5ea::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 12:10:32 +0000 Received: from AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::3e) by AM6PR10CA0055.outlook.office365.com (2603:10a6:209:80::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Fri, 8 Sep 2023 12:10:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT007.mail.protection.outlook.com (100.127.140.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.28 via Frontend Transport; Fri, 8 Sep 2023 12:10:32 +0000 Received: ("Tessian outbound 0b7d6027328f:v175"); Fri, 08 Sep 2023 12:10:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 83bc766e36bea81b X-CR-MTA-TID: 64aa7808 Received: from 648711c2e201.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 58CFD474-690B-403F-89AD-E320F2E1763F.1; Fri, 08 Sep 2023 12:10:25 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 648711c2e201.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Sep 2023 12:10:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGg1ygktWTgBRVgCBtKu8wBAKtfkJwOTZ5NnM1WUUYpg5CeyJdiiVvUduIc+Y4hMG0dhRJOeJhFLrVp4WxErtDn163eDizLgV/GS/jX3Fq0rJLAW+BrxFu8xpUmCdGAmMkocWXJZx6OyQ+SjHuionUfDQCTYi0hQrNuKV5nLogzuHAnrjNMhjtTEj7hJL/HbJhfNE69AK72/LNI+JgO6W6KR/wGD0JTTmBC0ujOJxBOGL2rvID15PobREkEdReOjGwYzxMZRItG+EBcttq6fmVVjDJ6vqDFkRFkxO2TFiQL5cpRSmWVsigTfocDuY7eApA7yFl+QpoGmEHUtQqY35Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=6efFuTN2UZhc8kK+tcV8hLfBUOZT5/eEtUSnWk1+73w=; b=AV4y6EqYNv75rYfLx6oVGnxEoUoGCOtG9seMtG10zgWQuSS0kT3tIykCMn9pui0GPMQj2EnNd3k2Hwwg7r3H9GqPMHbI5DMbOZ0c5mQq7qoEg0C3Axg/MK9yJHj095GmabzrZMPY1Pnzo/y8SwCl4AoXzvO4goB5fy4K7+70Y9dmLJj3CFlN14eoVmvD3Q1Xrz2c0vxdHzgVqK69jjg4+Z6QTgiu7kfk2y7Cb4I7FMc9lHnj7IqjuMGsnCPJALUtIlkIn6dzZLe1C0cCFbyIXmnEjFf+5bceXCQZOZ/WuR8OUshda9ZdfxKKa908heJJJBnfSJALsaRlmAoS30FM3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM0PR04CA0144.eurprd04.prod.outlook.com (2603:10a6:208:55::49) by DB8PR08MB5514.eurprd08.prod.outlook.com (2603:10a6:10:fa::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 12:10:23 +0000 Received: from AM7EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:55:cafe::79) by AM0PR04CA0144.outlook.office365.com (2603:10a6:208:55::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Fri, 8 Sep 2023 12:10:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT038.mail.protection.outlook.com (100.127.140.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6768.28 via Frontend Transport; Fri, 8 Sep 2023 12:10:22 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 8 Sep 2023 12:10:22 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Fri, 8 Sep 2023 12:10:22 +0000 Date: Fri, 8 Sep 2023 13:10:21 +0100 Message-ID: To: CC: , Subject: [PATCH 0/3] aarch64: standardize system register representation MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT038:EE_|DB8PR08MB5514:EE_|AM7EUR03FT007:EE_|AS2PR08MB9473:EE_ X-MS-Office365-Filtering-Correlation-Id: 9732cb0e-0d7c-4900-f7f9-08dbb064999d x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: QCcjf+oYO2AIUE6hIvHZRbt+4XoK0DnslyNGD/DCz+2MoWbF8IFAr398GOziUSaVf9yBOsIsCHGGrJ+bCyRUrHWWUK4ZVSQ/BBpzifrr4vAuXJ3O/i6xmf+ByoTXUnE9nlNIBrk1w9I5z/UzChAaySP4UzZtyWfSxO6w2ql85CwXDZQmgcydFcwDE7O/yNRPhnW/5OKJukY2uU/MqzcPvC43dxI7V7tH3t8751alpfde0Qbk3MIlWtGDvRDHvLmWyDDKlfHGcusgviBE0QDAMrVHSpgQK1Lw4Udd3u444d44chispWaFUBCNqiYUWHxgjkyNLjzA7tGT21eP5tRdpt++HyCNCvyQw+XYtt0Tv30h8Oo4mvSZawwSzLYxX6ZfKiTgu4OsaNBf+dT/YiZR75jqKRyI6dPkhCQjKghLflLTqPdldvKYsxr7CueJLVskgYx4Ij0SIJPQoW6i41H2n9dTYfNy2ktEYqmI3vh2vCyN/YQcMNOMPanY9IJglRhBvGKYxDBe26crpI5YgH1y9OHIDaz1/oFA8zdUoWgiesslb5zisV2v5fX6OGAdDsJ/ldGRi/snH72BRRHVdXFPcSY6C1C8EmUjaVU3PrrvD85MJ9HYsyh1IeQLrKqlAzLqpTgNg//b+k8GWvbqkN0V+/LuFW7XhPeg8UM0kltglxQW5IPetjDdrScMjVffAHOr62uAhoTWSNpV9qFV81iXPE05MMkSNzYutNaFP1axMqK/4bLW2R9UpIjImAT/SivOcAV3Jg18RdjDD5EcKTp/ag== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(376002)(396003)(346002)(39860400002)(1800799009)(186009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(40480700001)(40460700003)(41300700001)(7696005)(81166007)(82740400003)(356005)(2906002)(478600001)(86362001)(316002)(6916009)(70586007)(70206006)(54906003)(55016003)(5660300002)(83380400001)(8936002)(8676002)(4326008)(26005)(426003)(336012)(36860700001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5514 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a247d511-f8d3-49a9-e768-08dbb0649402 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OgsAVyCQxcFbzfX/Y4LYyVAwp3YEJBwaJpdltxZKU75rmfypyaG1S/pUuBOwAYbpkP4NKdciPNdGEy/UKDtZRi8DfymRl9a1E9fGDGkvDC3EsDrQ/Bqj3XEli0QRSH6D7Mb5/VTcCEDXujqLr+3c1lzYe7Isls3aI0yU6Fnl29Y6eMfzF4uvVw6ulw79O7n1/bIrHBbO2Aif3H6yr8wxnTYVSEYeDOzRgV8C68VioAfiJPaizfpj1ZoE5CFxMUFnxzE40jJKu5yRqFWWn5H4NxQQZozPhqwzIYwudrsPdG8hMhSHKhTxwFgJqnC9c5JvxyixtaqYVwGVHK24wqk0naXN+I8cruT2GpQjvtXhOutI/Z27EzfinkmOG/LQQBFMXwk/fDfVhtK8azWULTutB/xj0UZjb1ghKx84+tb+40sWPn/xBm84ylzyCsTG/koMBJSNfu2IhgK3eYakrB5+x1Du166dcx1kGEocFFYNCxni4hSOZBIlFr5F27OuVo2H3PlffMm5oOFn5mNeQKzLLdle5Sv6CKpG08rZWA7qmFpo+bGvSvxExDF6MPS2NOkbYHmepM5A1vKPIMdpH5nZTg3mTb6cyXvBHn+Hm4SfU3xiUIaG+4C00Nw0rLY1XhRH7eAsLpQbwWL4AmxEieVgKDcj37qVCpII/QQu65XXkWCnBdVcPwOKBiD2clbBDFqRsqLmaRMYU9pGUOAgWOGLJ2npCgH5xd3EqMJr+ep5Tj0QmpxeFPPCuDMjwBw2Mral X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199024)(82310400011)(1800799009)(186009)(40470700004)(36840700001)(46966006)(5660300002)(316002)(70206006)(70586007)(7696005)(478600001)(6916009)(54906003)(26005)(336012)(426003)(8936002)(4326008)(83380400001)(41300700001)(8676002)(2906002)(47076005)(36860700001)(40460700003)(82740400003)(81166007)(86362001)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2023 12:10:32.2917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9732cb0e-0d7c-4900-f7f9-08dbb064999d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT007.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9473 X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Victor L. Do Nascimento via Binutils" From: Victor Do Nascimento Reply-To: "Victor L. Do Nascimento" Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776471293762265322 X-GMAIL-MSGID: 1776471293762265322 This patch series standardizes the representation of system registers, moving them out of their original place in `aarch64-opc.c' and into a dedicated .def file, `aarch64-system-regs.def'. The purpose of this work is to disentangle system-register representation from anything that is Binutils-specific. This way, with a more generic representation format, the information can be shared between different parts of the toolchain which rely the same information, reducing maintenance burden. More specifically, the .def file herein defined has a format that can be used by both Binutils and GCC to specify architecture-defined system registers. With the relevant macros defined in `aarch64-opc.c', the key step that needs to be done to load the system register information into Binutils is to have the `#include "aarch64-system-regs.def"' preprocessor invocation within the definition of the const `aarch64_sys_reg aarch64_sys_regs []' array. We note that the previous implementation was sensitive to the order the registers were stored in the `aarch64_sys_regs []' array, particularly in the case of register name aliases. This led to poor maintainability and caused the disassembler to favor the alias name if the correct, arbitrary ordering between registers wasn't kept in the array. A mechanism for labelling and, based on these labels, identifying these aliases is also added. This eliminates bugs that come about as a consequence of reordering elements of the system register list and gave us freedom to reorder elements in the array as most appropriate. Based on this freedom, system register entries in this new file are ordered alphabetically by name. This choice is made to enable the use of fast search algorithms such as binary search when validating register names. Regtested on aarch64-none-elf and aarch64-none-linux-gnu Victor Do Nascimento (3): AArch64: Refactor system register data aarch64: macroize archictectural feature union in SYSREG aarch64: system register aliasing detection include/opcode/aarch64.h | 2 + opcodes/aarch64-opc.c | 1104 +------------------------------ opcodes/aarch64-opc.h | 3 + opcodes/aarch64-system-regs.def | 1059 +++++++++++++++++++++++++++++ 4 files changed, 1097 insertions(+), 1071 deletions(-) create mode 100644 opcodes/aarch64-system-regs.def