From patchwork Tue Oct 3 10:51:56 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: 14856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1997136vqb; Tue, 3 Oct 2023 03:54:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz0NdqlGZG9PKOAzG3i3yA8rUDXeDMri5mUQu4YD7edMt1ORHT3NUMiLRP6QuSWcB6PrHa X-Received: by 2002:a17:907:78c4:b0:9ae:329f:11c5 with SMTP id kv4-20020a17090778c400b009ae329f11c5mr13523879ejc.53.1696330459243; Tue, 03 Oct 2023 03:54:19 -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 la12-20020a170906ad8c00b009ade251eabbsi578076ejb.274.2023.10.03.03.54.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 03:54:19 -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="PzqD7/YY"; 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 C681F385559A for ; Tue, 3 Oct 2023 10:54:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C681F385559A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696330457; bh=M9XNwwrgltSHA0dC806xsS/NE4hZgSfLQonzubLWOe4=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PzqD7/YYaSt+0QFKLETXHB454ycG2L5oMBQcdVHrwZ+x5N7bL8CHTaZdGvaVavmFV 4zVWnENCkFxQIe2hNNPsex09Fo29078jLvIAc0jgRt+3ByAKVG0ph1RoxnlFntb5jU PWyHslxIIU2Zl9utHUtr4YFPbDvWkwKq+Rc+PDNg= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2089.outbound.protection.outlook.com [40.107.241.89]) by sourceware.org (Postfix) with ESMTPS id 085F73858418 for ; Tue, 3 Oct 2023 10:54:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 085F73858418 Received: from DBBPR09CA0006.eurprd09.prod.outlook.com (2603:10a6:10:c0::18) by AM0PR08MB5313.eurprd08.prod.outlook.com (2603:10a6:208:17f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.21; Tue, 3 Oct 2023 10:53:59 +0000 Received: from DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::48) by DBBPR09CA0006.outlook.office365.com (2603:10a6:10:c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33 via Frontend Transport; Tue, 3 Oct 2023 10:53:59 +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 DBAEUR03FT063.mail.protection.outlook.com (100.127.142.255) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.25 via Frontend Transport; Tue, 3 Oct 2023 10:53:59 +0000 Received: ("Tessian outbound fdf44c93bd44:v211"); Tue, 03 Oct 2023 10:53:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 76250af33cdee4c5 X-CR-MTA-TID: 64aa7808 Received: from e693397d8310.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7FC88A7A-953F-465B-956C-B24BB66C14E2.1; Tue, 03 Oct 2023 10:53:52 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e693397d8310.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 03 Oct 2023 10:53:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R/LdUPXGDnqtGOsDjPO8M1LfXCjDLaUTYdVFsjOFhfg/WJwPjRMKW0ExrukVbSx+X7uu25mN/RV7oETCTSRTYFfo9tKsAsBPDmn4BZHClrPGyAinDJ7SEANS7z5g2a6I1tUnFEcNEelF5c/aZDt6TLQprx3pBsxHDtB+GiEtNrq9J3KWxSeZAZjCspl9nHRx3KFB7kuCshDw4bVYsAHil5NGI/M1Zu3uFPpIyT1tN8CMuicaZ5sTYYDC1kqoMxYI+kG7sGJdMdYfxPssfnixaJPgzHOeaY5VnAWgFFGT+Z286IfL6hP6iRi3TDvvb0AsLJuiaFUIyVYxGMWRFTaO+g== 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=M9XNwwrgltSHA0dC806xsS/NE4hZgSfLQonzubLWOe4=; b=FxHp/ALNMfl4vGcd4iprc/6WqQaeWWAiZNmciwKQOtE702QCM2QCy9D/EKecuz4CzTWCWWQm2Y5hdO2tS7i2THyc05tQqB05boX+VnXgrxXeaDIKwNJWzkXQaKZSY2Yyue7P58YkoX1rKvCYXXLEGxhGLzbxf4toalMWJZKjRKdB9g57lXvNtFXPOtSlUx4295gG2Neb3HUxlUdzUt30B4nOsfjfAJklKEe/SfGhOc2NiCDzTwHvQYjL7S1ngEPC07v17e36iCVPPha0KapnSqEA2qmVBTo7WCIRSBtGTARovRig11uNfQvrPIeAHdID/P19cg8YUDMo5bgQ5R46Fw== 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 AS9PR05CA0038.eurprd05.prod.outlook.com (2603:10a6:20b:489::25) by AS2PR08MB9271.eurprd08.prod.outlook.com (2603:10a6:20b:59c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31; Tue, 3 Oct 2023 10:53:50 +0000 Received: from AM7EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:489:cafe::e6) by AS9PR05CA0038.outlook.office365.com (2603:10a6:20b:489::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33 via Frontend Transport; Tue, 3 Oct 2023 10:53:50 +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 AM7EUR03FT043.mail.protection.outlook.com (100.127.140.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6863.25 via Frontend Transport; Tue, 3 Oct 2023 10:53:50 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.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; Tue, 3 Oct 2023 10:53:50 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 3 Oct 2023 10:53:50 +0000 To: CC: , , Victor Do Nascimento Subject: [PATCH v2 0/2] aarch64: standardize system register representation Date: Tue, 3 Oct 2023 11:51:56 +0100 Message-ID: <20231003105338.1812768-1-victor.donascimento@arm.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT043:EE_|AS2PR08MB9271:EE_|DBAEUR03FT063:EE_|AM0PR08MB5313:EE_ X-MS-Office365-Filtering-Correlation-Id: 270cc356-b2a6-467d-ce3f-08dbc3ff0c32 X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr 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: uXSwKjx7Y/Gxd50lvz79C4wyehoG6EO/u2z3VhNalHj5gzxRix+9Qxtkn2CFoMMxcaDrdSNg9bdqNd4YnPv/zl+7Dl5ds2tD0fUVFLg4D/W+/1aSIWi/k4lSC+uwS0XO5OmO4kzufUs8iGW4ZzCs42iwc3P+4Z4DDgW/A6t6yfjpwCtRO29bxC5INLHkhS+uoELOt86NnAWYn6GxiMBeioeMSP4a4zN0I8T4Ha1gB5IO7td6DaxgbQKLsbME6/LgJbo8/2kbHYl+0GrqAiu0uwSKH1KDQ9TgOfsc8vXcbsatK2CILiSozsIzJt2lTFnoewGXIiCIVyl+itOeozl1oKeFzdIjK8DxXzWN6P1lJ9yONxtJinveOEL1FctWfFcQYxs040pttcOB6EsgMaLCqNDoc5DujqgRSvCso3PadP1tCAU1CGzGg670iHcIGFBn+KoObxGntCMDZOjU9h9cFv0teDGaXzPVMBaWoAzU02QvHPp43E7yqZfOAB720Wiyh95u9RwDOw7NWCaUvZ8UrB4pSI9aVX4PF6yKS8YLGze2Du6RhctAYJ7sstwyVSUuCAoUBnazdRjE4TP5isjjJ7/nMc40Sd7trPMMGJ7stY/9wQ9V0tuCm2EFP4Tuyq50PVSoQksJRU0I+CaqPmZwYOFp5C4Bb2bE64eD7BrHrWvoMH6ziUsVj4A8n5ToLqeqi8EyemMj9EJrelhE934GyfNwUWA7/9GC4yNAxGcuh5C4IsBT2WBnA72QbZZboKnO 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)(346002)(39860400002)(376002)(396003)(230922051799003)(186009)(451199024)(82310400011)(1800799009)(64100799003)(36840700001)(40470700004)(46966006)(36860700001)(47076005)(83380400001)(336012)(356005)(2616005)(1076003)(426003)(26005)(81166007)(40460700003)(40480700001)(478600001)(2906002)(966005)(41300700001)(316002)(5660300002)(7696005)(36756003)(86362001)(82740400003)(8936002)(8676002)(4326008)(6916009)(54906003)(70206006)(70586007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9271 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9f7b3f06-df5a-49b6-af31-08dbc3ff0742 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BEj5d5zF7y4YkLOWRyTqiGK7wyMkC0acSX3IzM2E/bnC6Oy0k0RYPR2qj+LfwpdK6HE6gRSmAc00ZmKHV9hT6lL+JhwKin3RYzWSGXlHBrrPSq56O1C1wEoFm3ID+eAA/CEYLOVUqRjSBPPWZZOkaGXXuQMLVOLdoK/XCV75YoT0A44ELUBGQB27K2z7NwwZENpUdbZod7zqMjQRsS8feJcjxM7+8PeYHgGn7SWiICCb4JCaB3Tv+ZuhTQwb5OYKQGbgODsS95Q3de3s9qiwtbfsQZPUHf07fPKEeEh+2eno01XKW4fGNcaQhz8tfkBt6Ip5oJg2DPDdrtytCEb0KtvVyd++SRCqpz2CGKD8Zz+C4rsJBOKnGPSrBine1hrNuHfBsuz7Q0w1OhpmLp2bAzBKVd8SH0+fIIEYUW15GGqs3ZeykneU12+pf9hcEV8QToMwDtu9b91kwTT+7NJqTfGutZDf8QfE/TXkwDPRdUb9m3+GQVKaBXBG93KsCnaAji8D11BIZBKfzr++ON/3X9c4Tlka8n4ydoXAkAPokyq57HeL1r+oxYz3pdwYZzF23XxUyMRFGunInJGNCb8TFtIn88Go2fwo6ovJbMZoawv4ajLngDLr/ynl55wNCDIc09OZHXb1pStwAxJASGr/iRWA2wHenLAlOieMmZaLOtI1O/Q99p14vQ40n9mZZorbGjpMQm4gi4pEgPUHu11BmEivOjBlOhr9Hqb1Rj8IsZI= 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)(39860400002)(376002)(346002)(136003)(396003)(230922051799003)(186009)(82310400011)(1800799009)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(83380400001)(40460700003)(36860700001)(47076005)(81166007)(2906002)(36756003)(86362001)(40480700001)(41300700001)(82740400003)(26005)(316002)(8676002)(6916009)(478600001)(4326008)(8936002)(54906003)(1076003)(2616005)(7696005)(966005)(426003)(336012)(70586007)(70206006)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 10:53:59.1790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 270cc356-b2a6-467d-ce3f-08dbc3ff0c32 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: DBAEUR03FT063.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5313 X-Spam-Status: No, score=-6.8 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 Do Nascimento via Binutils From: Victor Do Nascimento Reply-To: Victor Do Nascimento Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778731407615521208 X-GMAIL-MSGID: 1778731407615521208 Previously-approved patch rebased to accommodate changes made by the "aarch64: Restructure feature flag handling" patch: https://sourceware.org/pipermail/binutils/2023-September/129634.html --- 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-sys-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 can be used by both Binutils and GCC to specify 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 labeling 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. OK to install? Victor Victor Do Nascimento (2): aarch64: system register aliasing detection AArch64: Refactor system register data include/opcode/aarch64.h | 1 + opcodes/aarch64-opc.c | 1095 +--------------------------------- opcodes/aarch64-opc.h | 3 + opcodes/aarch64-sys-regs.def | 1060 ++++++++++++++++++++++++++++++++ 4 files changed, 1091 insertions(+), 1068 deletions(-) create mode 100644 opcodes/aarch64-sys-regs.def