qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/13] tcg: rewrite tcg_reg_alloc_mov()


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 07/13] tcg: rewrite tcg_reg_alloc_mov()
Date: Thu, 27 Sep 2012 15:18:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 09/27/2012 10:15 AM, Aurelien Jarno wrote:
> +    /* We have to load the value in a register for moving it to another
> +       or for saving it. We assume it's better to keep it there than to
> +       reload it later. */
> +    if ((NEED_SYNC_ARG(0) && ts->val_type != TEMP_VAL_REG)
> +        || ts->val_type == TEMP_VAL_MEM) {
> +        ts->reg = tcg_reg_alloc(s, arg_ct->u.regs, allocated_regs);
> +        if (ts->val_type == TEMP_VAL_MEM) {
> +            tcg_out_ld(s, ts->type, ts->reg, ts->mem_reg, ts->mem_offset);
> +        } else if (ts->val_type == TEMP_VAL_CONST) {
> +            tcg_out_movi(s, ts->type, ts->reg, ts->val);
> +        }
> +        s->reg_to_temp[ts->reg] = args[1];
> +        ts->val_type = TEMP_VAL_REG;
> +        ts->mem_coherent = 1;
> +    }

Ok, I believe I understand what's going on now.  Nothing like trying to
rewrite the function yourself to figure out why you've done things this way.

The only thing I'd change for clarity is that first condition:

    /* If the source value is not in a register, and we're going to be
       forced to have it in a register in order to perform the copy,
       then copy the SOURCE value into its own register first.  That way
       we don't have to reload SOURCE the next time it is used.

       Note that in the CONST + SYNC case, we must for the moment have
       the value in a register because we have no direct access to a
       store constant primitive.  */

    if ((ts->val_type == TEMP_VAL_CONST && NEED_SYNC_ARG(0))
        || ts->val_type == TEMP_VAL_MEM) {



r~



reply via email to

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