public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: "Jose E. Marchesi" <jemarch@gnu.org>
To: Mike Frysinger via Cgen <cgen@sourceware.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Subject: Re: [PATCH] sim: tighten up generated decode tables
Date: Fri, 22 Dec 2023 11:55:56 +0100	[thread overview]
Message-ID: <87sf3upkub.fsf@gnu.org> (raw)
In-Reply-To: <20231222010028.17297-1-vapier@gentoo.org> (Mike Frysinger via Cgen's message of "Thu, 21 Dec 2023 20:00:28 -0500")


> The use of /* fall through */ with consective case statements doesn't
> really add any value, and when generating large files, can take up a
> lot of space.  In the case of cris, it alone adds ~20k, or ~10%.

I am a little concern this change may trigger implicit-fallthrough
warnings when compiling the generated code.  Not sure this is a problem
in practice though, since nor binutils nor sim uses
-Wimplicit-fallthrough for building as far as I can see.

> Also trim the space before the : with case statements.
> ---
>  utils-sim.scm | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/utils-sim.scm b/utils-sim.scm
> index dca0f0705036..8011bb775933 100644
> --- a/utils-sim.scm
> +++ b/utils-sim.scm
> @@ -684,14 +684,14 @@
>  		(obj:name (dtable-entry-value (car rest)))))
>        (string-append indent "  case "
>  		     (number->string (dtable-entry-index entry))
> -		     " : /* fall through */\n"))
> +		     ":\n"))
>  
>       (else
>        (let ((consistent-base-insn? (and (equal? APPLICATION 'SID-SIMULATOR)
>  					(> (state-base-insn-bitsize)
>  					   (insn-length insn)))))
>  	(string-append indent "  case "
> -		       (number->string (dtable-entry-index entry)) " :"
> +		       (number->string (dtable-entry-index entry)) ":"
>  		       ;; Compensate for base-insn-size > current-insn-size by
>  		       ;; adjusting entire_insn.
>  		       ;; Activate this logic only for sid simulators; they are
> @@ -825,7 +825,7 @@
>      (string-list
>       indent "  case "
>       (number->string (dtable-entry-index entry))
> -     " :\n"
> +     ":\n"
>  
>       (let ((iflds-tracking (/decode-expr-ifield-tracking expr-list))
>  	   (indent (string-append indent "    ")))
> @@ -914,7 +914,7 @@
>    (string-list
>     indent "  case "
>     (number->string (dtable-entry-index table))
> -   " :"
> +   ":"
>     ; If table is same as next, just emit a "fall through" to cut down on
>     ; generated code.
>     (if (and (not (null? rest))
> @@ -923,7 +923,7 @@
>  	    ; Ensure same table.
>  	    (eqv? (subdtable-key (dtable-entry-value table))
>  		  (subdtable-key (dtable-entry-value (car rest)))))
> -       " /* fall through */\n"
> +       "\n"
>         (string-list
>  	"\n"
>  	(/gen-decoder-switch switch-num
> @@ -1075,7 +1075,7 @@
>  		  result))))
>  
>       ;; ??? Can delete if all cases are present.
> -     indent "  default : "
> +     indent "  default: "
>       (/gen-decode-default-entry invalid-insn fn?) "\n"
>       indent "  }\n"
>       indent "}\n"

  reply	other threads:[~2023-12-22 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  1:00 Mike Frysinger
2023-12-22 10:55 ` Jose E. Marchesi [this message]
2023-12-22 19:58   ` Mike Frysinger
2023-12-23 10:30     ` Jose E. Marchesi
2023-12-22 16:12 ` Frank Ch. Eigler
2023-12-22 19:55   ` Mike Frysinger
2023-12-22 20:05     ` Frank Ch. Eigler

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=87sf3upkub.fsf@gnu.org \
    --to=jemarch@gnu.org \
    --cc=cgen@sourceware.org \
    --cc=vapier@gentoo.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).