From patchwork Fri Dec 15 17:07:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 849261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bfCS0lnn"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyxj05yPmz9sNr for ; Sat, 16 Dec 2017 04:08:36 +1100 (AEDT) Received: from localhost ([::1]:47778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePtTO-0001Yw-Q5 for incoming@patchwork.ozlabs.org; Fri, 15 Dec 2017 12:08:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePtSd-0001VQ-FE for qemu-devel@nongnu.org; Fri, 15 Dec 2017 12:07:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePtSc-0002xq-Al for qemu-devel@nongnu.org; Fri, 15 Dec 2017 12:07:47 -0500 Received: from mail-it0-x243.google.com ([2607:f8b0:4001:c0b::243]:33565) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePtSc-0002xU-5X for qemu-devel@nongnu.org; Fri, 15 Dec 2017 12:07:46 -0500 Received: by mail-it0-x243.google.com with SMTP id o130so30348593itg.0 for ; Fri, 15 Dec 2017 09:07:46 -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=T0qZ0yQVuTEP92yeIk5MiIxes6YEX/ZnuZg0aGwqsdM=; b=bfCS0lnnlHxxM+Hxd3xdUubeEQOM/goTrlEelwO640rQIaVED9Ymu2vdF7Axt7eDDW uBOKYuhIYwLKmgut1rxV8TxW4f6qkfVGrT90dA0ohR4p0BZg+R2ith1anFeONCl1qWMq vzNViZdel8St7T2YiWzQed9NQ3FTvVSeGfey8= 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=T0qZ0yQVuTEP92yeIk5MiIxes6YEX/ZnuZg0aGwqsdM=; b=OlNm+Kf2FyL0cNcgerEQFGRHtX4nla5Kwghkhe6inWiGKQkdG6bNQopMU1pBDSa7LA RAc7CeB7aYmO1Yr8eGGXB/MWQD4yUWRtlrRKiPU0xbqO8tYcbVK3D3BnoZy1v/fGyiZz +YioMcOMRWhOE4lFPh5R/lT2blIdQS5VD9RFV0KdRXHejWneuMl7kuaqjLBRJTbfSNLH ud3uVnwGJILN6hfnIvM4RfvCvObbYoPLfdq6L3N1u1R34SCYTJuQxiBa5SFO9eUPhKOL FO50xKS5rBlEY9nBd073ArIscJ7SNh/Yc06jyMQYHinOau4cn/kReIv5Y93hdnlyL43f ruIA== X-Gm-Message-State: AKGB3mIFiSs1KQ4Iiw2XlHfzZkYFlM3+bQfeJ1ZBhSAqUUWZNpouoXeh CPii+3T3+bBn8nFVt0/ziFxr/VodD1A= X-Google-Smtp-Source: ACJfBotxxnqZZPSliSk7eN9xQzotkugDrFvsaoE+9GUSFwmilEBhged2N1qyCYKUD9fDPm1j1uJP9w== X-Received: by 10.107.173.223 with SMTP id m92mr13749824ioo.28.1513357665222; Fri, 15 Dec 2017 09:07:45 -0800 (PST) Received: from cloudburst.twiddle.net (141-126-166-226.dhcp.chtrptr.net. [141.126.166.226]) by smtp.gmail.com with ESMTPSA id k23sm4012974iti.22.2017.12.15.09.07.44 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Dec 2017 09:07:44 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 15 Dec 2017 11:07:30 -0600 Message-Id: <20171215170732.31125-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171215170732.31125-1-richard.henderson@linaro.org> References: <20171215170732.31125-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::243 Subject: [Qemu-devel] [PATCH 5/7] 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+incoming=patchwork.ozlabs.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 Reviewed-by: Philippe Mathieu-Daudé --- tcg/tcg.h | 10 ++++++---- tcg/optimize.c | 4 ++-- tcg/tcg.c | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 17 deletions(-) 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;