public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Andrew MacLeod <amacleod@redhat.com>,
	Jakub Jelinek <jakub@redhat.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 0/6] Conversion of gimple types to C++ inheritance (v3)
Date: Tue, 05 Nov 2013 12:33:00 -0000	[thread overview]
Message-ID: <1383654609.5282.79.camel@surprise> (raw)
In-Reply-To: <CAFiYyc1Ma+ooDMkQ53jQatE8Cu3t0fF-DL9T9msgt4N0jUxCvA@mail.gmail.com>

On Tue, 2013-11-05 at 12:47 +0100, Richard Biener wrote:
> On Mon, Nov 4, 2013 at 10:43 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> > On Mon, 2013-11-04 at 08:19 -0500, Andrew MacLeod wrote:
> >> On 11/01/2013 06:58 PM, David Malcolm wrote:
> >> > On Fri, 2013-11-01 at 22:57 +0100, Jakub Jelinek wrote:
> >> >> On Fri, Nov 01, 2013 at 05:47:14PM -0400, Andrew MacLeod wrote:
> >> >>> On 11/01/2013 05:41 PM, Jakub Jelinek wrote:
> >> >>>> On Fri, Nov 01, 2013 at 05:36:34PM -0400, Andrew MacLeod wrote:
> >> >>>>>    static inline void
> >> >>>>> ! gimple_call_set_lhs (gimple gs, tree lhs)
> >> >>>>>    {
> >> >>>>> -   GIMPLE_CHECK (gs, GIMPLE_CALL);
> >> >> The checking you are removing here.
> >> >>
> >> >>> What checking?  There ought to be no checking at all in this
> >> >>> example...  gimple_build_call_vec returns a gimple_call, and
> >> >>> gimple_call_set_lhs()  doesn't have to check anything because it
> >> >>> only accepts gimple_call's.. so there is no checking other than the
> >> >>> usual "does my parameter match" that the compiler has to do...
> >> >> and want to replace it by checking of the types at compile time.
> >> >> The problem is that it uglifies the source too much, and, when you
> >> >> actually don't have a gimple_call but supposedly a base class of it,
> >> >> I expect you'd do as_a which is not only further uglification, but has
> >> >> runtime cost also for --enable-checking=release.
> >> > I can have a look next week at every call to gimple_call_set_lhs in the
> >> > tree, and see to what extent we know at compile-time that the initial
> >> > arg is indeed a call (of the ones I quickly grepped just now, most are
> >> > from gimple_build_call and friends, but one was from a gimple_copy).
> >> >
> >> > FWIW I did some performance testing of the is_a/as_a code in the earlier
> >> > version of the patch, and it didn't have a noticable runtime cost
> >> > compared to the GIMPLE_CHECK in the existing code:
> >> > Size of compiler executable:
> >> > http://gcc.gnu.org/ml/gcc-patches/2013-08/msg01920.html
> >> > Compile times:
> >> > http://gcc.gnu.org/ml/gcc-patches/2013-09/msg00171.html
> >> I actually really dislike as_a<> and is_a<>, and  think code needs to be
> >> restructured rather than use them, other than possibly at the very
> >> bottom level when we're allocating memory or something like that, or
> >> some kind of emergency :-)...   If we require frequent uses of those,
> >> I'd be against it, I find them quite ugly.
> >>
> >> Like I said in the other reply, no rush, I don't think any of this
> >> follow up is appropriate this late in stage 1.  It would be more of an
> >> "interest" examination right now.. at least in my opinion...  I suspect
> >> thinks like gimple_assign are more complex cases, but without looking
> >> its hard to tell for sure.
> >
> > I tried converting gimple_call_set_lhs to accept a gimple_call, rather
> > than a gimple, and excitingly, it was easiest to also convert
> > cgraph_edge's call_stmt to also be a gimple_call, rather than just a
> > gimple.
> 
> Does that work (using gimple_call * objects) for our garbage collector?
> That is, does it know it is looking at a 'gimple'?  It doesn't matter for this
> case as all stmts are reachable from struct function as sequence of 'gimple',
> but in general?
Yes (as of r204146, I believe).

For example, the patch converts cgraph_edge's call_stmt to be a
"gimple_call", rather than just a "gimple", but gengtype handles this by
emitting a call to the base class visitor for call_stmt i.e.
gimple_statement_base:

void
gt_ggc_mx_cgraph_edge (void *x_p)
{
  struct cgraph_edge * x = (struct cgraph_edge *)x_p;
  [...snip chain_next/prev handling...]
  [...snip other fields...]
      gt_ggc_m_21gimple_statement_base ((*x).call_stmt);
  [..etc..]
}


  reply	other threads:[~2013-11-05 12:30 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31  5:45 RFC: gimple.[ch] break apart Andrew MacLeod
2013-10-31  6:15 ` Jeff Law
2013-10-31 16:41 ` [PATCH 0/6] Conversion of gimple types to C++ inheritance (v3) David Malcolm
2013-10-31 16:27   ` [PATCH 2/6] Hand-written port of various accessors within gimple.h David Malcolm
2013-11-14  9:53     ` Jeff Law
2013-10-31 16:27   ` [PATCH 4/6] Implement is_a_helper <>::test specializations for various gimple types David Malcolm
2013-11-14  9:41     ` Jeff Law
2013-11-18 19:51       ` David Malcolm
2013-11-18 20:10         ` Andrew MacLeod
2013-11-18 20:15         ` Jeff Law
2013-10-31 16:27   ` [PATCH 1/6] Convert gimple types from a union to C++ inheritance David Malcolm
2013-11-14 23:00     ` Jeff Law
2013-11-19  0:22       ` David Malcolm
2013-11-19  8:49         ` Jeff Law
2013-10-31 16:31   ` [PATCH 3/6] Automated part of conversion of gimple types to use " David Malcolm
2013-11-14  9:43     ` Jeff Law
2013-11-18 22:17       ` [PATCH] Updated automated patch (was Re: [PATCH 3/6] Automated part of conversion of gimple types to use C++ inheritance) David Malcolm
2013-11-19  8:49         ` Jeff Law
2013-11-19 16:36           ` David Malcolm
2013-11-22  0:27         ` Jakub Jelinek
2013-11-22  0:35           ` Jeff Law
2013-11-22  1:51             ` Jakub Jelinek
2013-11-22  2:52               ` Andrew MacLeod
2013-11-22  3:48                 ` David Malcolm
2013-11-25 18:09                 ` [PATCH] Fix checking of gimple types David Malcolm
2013-11-25 18:42                   ` Michael Matz
2013-11-25 22:18                   ` Jeff Law
2013-11-27  8:54                     ` David Malcolm
2014-07-23 13:16                   ` Thomas Schwinge
2014-07-24  1:50                     ` David Malcolm
2014-07-29  8:11                       ` Thomas Schwinge
2013-10-31 16:46   ` [PATCH 6/6] Update gdb hooks to reflect changes to " David Malcolm
2013-11-14  9:10     ` Jeff Law
2013-10-31 16:49   ` [PATCH 5/6] Port various places from union access to subclass access David Malcolm
2013-11-14  9:23     ` Jeff Law
2013-11-19  0:52       ` David Malcolm
2013-10-31 18:43   ` [PATCH 0/6] Conversion of gimple types to C++ inheritance (v3) Basile Starynkevitch
2013-11-01 21:36   ` Andrew MacLeod
2013-11-01 21:41     ` Jakub Jelinek
2013-11-01 21:47       ` Andrew MacLeod
2013-11-01 21:57         ` Jakub Jelinek
2013-11-01 22:58           ` David Malcolm
2013-11-04 13:23             ` Andrew MacLeod
2013-11-04 21:52               ` David Malcolm
2013-11-04 22:09                 ` David Malcolm
2013-11-04 22:31                   ` Andrew MacLeod
2013-11-05 21:27                     ` Jeff Law
2013-11-04 22:43                   ` Andrew MacLeod
2013-11-04 22:28                 ` Jakub Jelinek
2013-11-04 22:49                   ` Andrew MacLeod
2013-11-05 21:09                   ` Jeff Law
2013-11-05 11:53                 ` Richard Biener
2013-11-05 12:33                   ` David Malcolm [this message]
2013-11-05 12:52                     ` Richard Biener
2013-11-04 14:00           ` Andrew MacLeod
2013-11-04 14:01             ` Jakub Jelinek
2013-11-04 14:15               ` Andrew MacLeod
2013-11-04 18:23       ` Jeff Law
2013-11-01 22:43     ` David Malcolm
2013-11-01 23:43       ` Trevor Saunders
2013-11-04 13:15       ` Andrew MacLeod
2013-11-05 17:23     ` [PATCH] Add gimple subclasses for every gimple code (was Re: [PATCH 0/6] Conversion of gimple types to C++ inheritance (v3)) David Malcolm
2013-11-06 16:53       ` Michael Matz
2013-11-07  6:19         ` David Malcolm
2013-11-07  7:08           ` Jeff Law
2013-11-08 19:23             ` David Malcolm
2013-11-14  8:38               ` Jeff Law
2013-11-14 15:06                 ` Michael Matz
2013-11-14 18:32                 ` David Malcolm
2013-11-15  2:49                   ` Jeff Law
2013-11-07 14:57           ` Michael Matz
2013-11-08  0:07         ` Alec Teal
2013-11-08 14:31           ` Michael Matz
2013-11-05 18:22     ` [PATCH 0/6] Conversion of gimple types to C++ inheritance (v3) Andrew MacLeod
2013-11-05 21:33   ` Jeff Law
2013-11-05 22:01     ` David Malcolm
2013-11-05 22:17       ` Jeff Law
2013-11-06  1:14         ` Ian Lance Taylor
2013-11-06 20:49           ` Jeff Law
2013-11-06 20:57             ` Trevor Saunders
2013-11-05 22:24       ` Andrew MacLeod
2013-11-05 22:12     ` Andrew MacLeod
2013-11-06  9:37     ` Richard Biener
2013-11-06 11:20       ` Bernd Schmidt
2013-11-06 11:43         ` Richard Biener
2013-11-06 11:53           ` Jakub Jelinek
2013-11-06 13:14             ` Richard Biener
2013-11-06 13:23               ` Jakub Jelinek
2013-11-06 16:42                 ` David Malcolm
2013-11-06 16:55                   ` Jakub Jelinek
2013-11-06 18:34                     ` Tom Tromey
2013-11-06 19:15                       ` Jeff Law
2013-11-06 20:05                         ` Tom Tromey
2013-11-06 20:45                           ` Jeff Law
2013-11-06 13:31             ` Joseph S. Myers
2013-11-06 21:25               ` Jeff Law
2013-11-06 21:09             ` Jeff Law
2013-11-06 12:42           ` Bernd Schmidt
2013-11-06 21:04           ` Jeff Law
2013-11-06 21:06           ` Andrew MacLeod
2013-11-06 21:52             ` Jeff Law
2013-11-07 10:29             ` Richard Biener
2013-11-07 14:01               ` Joseph S. Myers
2013-11-07 14:42                 ` Richard Biener
2013-11-07 14:53               ` Andrew MacLeod
2013-11-10 12:35             ` Richard Sandiford
2013-11-10 15:27               ` Richard Biener
2013-11-06 11:56         ` Eric Botcazou
2013-11-06 20:51         ` Jeff Law
2013-11-06 21:26       ` Jeff Law
2013-11-14  8:40   ` Jeff Law
2013-11-05 16:58 ` [patch] Create gimple-expr..[ch] ... was Re: RFC: gimple.[ch] break apart Andrew MacLeod
2013-11-05 17:52   ` Jeff Law
2013-11-07 10:58   ` Basile Starynkevitch
2013-11-07 13:47     ` Andrew MacLeod
2013-11-07 18:13       ` Diego Novillo

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=1383654609.5282.79.camel@surprise \
    --to=dmalcolm@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@gmail.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).