Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1A9gsA-0006U4-4x for qemu-devel@nongnu.org; Wed, 15 Oct 2003 04:19:10 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1A9gre-0006Nc-D8 for qemu-devel@nongnu.org; Wed, 15 Oct 2003 04:19:09 -0400 Received: from [213.41.78.26] (helo=smtp-ft2.fr.colt.net) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A9grd-0006Mr-QN for qemu-devel@nongnu.org; Wed, 15 Oct 2003 04:18:37 -0400 Received: from alcor.imaginet.fr (alcor.imaginet.fr [195.68.86.12]) by smtp-ft2.fr.colt.net with ESMTP id h9F8IaD02979 for ; Wed, 15 Oct 2003 10:18:36 +0200 Received: from gw.netgem.com ([195.68.2.34]:64937 helo=free.fr) by alcor.imaginet.fr with esmtp (Exim) id 1A9gtj-0003tV-NO for ; Wed, 15 Oct 2003 10:20:47 +0200 Message-ID: <3F8D02DC.90508@free.fr> Date: Wed, 15 Oct 2003 10:18:36 +0200 From: Fabrice Bellard MIME-Version: 1.0 Subject: Re: [Qemu-devel] gcc as a backend to generate better code References: <20031015031622.131453eb.jrydberg@night.trouble.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Johan Rydberg wrote: > 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.