From patchwork Tue Dec 25 20:55:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154499 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5221128ljp; Tue, 25 Dec 2018 13:17:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN7GnNG/5eWUcSk4b2Pu36fgnAfX3ttOSsHhk7JF9WaXM/5kVgYnN4usYdE8PYAKwIOy2CJM X-Received: by 2002:a0c:96c9:: with SMTP id b9mr15841494qvd.238.1545772633340; Tue, 25 Dec 2018 13:17:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545772633; cv=none; d=google.com; s=arc-20160816; b=PtOkHm3XhBJi42u+r5WZfx3L6bPIU2l4YSEJFhBVzX2xiz/FFYzOKLT/VoNtQqGHvF FATjtr+QMB98HA356JdyjuIeF334XoxlFoEHCEFf4qplUnefU6BFc1cA9NmtAejulK15 TAwucblJfm2dkKrxiufyvdfuH97m5nfqDXr342KDbdlaNa9OXAAHoTl3fD+QUO+AiAat Q5KvJZ7YVyKJH0cu/4CVF0DvWjuyJggyoIsXQzoz5wSVHFEEq3jEvxk2UfpN4TrhGKYD aMisipfnKV2XiocuVjwwxz/5E33NEno5w4e7gTXMoc+Uuq51qzNx78rMB2FjZBn8F/Bp cusw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=6flMHALx7z54lJddWJJTsfo/FLnHBpGEDcANLWqqSwk=; b=nyus6TkLwDfPtAhGUpfK+xyDjPYDk2UfKhKVP9SwupguUlqw/i+sFDCMO3Jv4DrK0q dtzhgftD/BezJfwFl0NmRsTHxuO7SFjHjStR3C5H0dEpor4pI49zqs1K5VnmGqxhb+99 lkTuSlU977mVnlVhZeVmVHJsnt8klBbn6RR6zd7Rj9FdvjV01ensqkNi3u3bbGTnKCN9 R/tWpvHPmomyuDq4e2XKD4nYCMYBw/NtxUQ1Uo782c78O1bpxcIiLwkqA/Gg74REC6s1 TM8CLs4axteizvZbprAK9RAM9nZPVM0q/IjwLIo25dXZC9qCyZko39nqrAdYLtuDOb2H f7Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dGL8G17L; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id q123si1912821qkd.203.2018.12.25.13.17.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 25 Dec 2018 13:17:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dGL8G17L; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:43207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbu4e-00067C-L4 for patch@linaro.org; Tue, 25 Dec 2018 16:17:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbtnf-0007ow-Gk for qemu-devel@nongnu.org; Tue, 25 Dec 2018 15:59:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbtne-0001Z6-Ls for qemu-devel@nongnu.org; Tue, 25 Dec 2018 15:59:39 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:39599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbtne-0001YN-GJ for qemu-devel@nongnu.org; Tue, 25 Dec 2018 15:59:38 -0500 Received: by mail-pg1-x52b.google.com with SMTP id w6so6820097pgl.6 for ; Tue, 25 Dec 2018 12:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6flMHALx7z54lJddWJJTsfo/FLnHBpGEDcANLWqqSwk=; b=dGL8G17LP63PfM3bHGLEPHYOA6k+8hDNWbPykFdHvba+ShgtdQJ4lwxBzea6tTW9Jw 8CS2hkg7oCc1zdQnGCWSs4GkBtWyAf8wTqoIcYkfZAT7BmmSt2gLWBftHrMez+o8ifY6 EOZyzdkk7Y2dahVUECdNas+eAy3fv/M02FEyQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6flMHALx7z54lJddWJJTsfo/FLnHBpGEDcANLWqqSwk=; b=TGsB44y2fB/njNFXe/rktmpOldi8zn8bqkyJHQR/VtNbNUFla0mLGGyqnU3n+DQdhc 6a7mHubt8rUdBp9ItOMYQNy6hvpV2lfwVf81Vwu8z+8esVhAm8xhZsg/prFzPgAhomy/ EZsBjfP9wI2vzhPVxNSSWzX7robOSaUSj6H84zhyyGBNmvK4/qGGUESClaJO/vruSzkp Cwj3H4SO/8qqPxYIHWeMtdJ2WEVwIrExsf4PL7QwgDgVnLXJhqgIK5mdrXrhaDAxG7OT Yi9woLIJW0JL30R5DnG26b+h2ucJnMQKKM/XqvznLl7CMZ5MriENYGIPoBvQy9AGD+a4 1HVw== X-Gm-Message-State: AJcUukfpwBEGsWnpNOCz5KEJGq4cZsumswt2q7qzNPjuZ/M6UTexwWBk 81GnHiN5r1eWxMhUCX4yGBUgIyN8csU= X-Received: by 2002:a63:dd15:: with SMTP id t21mr16084483pgg.347.1545771577295; Tue, 25 Dec 2018 12:59:37 -0800 (PST) Received: from cloudburst.home (c211-28-135-144.sunsh3.vic.optusnet.com.au. [211.28.135.144]) by smtp.gmail.com with ESMTPSA id t21sm48501628pgg.24.2018.12.25.12.59.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Dec 2018 12:59:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Dec 2018 07:55:21 +1100 Message-Id: <20181225205529.10874-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181225205529.10874-1-richard.henderson@linaro.org> References: <20181225205529.10874-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52b Subject: [Qemu-devel] [PULL 34/42] tcg: Add output_pref to TCGOp X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Allocate storage for, but do not yet fill in, per-opcode preferences for the output operands. Pass it in to the register allocation routines for output operands. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/tcg.h | 3 +++ tcg/tcg.c | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) -- 2.17.2 diff --git a/tcg/tcg.h b/tcg/tcg.h index db2d91867f..c6721cc7a7 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -619,6 +619,9 @@ typedef struct TCGOp { /* Arguments for the opcode. */ TCGArg args[MAX_OPC_PARAM]; + + /* Register preferences for the output(s). */ + TCGRegSet output_pref[2]; } TCGOp; #define TCGOP_CALLI(X) (X)->param1 diff --git a/tcg/tcg.c b/tcg/tcg.c index 7844158a8a..32c66dae7d 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2591,6 +2591,8 @@ static void liveness_pass_1(TCGContext *s) break; } op->life = arg_life; + op->output_pref[0] = 0; + op->output_pref[1] = 0; } } @@ -3105,17 +3107,18 @@ static void tcg_reg_alloc_movi(TCGContext *s, const TCGOp *op) TCGTemp *ots = arg_temp(op->args[0]); tcg_target_ulong val = op->args[1]; - tcg_reg_alloc_do_movi(s, ots, val, op->life, 0); + tcg_reg_alloc_do_movi(s, ots, val, op->life, op->output_pref[0]); } static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) { const TCGLifeData arg_life = op->life; - TCGRegSet allocated_regs; + TCGRegSet allocated_regs, preferred_regs; TCGTemp *ts, *ots; TCGType otype, itype; allocated_regs = s->reserved_regs; + preferred_regs = op->output_pref[0]; ots = arg_temp(op->args[0]); ts = arg_temp(op->args[1]); @@ -3129,7 +3132,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) if (IS_DEAD_ARG(1)) { temp_dead(s, ts); } - tcg_reg_alloc_do_movi(s, ots, val, arg_life, 0); + tcg_reg_alloc_do_movi(s, ots, val, arg_life, preferred_regs); return; } @@ -3138,7 +3141,8 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) the SOURCE value into its own register first, that way we don't have to reload SOURCE the next time it is used. */ if (ts->val_type == TEMP_VAL_MEM) { - temp_load(s, ts, tcg_target_available_regs[itype], allocated_regs, 0); + temp_load(s, ts, tcg_target_available_regs[itype], + allocated_regs, preferred_regs); } tcg_debug_assert(ts->val_type == TEMP_VAL_REG); @@ -3168,7 +3172,7 @@ static void tcg_reg_alloc_mov(TCGContext *s, const TCGOp *op) input one. */ tcg_regset_set_reg(allocated_regs, ts->reg); ots->reg = tcg_reg_alloc(s, tcg_target_available_regs[otype], - allocated_regs, 0, + allocated_regs, preferred_regs, ots->indirect_base); } tcg_out_mov(s, otype, ots->reg, ts->reg); @@ -3302,7 +3306,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) } else if (arg_ct->ct & TCG_CT_NEWREG) { reg = tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs | o_allocated_regs, - 0, ts->indirect_base); + op->output_pref[k], ts->indirect_base); } else { /* if fixed register, we try to use it */ reg = ts->reg; @@ -3311,7 +3315,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) goto oarg_end; } reg = tcg_reg_alloc(s, arg_ct->u.regs, o_allocated_regs, - 0, ts->indirect_base); + op->output_pref[k], ts->indirect_base); } tcg_regset_set_reg(o_allocated_regs, reg); /* if a fixed register is used, then a move will be done afterwards */