qemu-devel
[Top][All Lists]
Advanced

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

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


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 07/26] tcg: rewrite tcg_reg_alloc_mov()
Date: Wed, 10 Oct 2012 09:27:44 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 10/09/2012 12:56 PM, Aurelien Jarno wrote:
> Now that the liveness analysis provides more information, rewrite
> tcg_reg_alloc_mov(). This changes the behaviour about propagating
> constants and memory accesses. We now take the assumption that once
> a value is loaded into a register (from memory or from a constant),
> it's better to keep it there than to reload it later. This assumption
> is now always almost correct given that we are now sure the
> corresponding temp is going to be used later (otherwise it would have
> been synchronized and marked as dead already). The assumption is wrong
> if one of the op after clobbers some registers including the one
> of the holding the temp (this can be avoided by allocating clobbered
> registers last, which is what most TCG target do), or in case of lack
> of available register.
> 
> Signed-off-by: Aurelien Jarno <address@hidden>

Reviewed-by: Richard Henderson <address@hidden>

> +        /* The code in the first if block should have moved the
> +           temp to a register. */
> +        assert(ts->val_type == TEMP_VAL_REG);
> +        if (IS_DEAD_ARG(1) && !ts->fixed_reg && !ots->fixed_reg) {
> +                /* the mov can be suppressed */
> +                if (ots->val_type == TEMP_VAL_REG) {
> +                    s->reg_to_temp[ots->reg] = -1;
> +                }
> +                ots->reg = ts->reg;
> +                temp_dead(s, args[1]);

Incorrect indentation?

>          } else {
> +            if (ots->val_type != TEMP_VAL_REG) {
> +                /* When allocating a new register, make sure to not spill the
> +                   input one. */
> +                tcg_regset_set_reg(allocated_regs, ts->reg);
> +                ots->reg = tcg_reg_alloc(s, oarg_ct->u.regs, allocated_regs);
>              }
> +            tcg_out_mov(s, ots->type, ots->reg, ts->reg);
> +        }




reply via email to

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