public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Guillaume Gomez <guillaume1.gomez@gmail.com>
To: Antoni Boucher <bouanto@zoho.com>
Cc: Arthur Cohen <arthur.cohen@embecosm.com>,
	gcc-patches@gcc.gnu.org, jit@gcc.gnu.org,
	 David Malcolm <dmalcolm@redhat.com>
Subject: Re: [PATCH] Add rvalue::get_name method (and its C equivalent)
Date: Mon, 22 Apr 2024 19:56:21 +0200	[thread overview]
Message-ID: <CAAOQCfQRqPQF7O=op-E3TwUSjqMNuuJJdxpav1GmUQgORDyb0A@mail.gmail.com> (raw)
In-Reply-To: <1c705ee1-ada7-4a93-9e8a-c17b68e66331@zoho.com>

`param` is also inheriting from `lvalue`. I don't think adding this
check is a good idea
because it will not evolve nicely if more changes are done in libgccjit.

Le lun. 22 avr. 2024 à 17:19, Antoni Boucher <bouanto@zoho.com> a écrit :
>
> For your new API endpoint, please add a check like:
>
>    RETURN_IF_FAIL (lvalue->is_global () || lvalue->is_local (),
>                   NULL,
>                   NULL,
>                   "lvalue should be a variable");
>
>
> Le 2024-04-22 à 09 h 16, Guillaume Gomez a écrit :
> > Good point!
> >
> > New patch attached.
> >
> > Le lun. 22 avr. 2024 à 15:13, Antoni Boucher <bouanto@zoho.com> a écrit :
> >>
> >> Please move the function to be on lvalue since there are no rvalue types
> >> that are not lvalues that have a name.
> >>
> >> Le 2024-04-22 à 09 h 04, Guillaume Gomez a écrit :
> >>> Hey Arthur :)
> >>>
> >>>> Is there any reason for that getter to return a mutable pointer to the
> >>>> name? Would something like this work instead if you're just looking at
> >>>> getting the name?
> >>>>
> >>>> +  virtual string * get_name () const { return NULL; }
> >>>>
> >>>> With of course adequate modifications to the inheriting classes.
> >>>
> >>> Good catch, thanks!
> >>>
> >>> Updated the patch and attached the new version to this email.
> >>>
> >>> Cordially.
> >>>
> >>> Le lun. 22 avr. 2024 à 11:51, Arthur Cohen <arthur.cohen@embecosm.com> a écrit :
> >>>>
> >>>> Hey Guillaume :)
> >>>>
> >>>> On 4/20/24 01:05, Guillaume Gomez wrote:
> >>>>> Hi,
> >>>>>
> >>>>> I just encountered the need to retrieve the name of an `rvalue` (if
> >>>>> there is one) while working on the Rust GCC backend.
> >>>>>
> >>>>> This patch adds a getter to retrieve the information.
> >>>>>
> >>>>> Cordially.
> >>>>
> >>>>>      virtual bool get_wide_int (wide_int *) const { return false; }
> >>>>>
> >>>>> +  virtual string * get_name () { return NULL; }
> >>>>> +
> >>>>>    private:
> >>>>>      virtual enum precedence get_precedence () const = 0;
> >>>>
> >>>> Is there any reason for that getter to return a mutable pointer to the
> >>>> name? Would something like this work instead if you're just looking at
> >>>> getting the name?
> >>>>
> >>>> +  virtual string * get_name () const { return NULL; }
> >>>>
> >>>> With of course adequate modifications to the inheriting classes.
> >>>>
> >>>> Best,
> >>>>
> >>>> Arthur

      reply	other threads:[~2024-04-22 17:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 23:05 Guillaume Gomez
2024-04-22  9:51 ` Arthur Cohen
2024-04-22 13:04   ` Guillaume Gomez
2024-04-22 13:13     ` Antoni Boucher
2024-04-22 13:16       ` Guillaume Gomez
2024-04-22 13:19         ` Antoni Boucher
2024-04-22 13:24           ` Guillaume Gomez
2024-04-22 15:19         ` Antoni Boucher
2024-04-22 17:56           ` Guillaume Gomez [this message]

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='CAAOQCfQRqPQF7O=op-E3TwUSjqMNuuJJdxpav1GmUQgORDyb0A@mail.gmail.com' \
    --to=guillaume1.gomez@gmail.com \
    --cc=arthur.cohen@embecosm.com \
    --cc=bouanto@zoho.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /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).