qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] TCG register allocator


From: Peter Maydell
Subject: Re: [Qemu-devel] TCG register allocator
Date: Wed, 25 Jan 2012 15:49:02 +0000

On 25 January 2012 15:42, Xin Tong <address@hidden> wrote:
> I tried to reserve a register in target-i386 with this code
>
> target-i386/translate.c    tb_env = tcg_global_reg_new_ptr(TCG_AREG1, "env");

Why do you want to define a second global which holds the environment
variable? Just use TCG_AREG0 for that.

> i386/tcg-target.h         #define TCG_AREG1 TCG_REG_R13
>
> i386/tcg-target.c         tcg_out_movi(s, TCG_TYPE_PTR, TCG_AREG1, args[0]);
>
> But when i looked into the dynamically generated code, the place which
> i use TCG_AREG1 becomes RBP and RBP is not reserved either.

If the reason you're trying to reserve a register is so you can use
it as a temporary in tcg-target.c's codegen, then reserve it in
tcg_target_init(). (But x86-32 is very short on registers as it is,
so really it would be much better not to...)

-- PMM



reply via email to

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