On Wed, Mar 16, 2022 at 1:59 PM Richard Biener
<richard.guent...@gmail.com> wrote:
>
> On Wed, Mar 16, 2022 at 1:31 PM Roger Sayle <ro...@nextmovesoftware.com> 
> wrote:
> >
> >
> > This patch is the second of two changes to genmatch that don't affect
> > the executable code, but reduce the amount of debugging information
> > generated in stage3 of a build, but adhering more closely to GNU style
> > guidelines.
> >
> > This patch avoids generating "next_after_fail1:;" label statements
> > in genmatch, if this label is unused/never referenced as the target
> > of a goto.  Because jumps to these labels are always forwards, we
> > know at the point the label is emitted whether it is used or not.
> > Because a debugger may set a breakpoint these labels, this increase
> > the size of g{imple,eneric}-match.o in a stage3 build.  To save a
> > little extra space, I also shorten the label to "Lfail1:;" and only
> > increment the counter when necessary.  This reduces the size of
> > gimple-match.o by 58K on x86_64-pc-linux-gnu.
> >
> > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> > and make -k check with no new failures.  Ok for mainline?
>
> I wonder if we could make this nicer by abstracting sth like
>
> class fail_label
> {
>    fail_label (unsigned num);
>    emit_goto () { fprintf (..., "goto L%u", num); used = true; }
>    emit_label () { fprintf ("L%u:;\n", num); }
>   unsigned num;
>   bool used;
> };
>
> or some better abstraction capturing all of the global state.

Btw, the unused labels were one reason for having

gimple-match.o-warn = -Wno-unused
generic-match.o-warn = -Wno-unused

maybe that's then no longer needed.

> >
> >
> > 2022-03-16  Roger Sayle  <ro...@nextmovesoftware.com>
> >
> > gcc/ChangeLog
> >         * gcc/genmatch.cc (fail_label_used): New global variable.
> >         (expr::gen_transform): Set fail_label_used whenever a goto
> >         FAIL_LABEL is generated.
> >         (dt_simplify::gen_1): Clear fail_label_used when generating
> >         a new (provisional) fail_label.  Set fail_label used whenever
> >         a goto fail_label is generated.  Avoid emitting fail_label:
> >         if fail_label_used is false, instead decrement fail_label_cnt.
> >
> >
> > Thanks in advance,
> > Roger
> > --
> >

Reply via email to