From patchwork Fri Dec 29 19:31:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122950 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5053593qgn; Fri, 29 Dec 2017 11:32:00 -0800 (PST) X-Google-Smtp-Source: ACJfBotPHXsoG+s7Ndzpn4wX7RvT3TpqbqP1ZDjXuh+MKZFM341Aaslczt/8s/geM44E7zYtQtks X-Received: by 10.129.216.9 with SMTP id d9mr23821845ywj.356.1514575920236; Fri, 29 Dec 2017 11:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514575920; cv=none; d=google.com; s=arc-20160816; b=wuGIVJh0OgJ4f13W8FfzhyfSPPMM9Mp2ZARhUP4vENE6ymEOgeMo9TgZLJKGzhduKt agoh+381iTtRzxLM2uK9GzMatfxl7wOs7SVC/3HooaiSAF2xGOvFZox/4XmIbfGBoZrR g4Dr54/rwha8btXo8Onijjv6MHl0amJkyWjCtDKXcflAewb2JjbSad9FsIdXKVy0vFIk NEDxggC32e3tLslB6GXetc3e5tSMdwqMRbFQgC1LHd9Y7f/24VgEhVc/iEDL12rkHc08 ONZzv6+JJpjjwmp2RgM/eWlBFLXoTQsTUhLaTI/UC2h5DwVouxtAc4WwhVhgZLQeK88x yQDg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=aj59PuZaZzVRzLWyd3Vc43FIE3Hg1W0rjzAv4vcwhz4=; b=XWulIDjTExESDZdbfA+8J04Ymwyv9/eT1iFq1zb2j3g5BBvLzvAK4/KCauO2EYFLf+ GourLnJoElGE7eOxADuzrnL0tuk3atqnA+midvyZ0j3qXkFPFE2be1c445QMk+ZaS8IH cWPKm9NTg35gdAaAztKdQT/HHKXUaaeLUoK/1/OsrtH4kD5WTND5AV6biislcRIvqvwg gDj7hOfRj9y8H2kR+auXBPceF8Dm0gPUN2p1qvyCTdbNUhDbTm0fXz/JvPmWZEpM0zLX WVeTroynyzoMbyNkuLEdeQXa8anIOrCCKY9l3xkU6+cwhTthhf7Tpk1GTL9/b+aQE4e6 kaTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QRcnwpr6; 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 r14si6957325ybb.637.2017.12.29.11.32.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 29 Dec 2017 11:32:00 -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=QRcnwpr6; 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]:51967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eV0Nr-0000od-Hk for patch@linaro.org; Fri, 29 Dec 2017 14:31:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eV0NN-0000n5-NT for qemu-devel@nongnu.org; Fri, 29 Dec 2017 14:31:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eV0NI-0000Ho-RG for qemu-devel@nongnu.org; Fri, 29 Dec 2017 14:31:29 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:35735) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eV0NI-0000GT-K2 for qemu-devel@nongnu.org; Fri, 29 Dec 2017 14:31:24 -0500 Received: by mail-pf0-x241.google.com with SMTP id j124so22438915pfc.2 for ; Fri, 29 Dec 2017 11:31:24 -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 :mime-version:content-transfer-encoding; bh=aj59PuZaZzVRzLWyd3Vc43FIE3Hg1W0rjzAv4vcwhz4=; b=QRcnwpr6iTq1n9ZBu269HR3I2nxszZV4f4g61LKrpIkpF7jWxIvhJc1QMDpIvpI37S nSZzsdRfNj/0kCo83CbhgO+HK1zq5L0OMN1yNHCx1QvPHmJaksir1b+HRJK6nBiatr0w qA+I9yitv4LcfQRkjxPNmplVopUAf4u86FpYM= 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:mime-version:content-transfer-encoding; bh=aj59PuZaZzVRzLWyd3Vc43FIE3Hg1W0rjzAv4vcwhz4=; b=Sk+wfeMPh5yZLdzg+3HMjHZu04OphDGg8UDSQLzU5rwpp6dOQZL03fIcM2tWkKd8k7 fs+pizw5TuzX96ZHJxIvSkLIjP0u3zuvePZ3NBfjUAl8OCzCiTT3y12m1A6fl88acqJo 5dsHDxQ9L92BHc43fc8pfGSQZPQugRh1XeNtKzAt+DKfV926meSNqBhsNrOOyOuFC+pV ewjlhfxoH7ZueGaLYNtTo56teXnQxr7xup06UHnanTGyi8DyDtnSlwbOLugqqZhPLtkE Um91ZIlLWcxeq1zeO8RvUNfMfvSA0k+nt5MQIXQGP35Re4370XA82ihp+Xg/Uh5xUc1F hIkQ== X-Gm-Message-State: AKGB3mJU3tTmwcqgoLLWjYHIr11nZssoKxsApXi8e+0QHGMIZ0Wpg8mZ /Irc2BQHQb/5iU+cJZCK1iUxqC1YY6E= X-Received: by 10.101.86.204 with SMTP id w12mr14482087pgs.70.1514575883157; Fri, 29 Dec 2017 11:31:23 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-183-164.tukw.qwest.net. [97.113.183.164]) by smtp.gmail.com with ESMTPSA id q68sm71240492pfb.1.2017.12.29.11.31.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Dec 2017 11:31:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 29 Dec 2017 11:31:10 -0800 Message-Id: <20171229193113.11753-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171229193113.11753-1-richard.henderson@linaro.org> References: <20171229193113.11753-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 5/8] tcg: Generalize TCGOp parameters 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" We had two fields specific to INDEX_op_call. Rename these and add some macros so that the fields may be reused for other opcodes. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg.h | 10 ++++++---- tcg/optimize.c | 4 ++-- tcg/tcg.c | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 17 deletions(-) -- 2.14.3 diff --git a/tcg/tcg.h b/tcg/tcg.h index a577447846..f25efa9795 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -566,10 +566,9 @@ typedef uint16_t TCGLifeData; typedef struct TCGOp { TCGOpcode opc : 8; /* 8 */ - /* The number of out and in parameter for a call. */ - unsigned calli : 4; /* 12 */ - unsigned callo : 2; /* 14 */ - unsigned : 2; /* 16 */ + /* Parameters for this opcode. See below. */ + unsigned param1 : 4; /* 12 */ + unsigned param2 : 4; /* 16 */ /* Lifetime data of the operands. */ unsigned life : 16; /* 32 */ @@ -581,6 +580,9 @@ typedef struct TCGOp { TCGArg args[MAX_OPC_PARAM]; } TCGOp; +#define TCGOP_CALLI(X) (X)->param1 +#define TCGOP_CALLO(X) (X)->param2 + /* Make sure operands fit in the bitfields above. */ QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8)); diff --git a/tcg/optimize.c b/tcg/optimize.c index e495680e95..2cbbeefd53 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -627,8 +627,8 @@ void tcg_optimize(TCGContext *s) /* Count the arguments, and initialize the temps that are going to be used */ if (opc == INDEX_op_call) { - nb_oargs = op->callo; - nb_iargs = op->calli; + nb_oargs = TCGOP_CALLO(op); + nb_iargs = TCGOP_CALLI(op); for (i = 0; i < nb_oargs + nb_iargs; i++) { TCGTemp *ts = arg_temp(op->args[i]); if (ts) { diff --git a/tcg/tcg.c b/tcg/tcg.c index f26949a900..93caa0be93 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1430,7 +1430,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) } else { nb_rets = 0; } - op->callo = nb_rets; + TCGOP_CALLO(op) = nb_rets; real_args = 0; for (i = 0; i < nargs; i++) { @@ -1469,10 +1469,10 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) } op->args[pi++] = (uintptr_t)func; op->args[pi++] = flags; - op->calli = real_args; + TCGOP_CALLI(op) = real_args; /* Make sure the fields didn't overflow. */ - tcg_debug_assert(op->calli == real_args); + tcg_debug_assert(TCGOP_CALLI(op) == real_args); tcg_debug_assert(pi <= ARRAY_SIZE(op->args)); #if defined(__sparc__) && !defined(__arch64__) \ @@ -1634,8 +1634,8 @@ void tcg_dump_ops(TCGContext *s) } } else if (c == INDEX_op_call) { /* variable number of arguments */ - nb_oargs = op->callo; - nb_iargs = op->calli; + nb_oargs = TCGOP_CALLO(op); + nb_iargs = TCGOP_CALLI(op); nb_cargs = def->nb_cargs; /* function name, flags, out args */ @@ -1996,8 +1996,8 @@ static void liveness_pass_1(TCGContext *s) { int call_flags; - nb_oargs = op->callo; - nb_iargs = op->calli; + nb_oargs = TCGOP_CALLO(op); + nb_iargs = TCGOP_CALLI(op); call_flags = op->args[nb_oargs + nb_iargs + 1]; /* pure functions can be removed if their result is unused */ @@ -2233,8 +2233,8 @@ static bool liveness_pass_2(TCGContext *s) TCGTemp *arg_ts, *dir_ts; if (opc == INDEX_op_call) { - nb_oargs = op->callo; - nb_iargs = op->calli; + nb_oargs = TCGOP_CALLO(op); + nb_iargs = TCGOP_CALLI(op); call_flags = op->args[nb_oargs + nb_iargs + 1]; } else { nb_iargs = def->nb_iargs; @@ -2915,8 +2915,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) { - const int nb_oargs = op->callo; - const int nb_iargs = op->calli; + const int nb_oargs = TCGOP_CALLO(op); + const int nb_iargs = TCGOP_CALLI(op); const TCGLifeData arg_life = op->life; int flags, nb_regs, i; TCGReg reg;