Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Hayward <Alan.Hayward@arm.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	nd <nd@arm.com>
Subject: Re: [PATCH v2 01/10] Aarch64 SVE pseudo register support
Date: Thu, 07 Jun 2018 09:34:00 -0000	[thread overview]
Message-ID: <2CE4B909-5C48-4ECC-8BDF-E13EBAF3C7EF@arm.com> (raw)
In-Reply-To: <c5fd6b07-ee3d-4d97-54ee-2703480500af@ericsson.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3093 bytes --]

Thanks for the review. Updated as below and pushed.


> On 6 Jun 2018, at 23:17, Simon Marchi <simon.marchi@ericsson.com> wrote:
> 
> 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.

Updated to use AARCH64_V_REGS_NUM.

I originally used 32 because I was matching the style of the code above which
uses 32. Agreed in this case makes more sense to use AARCH64_V_REGS_NUM.

Didn’t add the func, as here we’re checking against AARCH64_SVE_V0_REGNUM
and not AARCH64_V0_REGNUM.

> 
>> /* 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.

Not changed.

Make sense, but regcache is already being passed into aarch64_pseudo_write (which
the function type is defined in gdbarch). Easier to just pass it straight down
given the compiler would have already have put gdbarch in a register.

> 
>> {
>> -  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.
> 

Updated to gdb_static_assert. Left both of them in the code at the same place (there’s
one in the read func and one in the write func).

I wanted something explicit in this function because these are (I think) the only
two functions that rely on the defines being the same.


Thanks,
Alan.

\x16º&Öéj×!zÊÞ¶êç׏4Û‰b²Ö«r\x18\x1dn–­r\x17¬

  reply	other threads:[~2018-06-07  9:34 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 15:16 [PATCH v2 00/10] gdb/gdbserver support for aarch64 SVE Alan Hayward
2018-06-06 15:17 ` [PATCH v2 01/10] Aarch64 SVE pseudo register support Alan Hayward
2018-06-06 22:17   ` Simon Marchi
2018-06-07  9:34     ` Alan Hayward [this message]
2018-06-06 15:17 ` [PATCH v2 03/10] Add reg_buffer_common Alan Hayward
2018-06-07 20:19   ` Simon Marchi
2018-06-07 20:42     ` Simon Marchi
     [not found]     ` <CEE89B18-4FE7-4171-9BBF-0FD17AECFBED@arm.com>
2018-06-10 22:21       ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 02/10] Add Aarch64 SVE Linux headers Alan Hayward
2018-06-08 14:13   ` Alan Hayward
2018-06-08 14:37     ` Simon Marchi
2018-06-08 15:27       ` Alan Hayward
     [not found]       ` <82743c0795488492486076685b9f8828@polymtl.ca>
2018-06-12 14:37         ` Alan Hayward
2018-06-12 14:51           ` Simon Marchi
2018-06-12 16:34             ` Sergio Durigan Junior
2018-06-12 17:51               ` Alan Hayward
     [not found]                 ` <8736xr4ukx.fsf@redhat.com>
2018-06-15  9:45                   ` Ramana Radhakrishnan
2018-06-15 17:14                     ` Alan Hayward
2018-09-20 21:16                       ` Status of the AArch* builders (was: Re: [PATCH v2 02/10] Add Aarch64 SVE Linux headers) Sergio Durigan Junior
2018-09-24 14:16                         ` Alan Hayward
     [not found]                           ` <87a7o7ot6r.fsf@redhat.com>
2018-10-11  9:23                             ` Status of the AArch* builders Alan Hayward
2018-10-12 19:06                               ` Sergio Durigan Junior
2018-10-15 10:16                                 ` Alan Hayward
2018-10-15 12:42                                   ` Sergio Durigan Junior
2018-10-15 14:02                                     ` Alan Hayward
2018-10-15 15:32                                       ` Sergio Durigan Junior
2018-10-17 18:46                                         ` Sergio Durigan Junior
2018-10-24  9:56                                           ` Alan Hayward
2018-10-25 16:26                                             ` Sergio Durigan Junior
     [not found]           ` <8f6d2b87-707a-3e34-325c-ed9338e9c1f6@redhat.com>
2018-06-12 15:06             ` [PATCH v2 02/10] Add Aarch64 SVE Linux headers Simon Marchi
     [not found]               ` <0f4bd1b7-897f-b42a-3067-2397a1b4c58c@redhat.com>
2018-06-12 15:21                 ` Simon Marchi
2018-06-12 15:09             ` Alan Hayward
2018-06-06 15:17 ` [PATCH v2 08/10] Enable Aarch64 SVE for gdbserver Alan Hayward
2018-06-11  0:49   ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 06/10] Add Aarch64 SVE dwarf regnums Alan Hayward
2018-06-11  0:43   ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 04/10] Add regcache raw_compare method Alan Hayward
2018-06-07 20:56   ` Simon Marchi
2018-06-08 15:16     ` Alan Hayward
2018-06-10 22:26       ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 10/10] Remove reg2 section from Aarch64 SVE cores Alan Hayward
2018-06-11  2:47   ` Simon Marchi
2018-06-11 16:37     ` Alan Hayward
2018-06-06 15:17 ` [PATCH v2 09/10] Ptrace support for AArch64 SVE gdbsever Alan Hayward
2018-06-11  2:43   ` Simon Marchi
2018-06-11  2:44   ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 07/10] Increase gdbsever PBUFSIZ Alan Hayward
2018-06-11  0:46   ` Simon Marchi
2018-06-06 15:17 ` [PATCH v2 05/10] Ptrace support for Aarch64 SVE Alan Hayward
2018-06-10 22:52   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2CE4B909-5C48-4ECC-8BDF-E13EBAF3C7EF@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox