public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	Andrew MacLeod <amacleod@redhat.com>
Subject: Re: PING Re: [PATCH 07/10] value-relation.h: add 'final' and 'override' to relation_oracle vfunc impls
Date: Mon, 13 Jun 2022 21:24:34 -0400	[thread overview]
Message-ID: <8d3e4e47a6bf2905b1a806234423c2eabd2d546b.camel@redhat.com> (raw)
In-Reply-To: <CAGm3qMXo9=VCNjHKFYUk90SgCDDAxvM0R5LizCyFLv0wsArsog@mail.gmail.com>

On Mon, 2022-06-13 at 20:45 -0400, Aldy Hernandez wrote:
> Final implies we can't further derive from the derived class, right?

"final" on a vfunc implies that nothing overrides that vfunc, but you
could still have further derived classes.

You can think of it as "nothing further overrides this vfunc", as both
a hint to the human reader, and an optimization hint to the compiler.  

You can always just remove the "final" if you want to override it in
the future (unless the override is happening in a plugin, I suppose).

> If so
> we may want just override.

"override" is indeed probably more useful, in that it documents to
compilers and human readers that you intend this to override a vfunc.

FWIW I wrote the patch by using both "final" and "override", and then
dropping the "final" everywhere I needed to to get it to compile.

Dave


> 
> Andrew, what are your thoughts?
> 
> Thanks for doing this.
> 
> Aldy
> 
> On Mon, Jun 13, 2022, 14:28 David Malcolm <dmalcolm@redhat.com> wrote:
> 
> > Ping re this patch:
> >   https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595438.html
> > 
> > OK for trunk?
> > 
> > Thanks
> > Dave
> > 
> > 
> > On Mon, 2022-05-23 at 15:28 -0400, David Malcolm wrote:
> > > gcc/ChangeLog:
> > >         * value-relation.h: Add "final" and "override" to
> > > relation_oracle
> > >         vfunc implementations as appropriate.
> > > 
> > > Signed-off-by: David Malcolm <dmalcolm@redhat.com>
> > > ---
> > >  gcc/value-relation.h | 38 +++++++++++++++++++++-----------------
> > >  1 file changed, 21 insertions(+), 17 deletions(-)
> > > 
> > > diff --git a/gcc/value-relation.h b/gcc/value-relation.h
> > > index 19762d8ce2b..478729be0bf 100644
> > > --- a/gcc/value-relation.h
> > > +++ b/gcc/value-relation.h
> > > @@ -130,14 +130,15 @@ public:
> > >    equiv_oracle ();
> > >    ~equiv_oracle ();
> > > 
> > > -  const_bitmap equiv_set (tree ssa, basic_block bb);
> > > +  const_bitmap equiv_set (tree ssa, basic_block bb) final
> > > override;
> > >    void register_relation (basic_block bb, relation_kind k, tree
> > > ssa1,
> > > -                         tree ssa2);
> > > +                         tree ssa2) override;
> > > 
> > > -  relation_kind query_relation (basic_block, tree, tree);
> > > -  relation_kind query_relation (basic_block, const_bitmap,
> > > const_bitmap);
> > > -  void dump (FILE *f, basic_block bb) const;
> > > -  void dump (FILE *f) const;
> > > +  relation_kind query_relation (basic_block, tree, tree) override;
> > > +  relation_kind query_relation (basic_block, const_bitmap,
> > > const_bitmap)
> > > +    override;
> > > +  void dump (FILE *f, basic_block bb) const override;
> > > +  void dump (FILE *f) const override;
> > > 
> > >  protected:
> > >    bitmap_obstack m_bitmaps;
> > > @@ -185,14 +186,16 @@ public:
> > >    dom_oracle ();
> > >    ~dom_oracle ();
> > > 
> > > -  void register_relation (basic_block bb, relation_kind k, tree
> > > op1,
> > > tree op2);
> > > +  void register_relation (basic_block bb, relation_kind k, tree
> > > op1,
> > > tree op2)
> > > +    final override;
> > > 
> > > -  relation_kind query_relation (basic_block bb, tree ssa1, tree
> > > ssa2);
> > > +  relation_kind query_relation (basic_block bb, tree ssa1, tree
> > > ssa2)
> > > +    final override;
> > >    relation_kind query_relation (basic_block bb, const_bitmap b1,
> > > -                                  const_bitmap b2);
> > > +                               const_bitmap b2) final override;
> > > 
> > > -  void dump (FILE *f, basic_block bb) const;
> > > -  void dump (FILE *f) const;
> > > +  void dump (FILE *f, basic_block bb) const final override;
> > > +  void dump (FILE *f) const final override;
> > >  private:
> > >    bitmap m_tmp, m_tmp2;
> > >    bitmap m_relation_set;  // Index by ssa-name. True if a relation
> > > exists
> > > @@ -229,15 +232,16 @@ class path_oracle : public relation_oracle
> > >  public:
> > >    path_oracle (relation_oracle *oracle = NULL);
> > >    ~path_oracle ();
> > > -  const_bitmap equiv_set (tree, basic_block);
> > > -  void register_relation (basic_block, relation_kind, tree, tree);
> > > +  const_bitmap equiv_set (tree, basic_block) final override;
> > > +  void register_relation (basic_block, relation_kind, tree, tree)
> > > final override;
> > >    void killing_def (tree);
> > > -  relation_kind query_relation (basic_block, tree, tree);
> > > -  relation_kind query_relation (basic_block, const_bitmap,
> > > const_bitmap);
> > > +  relation_kind query_relation (basic_block, tree, tree) final
> > > override;
> > > +  relation_kind query_relation (basic_block, const_bitmap,
> > > const_bitmap)
> > > +    final override;
> > >    void reset_path ();
> > >    void set_root_oracle (relation_oracle *oracle) { m_root =
> > > oracle; }
> > > -  void dump (FILE *, basic_block) const;
> > > -  void dump (FILE *) const;
> > > +  void dump (FILE *, basic_block) const final override;
> > > +  void dump (FILE *) const final override;
> > >  private:
> > >    void register_equiv (basic_block bb, tree ssa1, tree ssa2);
> > >    equiv_chain m_equiv;
> > 
> > 
> > 



  reply	other threads:[~2022-06-14  1:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 19:28 [PATCH 00/10] Add 'final' and 'override' where missing David Malcolm
2022-05-23 19:28 ` [PATCH 01/10] Add 'final' and 'override' to opt_pass vfunc impls David Malcolm
2022-06-13 18:22   ` PING: " David Malcolm
2022-06-24 18:08     ` PING^2: " David Malcolm
2022-06-24 18:45       ` Jeff Law
2022-06-27 21:16         ` David Malcolm
2022-05-23 19:28 ` [PATCH 02/10] Add 'final' and 'override' on dom_walker " David Malcolm
2022-06-13 18:23   ` PING " David Malcolm
2022-06-24 18:10     ` PING^2 " David Malcolm
2022-05-23 19:28 ` [PATCH 03/10] expr.cc: use final/override on op_by_pieces_d vfuncs David Malcolm
2022-06-13 18:25   ` PING: " David Malcolm
2022-06-24 18:12     ` PING^2 : " David Malcolm
2022-05-23 19:28 ` [PATCH 04/10] tree-switch-conversion.h: use final/override for cluster vfunc impls David Malcolm
2022-06-13 18:26   ` PING " David Malcolm
2022-06-24 18:14     ` PING^2 : " David Malcolm
2022-05-23 19:28 ` [PATCH 05/10] d: add 'final' and 'override' to gcc/d/*.cc 'visit' impls David Malcolm
2022-05-24 12:56   ` Iain Buclaw
2022-05-24 13:15     ` David Malcolm
2022-05-24 15:11       ` Iain Buclaw
2022-05-23 19:28 ` [PATCH 06/10] ipa: add 'final' and 'override' to call_summary_base vfunc impls David Malcolm
2022-05-24  7:36   ` Martin Liška
2022-05-23 19:28 ` [PATCH 07/10] value-relation.h: add 'final' and 'override' to relation_oracle " David Malcolm
2022-06-13 18:28   ` PING " David Malcolm
2022-06-14  0:45     ` Aldy Hernandez
2022-06-14  1:24       ` David Malcolm [this message]
2022-06-15 13:33         ` Andrew MacLeod
2022-06-15 21:58           ` David Malcolm
2022-05-23 19:28 ` [PATCH 08/10] i386: add 'final' and 'override' to scalar_chain " David Malcolm
2022-06-13 18:30   ` PING: " David Malcolm
2022-06-24 18:19     ` PING^2 : " David Malcolm
2022-06-24 20:58       ` Uros Bizjak
2022-06-27 21:25         ` David Malcolm
2022-08-16  8:55       ` [PATCH][pushed] i386: add 'final' and 'override' to scalar_chain Martin Liška
2022-05-23 19:28 ` [PATCH 09/10] tree-vect-slp-patterns.cc: add 'final' and 'override' to vect_pattern::build impls David Malcolm
2022-05-24  6:44   ` Richard Biener
2022-05-23 19:28 ` [PATCH 10/10] Add 'final' and 'override' in various places David Malcolm
2022-06-13 18:30   ` PING " David Malcolm
2022-06-24 18:20     ` PING^2: " David Malcolm
2022-05-25  3:29 ` [PATCH 00/10] Add 'final' and 'override' where missing Eric Gallager

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=8d3e4e47a6bf2905b1a806234423c2eabd2d546b.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@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).