qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv
Date: Sat, 10 Dec 2011 12:14:57 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0

Am 10.12.2011 11:07, schrieb Peter Maydell:
> On 10 December 2011 09:02, Andreas Färber <address@hidden> 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



reply via email to

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