qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] tcg: Push merged memop+mmu_idx parameter to


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/3] tcg: Push merged memop+mmu_idx parameter to softmmu routines
Date: Wed, 13 May 2015 22:12:22 +0100

On 13 May 2015 at 22:06, Richard Henderson <address@hidden> wrote:
> On 05/13/2015 01:54 PM, Peter Maydell wrote:
>> We don't seem to be very consistent about what type we're using for
>> mmu_idx. In the TCG backends changed in patch 1 (and in the
>> prototype of this helper which we've just removed) we used 'int';
>> in the return type of get_mmuidx() we use 'unsigned'; and here we're
>> using size_t...
>
> Yes, we previously used "int", but we only allow small positive values.  I
> could have continued to use "int", but I thought "unsigned" more approprate
> most places that it's actually used.
>
> As for here, we're about to pass mmu_idx to several array references.  In the
> past this has been known to help the compiler realize it doesn't need an
> additional zero-extension.  That said, in this case with gcc 4.9, it doesn't
> seem to affect code generation in any way except register allocation.  I can
> change it back if you prefer.

I don't mind use of unsigned; I do think size_t is very odd.
If the compiler needs an array index to be size_t to generate
decent code then it's pretty broken, because almost nobody
uses size_t for array indexes (indeed signed is probably more
common than unsigned types I would hae thought).

thanks
-- PMM



reply via email to

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