From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZKuP-0002ng-4e for qemu-devel@nongnu.org; Sat, 10 Dec 2011 06:16:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RZKuN-0000GR-9e for qemu-devel@nongnu.org; Sat, 10 Dec 2011 06:16:00 -0500 Received: from mout.web.de ([212.227.15.3]:49930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RZKuM-0000GL-TV for qemu-devel@nongnu.org; Sat, 10 Dec 2011 06:15:59 -0500 Message-ID: <4EE33F31.4090108@web.de> Date: Sat, 10 Dec 2011 12:14:57 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1323507747-16261-1-git-send-email-andreas.faerber@web.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org Am 10.12.2011 11:07, schrieb Peter Maydell: > On 10 December 2011 09:02, Andreas Färber wrote: >> Working on 16- and 20-bit targets using TARGET_LONG_BITS == 32, I found it too >> easy to accidentally use, e.g., tcg_temp_free() in place of tcg_temp_free_i32(). >> In case of 78k0/rl78 it may not practically matter yet, but it complicates >> going from a 32-bit target to 64 bits, as in the case of arm. >> >> This series refactors TCG code to allow using a dedicated struct for TCGv, >> to make variable type mismatches show up as compilation errors. > > What mismatches does this catch that the existing debug code doesn't? Cf. patch 4/4: TCGv tmp = tcg_temp_new_i32(); tcg_temp_free_i32(tmp); TCGv_i32 tmp2 = tcg_temp_new(); tcg_temp_free(tmp2); ...just to name four. Try compiling --target-list=arm-softmmu --enable-debug-tcg with my series and DEBUG_TCGV_TL uncommented, and you'll see for yourself. There's too many to mention and for me to actually fix. You'll have to deal with it for ARMv8 at some point and this series hopefully helps. > I've always assumed that "TCGv is shorthand for either TCGv_32 or TCGv_64 > depending on your target's word length" was a feature, not a bug. > If we don't like that we should just drop TCGv completely, no? No. TCGv is needed for what you describe. However, there's been nothing preventing you from using it when exactly that is *not* what you want. The only downside of my approach is that it cannot guess when you knowingly took a valid shortcut, so all shortcuts are discouraged. Andreas