[PATCH] sim: tighten up generated decode tables

Mike Frysinger vapier@gentoo.org
Fri Dec 22 19:55:54 GMT 2023


On 22 Dec 2023 11:12, Frank Ch. Eigler 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%.
> 
> A few kilobytes is basically zero cost, isn't it?

you're not necessarily wrong, although i find it easier to read without so
much noise.  i get that it's generated output, but when trying to debug and
understand the steps, having them be a bit readable is helpful.

i'll note that it's ~20k per file.  the sim tree has ~10 of these.  having
these seems like it adds up when using git as everyone has to carry the cost.

it's possible to compress the code even further if i was able to figure out
how the lisp works.  we generate hundreds of case lines that could be shrunk
into 1.  things like:
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
          case 6:
          case 7:
          case 8:
          case 9:
          case 10:
          case 11:
          case 12:
          case 13:
          case 14: itype = CRISV10F_INSN_ADDOQ; goto extract_sfmt_addoq;
could be:
          case 0 ... 14: itype = CRISV10F_INSN_ADDOQ; goto extract_sfmt_addoq;

some switches have 0 ... 127.
-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/54fc01a8/attachment.sig>


More information about the Cgen mailing list