[Top][All Lists]

[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: Thu, 25 Aug 2022 18:41:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 25.08.2022 13:06, Ekaitz Zarraga wrote:

Sorry for insisting but I kept working on this and found no solution.

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?

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 tried using vtop->r but it just generates invalid values.

Also RISC-V does not use flags so the process is different than in the other 
architectures so I don't have a good reference to look at in any others.

Does anyone have an idea about how can I tackle this?

I managed to make the code generate the correct branch instructions but I can't 
figure out how to obtain the correct registers.

Thanks a lot,

------- Original Message -------
On Thursday, August 11th, 2022 at 1:36 PM, Ekaitz Zarraga <ekaitz@elenq.tech> 


I think I have it mostly working following your advice but I cannot find how to 
map v->cmp_r to the field that was storing that information before the commit.

In the gjmp_cond in riscv:

``` c
ST_FUNC int gjmp_cond(int op, int t)
int tmp;
int a = vtop->cmp_r & 0xff;

int b = (vtop->cmp_r >> 8) & 0xff;

switch (op) {

What do I need to replace `a` and `b` with to use the previous register access 
but I can't find how to do that.

Could you please help me?

Thank you,

------- Original Message -------
On Wednesday, August 10th, 2022 at 1:53 PM, Ekaitz Zarraga ekaitz@elenq.tech 


On Wednesday, August 10th, 2022 at 1:43 PM, grischka grishka@gmx.de wrote:

On 09.08.2022 20:39, Ekaitz Zarraga wrote:

Hi all,

I'm working on the RISC-V bootstrapping efforts for Guix, and I have to 
backport the RISC-V backend to an older TinyCC version we have patched in order 
to be able to build it with a simpler compiler.

I wonder why not just apply these patches to the newer tcc then?

Mostly because the compiler we use to compile TinyCC does not provide all the C 
constructs modern TinyCC is using nowadays, so we can't use it now.
We may be able to do it in the future, but our current compiler chain does not 
allow us to do that.

The process worked mostly ok, but I can't understand very well the `gtst` 
function in the generation part, and I need to write it from scratch as the 
commit 8227db3a changed how the tests and jumps are managed.

Actually that commit was to put the former gtst() function in its pieces,
now gjmp_cond(t, op) to handle VT_CMP, and gjmp_append(n, t) for the
former VT_JMP "optimization" part.

Do you mean the commit was done to split the function in two?
I'll take a deeper look and see if I can undo it properly.

Thanks for the help

Tinycc-devel mailing list

reply via email to

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