[PATCH] sim: tighten up generated decode tables

Mike Frysinger vapier@gentoo.org
Fri Dec 22 19:58:08 GMT 2023


On 22 Dec 2023 11:55, Jose E. Marchesi wrote:
> > 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.

pretty sure compilers don't warn about consecutive case statements that
don't have any non-case code inbetween.  so we're talking about:
          case 11:
          case 12:
          case 13:
          case 14: itype = CRISV10F_INSN_ADDOQ; goto extract_sfmt_addoq;

since this is a very common scenario, compilers accept it without warning.
if you did something like:
          case 13:
            printf("");
          case 14: itype = CRISV10F_INSN_ADDOQ; goto extract_sfmt_addoq;
then it'd warn.

i'm actually enabling -Wimplicit-fallthrough in sim now and none of these
trigger warnings.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/cgen/attachments/20231222/e6d38c28/attachment.sig>


More information about the Cgen mailing list