From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32488 invoked by alias); 6 Jun 2018 22:17:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32437 invoked by uid 89); 6 Jun 2018 22:17:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Jun 2018 22:17:53 +0000 Received: from ESESSHC006.ericsson.se (Unknown_Domain [153.88.183.36]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id FD.23.00712.E8D581B5; Thu, 7 Jun 2018 00:17:51 +0200 (CEST) Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSHC006.ericsson.se (153.88.183.36) with Microsoft SMTP Server (TLS) id 14.3.382.0; Thu, 7 Jun 2018 00:17:50 +0200 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 7 Jun 2018 00:17:49 +0200 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Thu, 7 Jun 2018 00:17:49 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [10.0.0.110] (192.222.164.54) by DM6PR15MB2396.namprd15.prod.outlook.com (2603:10b6:5:8d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Wed, 6 Jun 2018 22:17:47 +0000 Subject: Re: [PATCH v2 01/10] Aarch64 SVE pseudo register support To: Alan Hayward , CC: References: <20180606151629.36602-1-alan.hayward@arm.com> <20180606151629.36602-2-alan.hayward@arm.com> From: Simon Marchi Message-ID: Date: Wed, 06 Jun 2018 22:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180606151629.36602-2-alan.hayward@arm.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YTXPR0101CA0034.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00::47) To DM6PR15MB2396.namprd15.prod.outlook.com (2603:10b6:5:8d::30) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR15MB2396: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Forefront-PRVS: 06952FC175 Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Office365-Filtering-Correlation-Id: b96a2429-f8fc-45f2-107c-08d5cbfb5594 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2018 22:17:47.3446 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b96a2429-f8fc-45f2-107c-08d5cbfb5594 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR15MB2396 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00162.txt.bz2 Hi Alan, I have some more nits/suggestions, feel free to cherry-pick the ones you want and push the result. On 2018-06-06 11:16 AM, Alan Hayward wrote: > @@ -2243,6 +2297,9 @@ aarch64_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum, > return group == all_reggroup || group == vector_reggroup; > else if (regnum >= AARCH64_B0_REGNUM && regnum < AARCH64_B0_REGNUM + 32) > return group == all_reggroup || group == vector_reggroup; > + else if (tdep->has_sve () && regnum >= AARCH64_SVE_V0_REGNUM > + && regnum < AARCH64_SVE_V0_REGNUM + 32) Here you use the magical "32" number but in aarch64_pseudo_register_name you used AARCH64_V_REGS_NUM to refer (I think) to the same number. Would it be good to use AARCH64_V_REGS_NUM everywhere? It might be good to extract that condition in a function: static bool is_sve_regnum (int regnum) { return (regnum >= AARCH64_SVE_V0_REGNUM && regnum < AARCH64_SVE_V0_REGNUM + AARCH64_V_REGS_NUM); } and use it throughout. > /* Helper for aarch64_pseudo_write. */ > > static void > -aarch64_pseudo_write_1 (struct regcache *regcache, int regnum_offset, > - int regsize, const gdb_byte *buf) > +aarch64_pseudo_write_1 (struct gdbarch *gdbarch, struct regcache *regcache, > + int regnum_offset, int regsize, const gdb_byte *buf) You could use the gdbarch from regcache. > { > - gdb_byte reg_buf[V_REGISTER_SIZE]; > unsigned v_regnum = AARCH64_V0_REGNUM + regnum_offset; > > + /* Enough space for a full vector register. */ > + gdb_byte reg_buf[register_size (gdbarch, AARCH64_V0_REGNUM)]; > + gdb_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM); This is checking a static assertion. You could use static_assert instead, which produces a compilation error if false. You can either leave it here or put it next to the aarch64_regnum definition. I have seen the same gdb_assert somewhere else too, with a static_assert you only need one. Thanks, Simon