tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Jump optimization questions - commit: 8227db3a


From: grischka
Subject: Re: [Tinycc-devel] Jump optimization questions - commit: 8227db3a
Date: Fri, 26 Aug 2022 19:50:38 +0200
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 25.08.2022 21:40, Ekaitz Zarraga wrote:


Hi grischka,

vtop->r and vtop->cmp_r are used interchangeably in some parts of the codebase 
and I don't really understand why.

I don't know where you see this?

I'm probably mistaken by the code I read. I'm having a hard time reading it 
honestly.

Maybe what you read was code that you just did write yourself.  It does
not however exist in the tinycc as it is visible to everybody.

Also, what is "all the C constructs modern TinyCC is using nowadays" that
0.9.27 was not using and that prevent you from just porting your patches
to current tcc?

I'm not adding anything but moving the RISC-V support to a really old GCC that 
we can compile with MesCC. MesCC is proven to work in older tcc versions but 
not in the most recent one so all our infrastructure is set up to work on that 
old TinyCC.

If you want to know more, you can take a look to:
https://gitlab.com/janneke/tinycc

Ok, so that is based on git as from Mai 2017 which was about 7 months
before release 0.9.27, with on top I'd say a rather moderate set of
changes such as to work around problems in the compiling compiler with
more than one postfix-expr in a row ("func()->x").

I have not other chance at the moment but make this backport, as well as I 
already did with GCC.

Maybe this makes some more sense to you now you know.

Actually no, it doesn't.

Could you please help me understand how this internals work?

Internals about cmp_r I assume.  Let's see ...

  $ grep -nrw cmp_r .

gives this (with hits in other target generators omitted):

  ./riscv64-gen.c:325:        int a = vtop->cmp_r & 0xff;
  ./riscv64-gen.c:326:        int b = (vtop->cmp_r >> 8) & 0xff;
  ./riscv64-gen.c:979:    int a = vtop->cmp_r & 0xff;
  ./riscv64-gen.c:980:    int b = (vtop->cmp_r >> 8) & 0xff;
  ./riscv64-gen.c:1041:                      vtop->cmp_r = ireg(d) | 0 << 8;
  ./riscv64-gen.c:1076:                    vtop->cmp_r = a | 0 << 8;
  ./riscv64-gen.c:1093:            vtop->cmp_r = a | b << 8;
  ./tcc.h:525:      struct { unsigned short cmp_op, cmp_r; }; /* VT_CMP 
operation */

Which is four lines to get its value and three lines to set it, in the
generator, and one line in tcc.h to declare it.

Now you want to connect this generator with an older tcc version without
riscv64 and no cmp_r declared in tcc.h.  And ... what was the question?
Whether it would make sense?  No.

Thank you very much,
Ekaitz

No matter,

-- gr



reply via email to

[Prev in Thread] Current Thread [Next in Thread]