public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Hafiz Abid Qadeer <abidh@codesourcery.com>,
	Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, ams@codesourcery.com
Subject: Re: [PATCH] dwarf: Multi-register CFI address support.
Date: Tue, 9 Nov 2021 16:59:14 +0100	[thread overview]
Message-ID: <20211109155914.GW2710@tucnak> (raw)
In-Reply-To: <20210613132738.615611-1-abidh@codesourcery.com>

On Sun, Jun 13, 2021 at 02:27:38PM +0100, Hafiz Abid Qadeer wrote:
> *** with this patch (edited for brevity)***
> 
> 00000000 00000024 ffffffff CIE
> 
>   DW_CFA_def_cfa_expression: DW_OP_bregx SGPR49+0, DW_OP_const1u 0x20, DW_OP_shl, DW_OP_bregx SGPR48+0, DW_OP_plus
>   DW_CFA_expression: reg16 DW_OP_bregx SGPR51+0, DW_OP_const1u 0x20, DW_OP_shl, DW_OP_bregx SGPR50+0, DW_OP_plus
> 
> 00000028 0000003c 00000000 FDE cie=00000000 pc=00000000...000001ac
>   DW_CFA_advance_loc4: 96
>   DW_CFA_offset: reg46 0
>   DW_CFA_offset: reg47 4
>   DW_CFA_offset: reg50 8
>   DW_CFA_offset: reg51 12
>   DW_CFA_offset: reg16 8
>   DW_CFA_advance_loc4: 4
>   DW_CFA_def_cfa_expression: DW_OP_bregx SGPR47+0, DW_OP_const1u 0x20, DW_OP_shl, DW_OP_bregx SGPR46+0, DW_OP_plus, DW_OP_lit16, DW_OP_minus

I guess as a temporary solution until DWARF6 comes with something more
compact for cases like that it can be fine, but is there a DWARF issue
filed for it?  Is AMDGCN a DWARF2_ADDR_SIZE == 8 target?

> +/* This represents a register, in DWARF_FRAME_REGNUM space, for use in CFA
> +   definitions and expressions.
> +   Most architectures only need a single register number, but some (amdgcn)
> +   have pointers that span multiple registers.  DWARF permits arbitrary
> +   register sets but existing use-cases only require contiguous register
> +   sets, as represented here.  */
> +struct GTY(()) cfa_reg {
> +  unsigned int reg;
> +  unsigned int span;
> +  poly_uint16_pod span_width;  /* A.K.A. register mode size.  */

If this is only used for span > 1, wouldn't it be better to
make it
  unsigned int reg;
  unsigned short span;
  unsigned short span_width;
and keep span_width 0 for the span == 1 cases and only set span_width
to ....to_constant () if span > 1 is needed?  If at least for now
the only target that needs this is AMDGCN and the only target that has
NUM_POLY_INT_COEFFS != 1 is aarch64 (maybe eventually riscv?), then I don't
see why we should represent it in poly_uint16...
Of course we can change it later if a target which needs both
NUM_POLY_INT_COEFFS > 1 and span > 1 registers with non-constant span_width,
we can change it, but doing it just in case seems unnecessary
complication...

	Jakub


  parent reply	other threads:[~2021-11-09 15:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13 13:27 Hafiz Abid Qadeer
2021-07-22 10:58 ` Hafiz Abid Qadeer
2021-08-24 15:55   ` Hafiz Abid Qadeer
2021-11-02 15:02     ` Hafiz Abid Qadeer
2021-11-09 15:59 ` Jakub Jelinek [this message]
2021-11-11 18:12   ` Hafiz Abid Qadeer
2021-12-01 15:49     ` Jakub Jelinek
  -- strict thread matches above, loose matches on Subject: below --
2020-08-28 12:04 Andrew Stubbs
2020-09-02 17:49 ` Tom Tromey
2020-09-02 19:35   ` Andrew Stubbs
2020-09-02 19:55     ` Tom Tromey
2020-09-03 15:29 ` Andrew Stubbs
2020-09-21 13:51   ` Andrew Stubbs
2020-10-05 10:07     ` Andrew Stubbs
2020-10-19  9:36 ` Jakub Jelinek

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=20211109155914.GW2710@tucnak \
    --to=jakub@redhat.com \
    --cc=abidh@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).