Skip to contentSkip to conversation

gcc as a backend to generate better code

Qemu-devel Johan Rydberg 3 participants 3 messages Oct 15, 2003

lore
Share & tools
lore
#0 lore raw

The TODO file states the following:

- use gcc as a backend to generate better code (easy to do by using op-i386.c operations as local inline functions).

How would this be done, actually?

Signature · 4 lines
Johan Rydberg, Free Software Developer, Sweden
http://rtmk.sf.net | http://www.nongnu.org/guss/

Playing david kitt - saturdays
#1 lore raw
Quoted 6 lines · Johan Rydberg

The TODO file states the following:

- use gcc as a backend to generate better code (easy to do by using op-i386.c operations as local inline functions).

How would this be done, actually?

The executable is launched at least once with the standard QEMU to record translation block statistics, location and code reference (from which file it comes, at which offset).

Then an off-line tool is launched to convert recorded translation blocks to a .so file using gcc by generating C code from each micro operation.

When QEMU is launched again, it can scan a directory containing .so files for all statically compiled programs. Then it can load the corresponding .so file and use the translated blocks stored inside.

With this method, only heavily used translations blocks are compiled with gcc. The rest is translated with QEMU.

Fabrice.

#2 lore raw

Sounds interesting. Perhaps the off-line tool could be run
directly from qemu to facilitate ease of use. Then to the end user it would appear to run faster each time you use it.

Also if the off-line tool could successfully dissaemble enough of
the program without running it, it could be precompiled before the first invocation. It might be too difficult to follow all code paths, though, but you'ld know that :)

- Chad

Quoted 31 lines · Fabrice Bellard
Quoted 6 lines · Johan Rydberg

The TODO file states the following:

- use gcc as a backend to generate better code (easy to do by using op-i386.c operations as local inline functions).

How would this be done, actually?

The executable is launched at least once with the standard QEMU to record translation block statistics, location and code reference (from which file it comes, at which offset).

Then an off-line tool is launched to convert recorded translation blocks to a .so file using gcc by generating C code from each micro operation.

When QEMU is launched again, it can scan a directory containing .so files for all statically compiled programs. Then it can load the corresponding .so file and use the translated blocks stored inside.

With this method, only heavily used translations blocks are compiled with gcc. The rest is translated with QEMU.

Fabrice.

_______________________________________________
Qemu-devel mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/qemu-devel