From: "Andreas Färber" <andreas.faerber@web.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv
Date: Sat, 10 Dec 2011 12:14:57 +0100 [thread overview]
Message-ID: <4EE33F31.4090108@web.de> (raw)
In-Reply-To: <CAFEAcA9h2Ht8qa3QR3Dx4cEPqw=sszVbJJ=Vpdk0ck2m_OJyyQ@mail.gmail.com>
Am 10.12.2011 11:07, schrieb Peter Maydell:
> On 10 December 2011 09:02, Andreas Färber <andreas.faerber@web.de> 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
next prev parent reply other threads:[~2011-12-10 11:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-10 9:02 [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv Andreas Färber
2011-12-10 9:02 ` [Qemu-devel] [PATCH 1/4] tcg: Introduce {MAKE,GET}_TCGV_TL macros Andreas Färber
2011-12-10 9:02 ` [Qemu-devel] [PATCH 2/4] tcg: Convert *_tl*() macros to inline functions Andreas Färber
2011-12-10 21:06 ` [Qemu-devel] [PATCH v2] " Andreas Färber
2011-12-10 9:02 ` [Qemu-devel] [PATCH 3/4] tcg: Update TCGV_{UNUSED,EQUAL}() macros Andreas Färber
2011-12-10 9:02 ` [Qemu-devel] [PATCH 4/4] tcg: Allow to detect TCGv misuses Andreas Färber
2011-12-10 10:07 ` [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv Peter Maydell
2011-12-10 11:14 ` Andreas Färber [this message]
2011-12-11 23:28 ` Paul Brook
2011-12-12 10:39 ` Andreas Färber
2011-12-12 15:58 ` Paul Brook
2011-12-13 12:43 ` Andreas Färber
2011-12-13 16:26 ` Paul Brook
2011-12-14 11:41 ` Andreas Färber
2011-12-13 13:11 ` Andreas Färber
2011-12-13 16:23 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE33F31.4090108@web.de \
--to=andreas.faerber@web.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).