From patchwork Tue Nov 21 21:25:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 119403 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5810879qgn; Tue, 21 Nov 2017 13:28:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMYG9WpMSzvZpsZFaiWnXaGzC3fyChrcIgmJMwDXo1pNKxU28Sd09yGhsXn/w4i3cVMVeLzv X-Received: by 10.129.125.3 with SMTP id y3mr12017219ywc.486.1511299683444; Tue, 21 Nov 2017 13:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511299683; cv=none; d=google.com; s=arc-20160816; b=MR/GlKDLdBjpj4nW+iAtDpxot6+HRZgLLGdVgJNsw/o5jSj0RUh/F2s7kqbqeZSsie 25qUcCHEl8T4SrBhdTzzynDXzi1KRgS1G0fUpXi6HWsz+fKjbary6HjI8dh6OWAwrp3u J29PVFlnzHq8iKms73RsoFhSJwPInF74+hFe5Ehg2Q3TWAmvMkUg00n2TRujg7Hzghmf qGoRVgtradcOf9tLaFTH0FV31JZY5nSSpDx3tWmY7I/u00OeJTYU6KqmpoJljamOV1me 8zx2alPF8cQ4VRb4unYW3/FfH+s2fVovywkKAVvCGzd/09R34p4iC6SOW4aNj3FU8+PS Mgug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=JgPyalRRpbRQN5BRX+1C71j5J+ztfUwJIUUYRumX/6I=; b=SovvSOqtaO3cOu+IzHtZbiPqc6Iu/4t1MtN3EnFTGtypMXAfkDICP9HsoANNxJimRG mFveuGFs8k1T8vgRY8afe+gEemEYWGRoL95d/95WGpoThapQCsaQmz7XYO7DyXUi1QSu n8/FX71h6BhwmsIDKsiId+Br2NenstjqDCXCFdXydFxjEocmMm2o27+fW1yTMLSYwZxR ajfWo04GDGgCMdlCMSbbq31jTK4AC7FDbvzq5luvbMpISi7kRsnFU061hBmO/Hr3c8Xz LZXnRfBP+/pPhR6u81NEX9dYIqqLBNRsYZIZevzNJ+CCIBCwqdxFRGKdCS+5lhq1tzkc XSbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=azRl08gT; 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 j14si2895020ybg.629.2017.11.21.13.28.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 21 Nov 2017 13:28:03 -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=azRl08gT; 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]:36575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHG5K-0004Hr-Pp for patch@linaro.org; Tue, 21 Nov 2017 16:28:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHG51-0004Gb-5q for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:27:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHG4z-0007d9-KZ for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:27:43 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:46812) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHG4z-0007ci-EI for qemu-devel@nongnu.org; Tue, 21 Nov 2017 16:27:41 -0500 Received: by mail-wm0-x241.google.com with SMTP id u83so6327078wmb.5 for ; Tue, 21 Nov 2017 13:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=JgPyalRRpbRQN5BRX+1C71j5J+ztfUwJIUUYRumX/6I=; b=azRl08gTZ7myVx2A3RlmuY6ujX9t8uywlcc3cvea9PBDfCbk4/sFEm5tdHJ7uPCR0F FE6jfdT8olyX0UNbdV0ikadBzsRP1kiX+LwHfAOm23lnQOiIJ/kJElvDWeOvrOdZm0xO UWES3UgoPV94928OwTqmMtXRgqVs+dTrsHH6M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=JgPyalRRpbRQN5BRX+1C71j5J+ztfUwJIUUYRumX/6I=; b=lX6wk4VMBlC/ihonHZaWAYOYbVJbS6agKS0frWMLt3Gu3vLYJ4+Pn7Vr7F3E0tdZQ5 xmbRNUZIrpXuxnH81tP7BSImyLFa/mC+zfj8sA/d0OB1A3Dpo+0zBFsep5mvf+Mtq3/9 qLpaaalKvrbEEN2ItKFEdfAuGy+6+sDRoszzAw5f6xOTSSAyzr/a/mF/4HcYFg/PVqEw 6YmHBebM0R7lNFiMvM6sfZIe1MgkyRWVSyIWB1L+4FC0DMtbVzzIxQyVTjVOg2MXcOZq +fVP1qT5NWtpCr/V7BCnzyw/rC2ELgWrB1sqzAk0zfJ/yHY3pIhZmAOUn9P7dhHCeV1G nmbA== X-Gm-Message-State: AJaThX5TYi3B69fGgZefGE3PZ94gOa/N9FC6YftOxTtJo8i9P4kA9wR8 Xdf2XmfTIulYq+kCJsIUaPGaMSu54ts= X-Received: by 10.28.15.149 with SMTP id 143mr2604895wmp.43.1511299660147; Tue, 21 Nov 2017 13:27:40 -0800 (PST) Received: from cloudburst.twiddle.net (70.red-37-158-60.dynamicip.rima-tde.net. [37.158.60.70]) by smtp.gmail.com with ESMTPSA id e124sm706517wmg.34.2017.11.21.13.27.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2017 13:27:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 21 Nov 2017 22:25:11 +0100 Message-Id: <20171121212534.5177-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171121212534.5177-1-richard.henderson@linaro.org> References: <20171121212534.5177-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH v6 03/26] 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: , 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. 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.13.6 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;