Re: [PATCH] sim: tighten up generated decode tables
"Jose E. Marchesi via Cgen" <[email protected]> Sat, 23 Dec 2023 11:30:58 +0100
| Newsgroups | gmane.comp.tools.cgen.devel |
|---|---|
| Message-ID | <[email protected]> |
> 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.
OK then.
Thanks!