From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2043.outbound.protection.outlook.com [40.107.104.43]) by sourceware.org (Postfix) with ESMTPS id 093203835690 for ; Fri, 22 Jul 2022 12:13:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 093203835690 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UkiqwMXnWTQw8wCSU9mM7BFjk10eS9IZtagIrTbC9iHV/KVw2fOYQFsuh3mTqNXhIWROLcrs2HWO5a+2yHiqKnHnO6gUWWPUVfJZ5JlWjyq0qOtsug5dcuSILbeho0Mb5hL6ziY9fUvYVzZfjaTmx4xZ3YS0poMNPdF/ZFVJSRCcbV0hUS+emOf/5nrIwTaBIojmO5KpSt854XqC5vLUVY+o6VVd1KXglvV89TECBOb4AUj99JsnX/DoNDuzoimC02zMZ+x4hK9J0yv8zZlGgH8dJu0S58VkHF8bBigMZf1t8e4OHN22O6b/FaRB0NXD7bXS/gmxLazYTxj61zT0hA== ARC-Message-Signature: i=2; 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=ZjjiWCeQoaYcyqkbqlLy99XF1TDvLC4TEyQodawyR/Y=; b=TYJBEmv32SpHqE8j3MBiQws9vFcGZVDHH52uaarN28LR+zJ4aTDD8TXKai2sRqNxhiS8v4LslOzvcaDtOXP/FS3AC+0occCrjEV4h6lTXtLFft8muyzVaClZiOdxU9PRMEL36S5OLwfwLk5bxaAZorVRFf0wcsf3s3gAICaWAFXaglkIWxvg1vWNkn9wJJYoazM2o1Zq8R8Yc/zDf4HLHFVGlIghhkKX583yCSSAPRLhhMESFAbhRgNNPWPnTAhGnLnkk7cmBdfZyJCuJB+fZ0wTkt1mtyx0UOqz8lmdYPu2EW3109uCNuOJFacu8yaQk+cTzfhTWWftbr2pycm6fQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from DB6PR0202CA0038.eurprd02.prod.outlook.com (2603:10a6:4:a5::24) by AM9PR08MB7016.eurprd08.prod.outlook.com (2603:10a6:20b:41d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 12:13:06 +0000 Received: from DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:a5:cafe::d0) by DB6PR0202CA0038.outlook.office365.com (2603:10a6:4:a5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19 via Frontend Transport; Fri, 22 Jul 2022 12:13:06 +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 DBAEUR03FT006.mail.protection.outlook.com (100.127.142.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 12:13:06 +0000 Received: ("Tessian outbound 2af316122c7a:v123"); Fri, 22 Jul 2022 12:13:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a0e76615f19faad8 X-CR-MTA-TID: 64aa7808 Received: from f89a6c321492.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E1BF57A0-5532-4FB0-99EC-7CF6B883AA0C.1; Fri, 22 Jul 2022 12:12:59 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f89a6c321492.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Jul 2022 12:12:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dNILZVXcqrOKGNrHJQLYWTR9I9jH+XyjRAHc9alW0uDngI0j3TdQPLq65A1/onPFva3NbDb/uBKrh2H90QEUvYjdD/shLdD2qRmSAYXvoq3flCQLv0DSVt8udfigaludX7nBeHNdZ54r3zLQ7nBYWfqFEp3tIT4VuVLOFALWLhh2qu7s7msefwhPK4FjRehVV2IGdPi3xzKhAszkhkbzJxIjSiMXTgj22/agrtE7znbSng0+OA93c7pVnMwqglBeyf/OV+XcbLwJ//K2GbK8iqzI1A80jCBvgCgKS184bjXP8oP/p6QG02JMJh8+stkCDuYw5vv+6xy88KV9v8p19g== 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=ZjjiWCeQoaYcyqkbqlLy99XF1TDvLC4TEyQodawyR/Y=; b=cq0yii12mHGAG/VQn9ZBRsoeZXtvOxWtEkjlh9DsdGdMfH9sU5Vvbf+wk+a7Xp32c5tvEOf5ijQVy9u++3ac8E35qna+Cst98sSYsNfXcSv7wGSnbKPH+webS+eW+EDIJrgj6eCjtozUBKTbEuKMupKuS8AjvzvpWPm4zg3rIcnlfwFgWUhHfkR0D3XiY/dalzpel1CTHTcuPUjibf2hraFtJ+caQZq7lILUVzumKuGgPp1FzRWVfmvmqMj7/HGiAvKUb3QAPkYLU9IAw+YSvCs8WCvLpvcD7fQLP2H9q6cssD+g70W5z/Rd1lHxri9ylQvuNf/uU03DyQPvo5UP5A== 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 DB6PR0501CA0010.eurprd05.prod.outlook.com (2603:10a6:4:8f::20) by VI1PR0802MB2494.eurprd08.prod.outlook.com (2603:10a6:800:b6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15; Fri, 22 Jul 2022 12:12:56 +0000 Received: from DBAEUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::aa) by DB6PR0501CA0010.outlook.office365.com (2603:10a6:4:8f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19 via Frontend Transport; Fri, 22 Jul 2022 12:12:56 +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 DBAEUR03FT022.mail.protection.outlook.com (100.127.142.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 12:12:56 +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.9; Fri, 22 Jul 2022 12:12:54 +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.9 via Frontend Transport; Fri, 22 Jul 2022 12:12:54 +0000 From: Victor Do Nascimento To: CC: , Victor Do Nascimento Subject: [PATCH][Binutils][GAS] arm: Fix DWARF pseudo-register numbering convention Date: Fri, 22 Jul 2022 13:12:49 +0100 Message-ID: <20220722121249.22131-1-victor.donascimento@arm.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: f500da77-6b2a-4a40-1657-08da6bdb88d5 X-MS-TrafficTypeDiagnostic: VI1PR0802MB2494:EE_|DBAEUR03FT006:EE_|AM9PR08MB7016:EE_ 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: 6MjY0lkfNRnh8Ttnci7xGGYfVhCtQsUedzVmdrI2MhRgALF2ZdUOwSc13rFvOkjtuaJ3QnGUlRyx+m4Hwuwwx77/l7giEToJJ4sUKDYJmlSjqq2PwsFt38zsb1TL9iZL/8YQDY9GlrK5BUJR1ewnX1ILj4tTB/+bCCQYIGVNxc8WJVNa8nbwyKSps6GdFwcdxyvkvabuOQ2lcoaZ80UhkLgjtjaA/E4p4kjJvRlEIhfQ3WtpXb6YO30V4fZn3kJzNSti7Dhz/1qoUfvT/nn33CMRMU/ShsbNah6b5mzuzuzDEt2Rf5tJnpTGHu6vmHatxDTCg/ZN1u65OTM4Tbvzj1+j9RoZ0Dw/quH1AfG74p6Q3+6i6uSJ7rqknxwXuPcsw7mMa/TWOBXEqiP2C0Pjqg4x/7Y0T2FRiM99uVAbYrw6mHYJe9sHwucBvCLrcxGMIO44D/OwjiWZA0SoVzcGtSsOyz4Ll26N8fA+bTZxb7eBm1+Z6xAV5bT19ZCzS7leYGJ9SnV6vGdl5Fu4eTq0sxDBmTlGbDftl/2Zs3Dlq/jPtWEQg1X4ChZhDlJWZK8Fe7u/B9qe2bgAD0omqYEISP6bVcvGoXj0fkqf/qr4K2gosDRAxG4FU95hYhv1Ny0RS0uQHeIO63c/c4Ssgkb7FgMjSHDaYICDIuu4bDu9TBKksKQojBYiZPjrUqACSSo8jkcrxMD/wgp4hyU5E4L+Y2EFPlxUt3LkYTVMYUBJOSMjWDH73VBFOP2bLDPRCTsW4BMDwwli1mcrktWnWmCw93Cz1Msd5lCmuxH8STCx+s9dMpaZ0X0vrOMB03aZX+mKGImE5ZGUIgS0HlG0xoB1XWaaluVV5PID85/31GoK448= 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:(13230016)(4636009)(376002)(39860400002)(396003)(136003)(346002)(36840700001)(40470700004)(46966006)(186003)(1076003)(6666004)(2616005)(41300700001)(26005)(83380400001)(2906002)(426003)(47076005)(5660300002)(336012)(82310400005)(478600001)(36860700001)(70206006)(70586007)(7696005)(40480700001)(8676002)(316002)(6916009)(40460700003)(82740400003)(86362001)(4326008)(356005)(81166007)(8936002)(54906003)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2494 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 864237a8-da22-4229-d37a-08da6bdb82f6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f/IbXCPmRHjv6pYT4U4CqsYTMiOAeQR4jJyb6s6enlyWPxvGMg8pKL9dFT4AEcz/s1wwe0DI+5UiyUCLchxe7WFxqghOeAnIdDVR3Eaf1O6GGd5IUp+2ZB0eKNMb+5OqL6p27KMX4g3W/ftu9dmlSBYoM6NpXrdOG3PBXYWyXXy73/gB91SV1XS69ceNJ0KWI1ne+fxppj+7SvHlK6sOV9404iCxnfFgNfcL9So0P4G9VsZQ4eCaKpVIUMLKOz+wBFa3HNSj/Y+GxUJN9ESMaha3iRyO4KJjAZYGO9MfN/dL5KFkzDtCwiPsV4bBnT0/ks85xuuo+s1fGuye7YphrJcvzSF+J5u0Zd11S++4Ua4miFeSsdST/1sFWYIVAgK2/6gZZyojNCNby3hbRUlSlmsRcTZ6W9sonvIZLtu3NZS8Ns+ndLqQEicYVhnYoL01J+igoklcDto6eEPBbgOWvwCbZo0tBjcLzW15zawZVUK4b8TuBf+kmukm1zeB9uHEcHhtVxMMSGT1Xk8aJSw/leiD9KpNUls+xrpJ+ctdOZKqgS7702sAlkbW29r0RXhp+VAvc7Uc/N16rpPiw7OMsdfqBdnkZBZc0r+UDbtzAqxQkYliRA7jsgU8KGqpPGGy9pWJU6G6rgoHK8lqPIFCle70S4axITszznVnompJrTh2sFcuT199m8Gtbc5xlb7kmv59vQDZUlac2I0pae/Udn+qEWwM5XZE/uoMzbD6I2bZ+iYbCFwkHxKuUA7wdJC6rrVcUsOWZcFB9C2+QdlcTUZ9kapTtCnMxIe+LsXxOAX6dbTqgFHlEXNv33x6YVNCpSqzoQh1odkLzjLYT+KSZQ== 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:(13230016)(4636009)(396003)(376002)(136003)(39860400002)(346002)(36840700001)(46966006)(40470700004)(5660300002)(478600001)(8936002)(7696005)(86362001)(6666004)(41300700001)(40480700001)(70206006)(2906002)(26005)(36860700001)(81166007)(40460700003)(82310400005)(54906003)(1076003)(47076005)(336012)(2616005)(426003)(186003)(82740400003)(36756003)(83380400001)(6916009)(4326008)(70586007)(8676002)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 12:13:06.3866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f500da77-6b2a-4a40-1657-08da6bdb88d5 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: DBAEUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7016 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 12:13:19 -0000 Hi all, This patch restores the assembler internal numbering of DWARF pseudo- registers to the preferred modulo 134 convention (see "4.1 DWARF register names" in [1]) and amends the unwinder .save directive processing code to handle this. Issue: 1. DWARF pseudo-registers to be assigned their own reg_entry numbering system based on modulo 134. Pseudo-reg no. 143 thus gets assigned to (143 % 134) = 9. Not orthogonal to core-register numbering. 2. We must have a way to to map pseudo-register numbers to corresponding physical register numbers and vice-versa. More concretely, issues first arise when invoking s_arm_unwind_save_mixed. Consider parsing the hypothetical directive: .save{r4-r7, r10, ra_auth_core, lr} As `.save`-ing ra_auth_code requires a special DWARF opcode, this directive must be split into several sub-statements, i.e. .save{r4-r7, r10} .save{ra_auth_code} .save{lr} we pass s_arm_unwind_save_mixed 2 bitmaps - one of physical register numbers and one of pseudo-register numbers. core-register bitmap: 000011110010001 pseudo-register bitmap: 000000000100000 Under proposed modulo 134 numbering system, this would erroneously produce: .save{r4-r7} .save{ra_auth_code} .save{r10, lr} the pseudo-reg bitmap must be cast to physical register space to know how to split .save directives correctly. So something like: core-register bitmap: 000011110010001 recast pseudo-register bitmap: 000000000000100 would give us the correct split of the .save statements. 3. so our bitmap of pseudo-registers cast in physical register space tells us that bit 12 came from a pseudo-register, but with no guarantee (or indeed any reason to expect) that there is preservation of register ordering in mapping between DWARF register space and core-register space, in the presence of multiple pseudo-registers, there is no immediate way of inferring which bit in the DWARF bitmap mapped onto bit 12. This therefore creates the need for a function to convert DWARF bitmaps into core-register bitmaps for splitting the register list and then another for translating core-register numbers back to DWARF register numbers to correctly handle the pseudo-registers. This is the least invasive implementation for handling the proposed DWARF modulo 134 numbering system, but also seems to involve a great deal of mapping to and fro numbering conventions. I've not yet thought of an alternative that is better and doesn't require too many invasive alterations to the existing codebase (though I'm sure it may well be out there). Therefore, any feedback/advice/suggestions would be most welcome. Proposed changes: 1. Implement a function to cast a bitmap of pseudo-registers to corresponding physical register numbers: tc_dw2range_to_arm_range. 2. When emitting an unwinder save instruction for a pseudo-register have a function that maps back physical register ranges back to the correct pseudo-register numbers: tc_arm_range_to_dw2range [1] Many thanks, Victor gas/Changelog: * config/tc-arm.c: (reg_names): Renumber RA_AUTH_CODE from 12 to 9. (parse_reg_list): Ensure correct range-handling. (s_arm_unwind_save_pseudo): Fix register number. (s_arm_unwind_save_mixed): Add number system interconversion. (tc_dw2range_to_arm_range): New. (tc_arm_range_to_dw2range): New. * config/tc-arm.h: Add new function prototypes. --- gas/config/tc-arm.c | 64 ++++++++++++++++++++++++++++++++++++++++----- gas/config/tc-arm.h | 2 ++ 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 2e6d175482e..f66d2acca0e 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -1948,13 +1948,13 @@ parse_reg_list (char ** strp, enum reg_list_els etype) if (reg == FAIL && rt == REG_TYPE_PSEUDO && ((reg = arm_reg_parse (&str, REG_TYPE_RN)) != FAIL)) { - cur_reg = reg; + in_range = 0; continue; } else if (reg == FAIL && rt == REG_TYPE_RN && ((reg = arm_reg_parse (&str, REG_TYPE_PSEUDO)) != FAIL)) { - cur_reg = reg; + in_range = 0; continue; } @@ -4301,7 +4301,7 @@ s_arm_unwind_save_pseudo (long range) { valueT op; - if (range & (1 << 12)) + if (range & (1 << 9)) { /* Opcode for restoring RA_AUTH_CODE. */ op = 0xb4; @@ -4724,15 +4724,19 @@ s_arm_unwind_save_mmxwcg (void) static void s_arm_unwind_save_mixed (long range, long mask_range) { + + mask_range = tc_dw2range_to_arm_range (mask_range); + while (mask_range) { long mask_bit = mask_range & -mask_range; + long pseudo_reg = tc_arm_range_to_dw2range (mask_bit); long subrange = range & (mask_bit - 1); if (subrange) - s_arm_unwind_save_core (subrange); + s_arm_unwind_save_core (subrange); - s_arm_unwind_save_pseudo (mask_bit); + s_arm_unwind_save_pseudo (pseudo_reg); range &= ~subrange; mask_range &= ~mask_bit; } @@ -23998,7 +24002,7 @@ static const struct reg_entry reg_names[] = for tc_arm_regname_to_dw2regnum to translate to DWARF reg number using 134 + reg_number should the range 134 to 142 be used for more pseudo regs in the future. This also helps fit RA_AUTH_CODE into a bitmask. */ - REGDEF(ra_auth_code,12,PSEUDO), + REGDEF(ra_auth_code,9,PSEUDO), }; #undef REGDEF #undef REGNUM @@ -27936,6 +27940,54 @@ tc_arm_regname_to_dw2regnum (char *regname) return FAIL; } +/* Cast a bitmap representation of a register set from DWARF-2 modulo 134 + pseudo-register numbering to the corresponding physical reg. numbers. */ + +long +tc_dw2range_to_arm_range (long pseudo_range) +{ + long phys_range = 0; + long reg = 0; + while (pseudo_range) + { + reg = pseudo_range & -pseudo_range; + switch (reg) + { + case (1 << 9): + phys_range |= (1 << 12); + break; + default: + break; + } + pseudo_range &= ~reg; + } + return phys_range; +} + + +/* from DWARF-2 modulo 134 pseudo-register numbering retrieve physical regs. */ + +long +tc_arm_range_to_dw2range (long phys_range) +{ + long pseudo_range = 0; + long reg = 0; + while (phys_range) + { + reg = phys_range & -phys_range; + switch (reg) + { + case (1 << 12): + pseudo_range |= (1 << 9); + break; + default: + break; + } + phys_range &= ~reg; + } + return pseudo_range; +} + #ifdef TE_PE void tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index d2176e03c98..8a8cb15d702 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -359,6 +359,8 @@ extern void arm_handle_align (struct frag *); extern bool arm_fix_adjustable (struct fix *); extern int arm_elf_section_type (const char *, size_t); extern int tc_arm_regname_to_dw2regnum (char *regname); +extern long tc_dw2range_to_arm_range (long); +extern long tc_arm_range_to_dw2range (long); extern void tc_arm_frame_initial_instructions (void); #ifdef TE_PE -- 2.36.1