tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] TCC code generation for a stack based VM


From: Zoltán Lörincz
Subject: [Tinycc-devel] TCC code generation for a stack based VM
Date: Tue, 2 Nov 2004 10:27:23 +0200

Hello Tiny CC users,

i would like to use the TCC compiler to generate byte code, then i
would like to write a simple interpreter for this byte code.

The generated byte code and the interpreter has to be as fast as
possible (in fact very fast, because they will run in embedded systems
with relatively slow processors).

I studied the TCC source code including the existing code generators
(i386, c67, arm) and i saw that the existing code generators are
written for register based machines.

Can somebody tell me if it is easy possible to write a code generator
for a stack based machine?

I am thinking that it would be also neccessary to modify the  gv() and
gv2() functions especially i would have to skip the things wich are
related to the register allocation problem, first i thought that i
should skip the get_reg() functions.
Would this be enough?

I also thought that i could generate byte code for a register based
virtual machine, but i consider that this would have a significant
impact on the performance of the interpreter.

I also noticed that because of the one pass approach the generated
code in some places is not optimized.
For example if we take a for cycle: 
    for(i=0;i<10;i++){}
in this case the end part (i++) is generated at the beginning of the
block {} (in the order as it is parsed) and then there are generated
jmp instructions to execute the code at the end.

I know that the compilation speed is realy fast, but i am also
interested in the generated code performance.
Does somebody know how much the tcc generated code performance differs
from the gcc generated code (for example) ?

Please help me with these questions, i would realy appreciate it.
Thank you.

Best regards,
Zoltan Lorincz.




reply via email to

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