From nobody Tue Feb 10 03:38:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508924437898297.9193182513362; Wed, 25 Oct 2017 02:40:37 -0700 (PDT) Received: from localhost ([::1]:47322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7IAl-0003M6-TT for importer@patchew.org; Wed, 25 Oct 2017 05:40:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7I6N-0008AB-I1 for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7I6J-0007wi-HW for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:35:55 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:54071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7I6J-0007uY-BL for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:35:51 -0400 Received: by mail-wr0-x244.google.com with SMTP id u40so17444611wrf.10 for ; Wed, 25 Oct 2017 02:35:51 -0700 (PDT) Received: from cloudburst.twiddle.net ([62.168.35.107]) by smtp.gmail.com with ESMTPSA id v23sm2751025wmh.8.2017.10.25.02.35.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2017 02:35:49 -0700 (PDT) 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=eQ9O/8sjQoYhwVgNKOow61511aq8+4FrGSUPZVPj2f8=; b=LznyzLgRnhcrHg7RF2uaS2yifrUb6scAb3DtLZATuW2XlbaWJ1nEcobXkYUb9jL4J/ A40rIhEsnUTF2twWw6IIAMksbGh8l5XnGo3YaXk2iVenUW2tAz/9h0r8goUA43cKNZiQ 8SSblyF1PBHiJ+rXCQDY23TK54eObVLa6ck34= 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=eQ9O/8sjQoYhwVgNKOow61511aq8+4FrGSUPZVPj2f8=; b=N0xu+4d4UJ0MBT6BwtO4H5VFn4LMnZuuigI+aAJL36VvdvxNK3jTX5RDTRcpImZoim EXuZBwiw6D+ewuKfelsP6RQ2BIbfvPYcRjiGYG0mTSR3NVlAa4aDrhp9xAEWodNWf7Ec tMSFvYivG4dxAmeCrqIkEI7DUin6fL8q7HsZXJ/Bc3OrjPk81DSmLMmHwuiIqduEFVcL 9ea8LGiMVmBGp5ooCtyYwaDvqB7LYzWQ/qtyZd1KM4Z9V+qafl/KPFhb2plHHqF1ZS/O 9mEghti5crRIDBGQMV8cb1Lq+xVK1usgLW1K1LSjOTdjdKz+avxLdvrPpZJCIvQ00Vai dTrQ== X-Gm-Message-State: AMCzsaXrbz1Sl96vV0Oy+s7wV2+SErCmQqajNQUeyGrCpXjrbCcN8ziF UfpgOszj/oTsC2Wy3EPSpFem3J+Io/w= X-Google-Smtp-Source: ABhQp+RBN/qZh3CPaL9Ut+8RQ8W4vuNN8Ykmp8ch0Hq72t+uroG+udWcruDgu1g7Mh4Y07E1xHi33A== X-Received: by 10.223.163.215 with SMTP id m23mr1431857wrb.32.1508924150091; Wed, 25 Oct 2017 02:35:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Oct 2017 11:34:52 +0200 Message-Id: <20171025093535.10175-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171025093535.10175-1-richard.henderson@linaro.org> References: <20171025093535.10175-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 08/51] tcg: Introduce temp_arg, export temp_idx 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, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Richard Henderson At the same time, drop the TCGContext argument and use tcg_ctx instead. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/tcg.h | 12 ++++++++++++ tcg/tcg.c | 19 ++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index 5fcdec1fc5..828c1e70e5 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -729,6 +729,18 @@ struct TCGContext { extern TCGContext tcg_ctx; extern bool parallel_cpus; =20 +static inline size_t temp_idx(TCGTemp *ts) +{ + ptrdiff_t n =3D ts - tcg_ctx.temps; + tcg_debug_assert(n >=3D 0 && n < tcg_ctx.nb_temps); + return n; +} + +static inline TCGArg temp_arg(TCGTemp *ts) +{ + return temp_idx(ts); +} + static inline TCGTemp *arg_temp(TCGArg a) { return a =3D=3D TCG_CALL_DUMMY_ARG ? NULL : &tcg_ctx.temps[a]; diff --git a/tcg/tcg.c b/tcg/tcg.c index e2a5f3f4c2..f6e76df3ba 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -473,13 +473,6 @@ void tcg_func_start(TCGContext *s) s->gen_next_op_idx =3D 1; } =20 -static inline int temp_idx(TCGContext *s, TCGTemp *ts) -{ - ptrdiff_t n =3D ts - s->temps; - tcg_debug_assert(n >=3D 0 && n < s->nb_temps); - return n; -} - static inline TCGTemp *tcg_temp_alloc(TCGContext *s) { int n =3D s->nb_temps++; @@ -516,7 +509,7 @@ static int tcg_global_reg_new_internal(TCGContext *s, T= CGType type, ts->name =3D name; tcg_regset_set_reg(s->reserved_regs, reg); =20 - return temp_idx(s, ts); + return temp_idx(ts); } =20 void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t siz= e) @@ -605,7 +598,7 @@ int tcg_global_mem_new_internal(TCGType type, TCGv_ptr = base, ts->mem_offset =3D offset; ts->name =3D name; } - return temp_idx(s, ts); + return temp_idx(ts); } =20 static int tcg_temp_new_internal(TCGType type, int temp_local) @@ -645,7 +638,7 @@ static int tcg_temp_new_internal(TCGType type, int temp= _local) ts->temp_allocated =3D 1; ts->temp_local =3D temp_local; } - idx =3D temp_idx(s, ts); + idx =3D temp_idx(ts); } =20 #if defined(CONFIG_DEBUG_TCG) @@ -1193,7 +1186,7 @@ static void tcg_reg_alloc_start(TCGContext *s) static char *tcg_get_arg_str_ptr(TCGContext *s, char *buf, int buf_size, TCGTemp *ts) { - int idx =3D temp_idx(s, ts); + int idx =3D temp_idx(ts); =20 if (ts->temp_global) { pstrcpy(buf, buf_size, ts->name); @@ -1941,7 +1934,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) TCGOp *lop =3D tcg_op_insert_before(s, op, lopc, 3); =20 lop->args[0] =3D dir; - lop->args[1] =3D temp_idx(s, its->mem_base); + lop->args[1] =3D temp_arg(its->mem_base); lop->args[2] =3D its->mem_offset; =20 /* Loaded, but synced with memory. */ @@ -2012,7 +2005,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *t= emp_state) TCGOp *sop =3D tcg_op_insert_after(s, op, sopc, 3); =20 sop->args[0] =3D dir; - sop->args[1] =3D temp_idx(s, its->mem_base); + sop->args[1] =3D temp_arg(its->mem_base); sop->args[2] =3D its->mem_offset; =20 temp_state[arg] =3D TS_MEM; --=20 2.13.6