From patchwork Wed Nov 28 05:38:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 152185 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp688392ljp; Tue, 27 Nov 2018 21:42:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/UoLj0jEnxUYStmW6WQDBno/re30lz9xC3udKJfkIr8R9IjyH+GNYfLurOq3Y4EMeAlk0I+ X-Received: by 2002:a81:ae06:: with SMTP id m6mr36709053ywh.416.1543383744610; Tue, 27 Nov 2018 21:42:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543383744; cv=none; d=google.com; s=arc-20160816; b=UGUczxELWmVEwpAk3FHSS7hEuNcZXv5Swj4nO4r+ugvKusn+42YaLWDkZxSeyT/y0Q tjDQtzYIDhAmDxKKfBCIhVjzjzgsErWxrn3F7T39QF0Qbii0ryZJmK3VML1UkRTR9FH7 5Pb9wR4djxyJ1NVj0kd6ReTQBV17TjWMZmJouAFdk/OL3N8v+tbT1NSqdV9QEfHmMORU khyqTUCy+WIxZQMsA7gWaV9BoC6ih9OsXHmOQJR/JN9szyqI92U5N1gp+ZtvbhsQT5YI Ipfxgi/XZOQI3OQRrDoYgvyIrrWJ4RIYsKfqssIFEoVepzGLYjQzGB9jRAOyXTE5v/Ps nyGA== 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=E+Xgls1DHstwRUyEFIzImDIJL7cTIdasMbg1UXdI6nY=; b=dBXYTfU2o+tVkFmt6rt930LwgCSOnlXFLOF+hXLcENeOyutHzgjsfgRERld1Y/YA8f e8CMMx7uQATKoIq+1vAnapm5/N5hpE8PEVFfhV1rjeFXrtijAer2R7INjU4N9y4tXyvw YT9XcIVSGq+9YEb5zK0tngH6HRe4IuEI9a2+I6eUh6JIdN1yIy/WONVshDUYg1E4qOn/ AuA0IF2LlM54ROfhD4ksX2+G3Uq7qiRvued+4cna8WDcVNF25n6BA84plqHB/V64et8a PwB7nkl1ywnS2H0B5yA49NG33LbN/jlbgln/yVaU+e2LaFfihzuUmWtIXzeTB1h9UJmL vqjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S8Nhrgpb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c188-v6si4490073ybc.208.2018.11.27.21.42.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Nov 2018 21:42:24 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S8Nhrgpb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:46042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRscB-0006eT-UA for patch@linaro.org; Wed, 28 Nov 2018 00:42:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRsYi-0003tD-GC for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRsYg-0004Ln-Jb for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:48 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRsYe-0004Js-Hy for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:46 -0500 Received: by mail-pf1-x444.google.com with SMTP id h3so9623490pfg.1 for ; Tue, 27 Nov 2018 21:38:43 -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=E+Xgls1DHstwRUyEFIzImDIJL7cTIdasMbg1UXdI6nY=; b=S8NhrgpbgbTZLi1NSf22G8yR3HzGanLaTfaXJLjQ1BycrkyCtc3EkPhSc42oontRs8 2sSwunqNO2FmAGAx6mnONNNIRtGu+HDlQnca07WgYm2X0aCbskFFCFzAz95OzId0KFA9 /M7H4CZ0WWVX9c6cOt8a3s/1EPAD8kd3Uwaow= 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=E+Xgls1DHstwRUyEFIzImDIJL7cTIdasMbg1UXdI6nY=; b=pwYo9+PLZYvCm5f43rHY77lx81O34G8sUKsSdI0dMFvVq3ropj6B0tA/8NKI/5bPiB O9uuz+XQ5uXuhzBOSibqbIV/tbCHkZDt42qNly/j9YDTIXM+/d3bZUD4rMtSsZQ63iSX bJV8hQi6DDcNQMYnlL2QOxUQxSyhJrsvEggs1LRWRc4DrzuaRv7z7ImaB5U+9XIC4mOQ cHmXtXDAHjcWQL0my+aQmttQ4j4rlcJZxXZXo/FQkG1rVFcMi04bnFR7bpLApWjSZ5Ad NQWDyMrV/vlb3AGeJyUONBhnB7ivsUxRvI9GI6lGdyURyan/5KtLwBnk6UaO9+RqZAi1 F6fA== X-Gm-Message-State: AA+aEWYyFhy/FaRwIgp9YyqzllUJV3NBNY/AZKg3MOWoCCgn9k4CMY/2 GNbsUr4C8rKP/ZEK2HziRFp4U7RfZ/0= X-Received: by 2002:a62:5fc4:: with SMTP id t187mr5083653pfb.66.1543383522513; Tue, 27 Nov 2018 21:38:42 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id 19sm8569336pfs.108.2018.11.27.21.38.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 21:38:41 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 21:38:27 -0800 Message-Id: <20181128053834.10861-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181128053834.10861-1-richard.henderson@linaro.org> References: <20181128053834.10861-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::444 Subject: [Qemu-devel] [PATCH 05/12] 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: cota@braap.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. 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 c6caeeb42b..b2e274b7af 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -621,6 +621,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 c83ca238aa..f86415ce29 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2613,6 +2613,8 @@ static void liveness_pass_1(TCGContext *s) break; } op->life = arg_life; + op->output_pref[0] = 0; + op->output_pref[1] = 0; } } @@ -3127,17 +3129,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]); @@ -3151,7 +3154,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; } @@ -3160,7 +3163,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); @@ -3190,7 +3194,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); @@ -3324,7 +3328,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; @@ -3333,7 +3337,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 */