From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpTkx-00057p-JK for qemu-devel@nongnu.org; Sun, 30 Dec 2012 20:01:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TpTkv-00008h-0E for qemu-devel@nongnu.org; Sun, 30 Dec 2012 20:01:31 -0500 Received: from mail-la0-f54.google.com ([209.85.215.54]:34042) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TpTku-00008O-P0 for qemu-devel@nongnu.org; Sun, 30 Dec 2012 20:01:28 -0500 Received: by mail-la0-f54.google.com with SMTP id fp12so3304366lab.13 for ; Sun, 30 Dec 2012 17:01:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Mon, 31 Dec 2012 01:01:06 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] gen_icount_start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: biswaranjan panda Cc: qemu-devel@nongnu.org On 30 December 2012 23:14, biswaranjan panda wrote: > What I understand is that in gen_icount_start 'icount_arg' keeps a pointer > to gen_opparam_ptr which is used in gen_icount_end to patch up the value . I > however didnt understand what the 'horrid hack' is about. Can any one give > me some idea on this ? My guess is that it's a hack because it's a layering violation. Functions that generate TCG (intermediate representation) should do it by calling the tcg_ functions, and the data structures and variables like gen_opparam_ptr should be internal to the TCG layer. However here we rely on knowing implementation details of how the TCG layer actually writes out the ops and parameters when you call tcg_gen_subi_i32(). A clean design would make the TCG layer provide some kind of API for writing out code and then fixing up the values afterwards, but on the other hand if we only have one use case... -- PMM