From: Richard Biener <richard.guenther@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Avoid generating unused labels in genmatch.
Date: Wed, 16 Mar 2022 13:59:15 +0100 [thread overview]
Message-ID: <CAFiYyc1tRbecMp-jS1JGssfr6mUXiC9mFQna2e_RgZ5D5gLX5Q@mail.gmail.com> (raw)
In-Reply-To: <001a01d83931$8d6c5ee0$a8451ca0$@nextmovesoftware.com>
On Wed, Mar 16, 2022 at 1:31 PM Roger Sayle <roger@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.
>
>
> 2022-03-16 Roger Sayle <roger@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
> --
>
next prev parent reply other threads:[~2022-03-16 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 12:29 Roger Sayle
2022-03-16 12:59 ` Richard Biener [this message]
2022-03-16 13:00 ` Richard Biener
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=CAFiYyc1tRbecMp-jS1JGssfr6mUXiC9mFQna2e_RgZ5D5gLX5Q@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.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).