From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLz8W-00068B-R2 for qemu-devel@nongnu.org; Wed, 10 Oct 2012 12:28:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLz8N-0000DS-QT for qemu-devel@nongnu.org; Wed, 10 Oct 2012 12:27:56 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:51983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLz8N-0000DG-K2 for qemu-devel@nongnu.org; Wed, 10 Oct 2012 12:27:47 -0400 Received: by mail-pb0-f45.google.com with SMTP id rp2so878520pbb.4 for ; Wed, 10 Oct 2012 09:27:46 -0700 (PDT) Sender: Richard Henderson Message-ID: <5075A200.7070708@twiddle.net> Date: Wed, 10 Oct 2012 09:27:44 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1349812584-19551-1-git-send-email-aurelien@aurel32.net> <1349812584-19551-8-git-send-email-aurelien@aurel32.net> In-Reply-To: <1349812584-19551-8-git-send-email-aurelien@aurel32.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 07/26] tcg: rewrite tcg_reg_alloc_mov() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: qemu-devel@nongnu.org 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 Reviewed-by: Richard Henderson > + /* 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); > + }