qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/8] tcg: Add bytecode generator for tcg interpr


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 6/8] tcg: Add bytecode generator for tcg interpreter
Date: Sat, 01 Oct 2011 18:54:54 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.22) Gecko/20110907 SUSE/3.1.14 Thunderbird/3.1.14

Am 17.09.2011 22:00, schrieb Stefan Weil:
> Unlike other tcg target code generators, this one does not generate
> machine code for some cpu. It generates machine independent bytecode
> which is interpreted later.
>
> This allows running QEMU on any host.
>
> Interpreted bytecode is slower than direct execution of generated
> machine code.
>
> Signed-off-by: Stefan Weil <address@hidden>
[...]
> diff --git a/tcg/bytecode/README b/tcg/bytecode/README
> new file mode 100644
> index 0000000..6fe9755
> --- /dev/null
> +++ b/tcg/bytecode/README
> @@ -0,0 +1,129 @@
> +TCG Interpreter (TCI) - Copyright (c) 2011 Stefan Weil.
> +
> +This file is released under GPL 2 or later.
> +
> +1) Introduction
> +
> +TCG (Tiny Code Generator) is a code generator which translates
> +code fragments ("basic blocks") from target code (any of the
> +targets supported by QEMU) to a code representation which
> +can be run on a host.
> +
> +QEMU can create native code for some hosts (arm, hppa, i386, ia64, ppc, 
> ppc64,
> +s390, sparc, x86_64). For others, unofficial host support was written.
> +
> +By adding a code generator for a virtual machine and using an
> +interpreter for the generated bytecode, it is possible to
> +support (almost) any host.
> +
> +This is what TCI (Tiny Code Interpreter) does.
> +
> +2) Implementation
> +
> +Like each TCG host frontend, TCI implements the code generator in
> +tcg-target.c, tcg-target.h. Both files are in directory tcg/bytecode.
> +
> +The additional file tcg/tci.c adds the interpreter.
> +
> +The bytecode consists of opcodes (same numeric values as those used by
> +TCG), command length and arguments of variable size and number.

While reusing TCG opcode values certainly makes things easy to
implement, have you evaluated using LLVM bitcode as alternative to a
fully custom intermediate code format?

Andreas



reply via email to

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