From nobody Tue Feb 10 14:32:04 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508542093077816.1625732973147; Fri, 20 Oct 2017 16:28:13 -0700 (PDT) Received: from localhost ([::1]:56011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5ghz-0004AF-8g for importer@patchew.org; Fri, 20 Oct 2017 19:28:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gan-0005rb-6A for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:20:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5gam-0007Zg-5l for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:20:41 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:52240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5gal-0007ZS-Vk for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:20:40 -0400 Received: by mail-pf0-x242.google.com with SMTP id e64so13061911pfk.9 for ; Fri, 20 Oct 2017 16:20:39 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-165-104.tukw.qwest.net. [97.113.165.104]) by smtp.gmail.com with ESMTPSA id a17sm3532594pfk.173.2017.10.20.16.20.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2017 16:20:37 -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; bh=xSnUOwn9DI8Gqz3X6MahwECIqpmnhwEHzwT4Fit1QLM=; b=fO5WNjwPLuwGCQOGpb4w3wJPEFJdBb5ra9RSDeBnkQObSYK9fhQGPCE9ecb/nvkjfI psMwpKmwYQOSe9+fpRyAEMifx/XO6L33QbO4UkNwq/QQGTES6VKhMeEjCubQm+Dvtybl PUbai0dQ5+A6Mikgi0MMQu7DKawo3sSL/rvuI= 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=xSnUOwn9DI8Gqz3X6MahwECIqpmnhwEHzwT4Fit1QLM=; b=q4nGlIYq3gZh/9SZV8S/xTucaxg+olku3PFK+3cgzJJ3fXy3GBP9sVdKVjjQXY9Ghm JOPzGhza0rew9DkeyvMh/jdguJ3a9Zdm/TxHSebK6qvRvd4C0JL4NcUZGfbUl2wUAf5p 2D5TCqj37x6jU95k2t3nQ3dIyBHj3RnHQ76MnzhnKHhYXBb5JC8gyGfP21kMvwRdB9FJ FokWxzV3kbjrcjC/35uXX85QDOncx3o6c2XG4C33io55rnWF4aaEhVtKjgJTqT7geeR7 0B3Mn6gaMgrBUDdOl+XqwQW9kOH4o6ngavRgc/1czJF2pNNzl0DcoZVcWn5/tGULFzGs Q8pg== X-Gm-Message-State: AMCzsaXegOy+2LsqupEwLu5MENusIR1XGkYSziPgTJc5DnryeOmkO6SY gO0rxzr1TYH8tjRcsQw1gwzlQLNoSmU= X-Google-Smtp-Source: ABhQp+QjhZmXycOvFHMBiNgFbXDuYH1+o0vON2JZyWNnbhw2wtD5LnFphFjn1wAwBARGwzv9F5V34w== X-Received: by 10.99.158.82 with SMTP id r18mr5875170pgo.349.1508541638748; Fri, 20 Oct 2017 16:20:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 16:19:39 -0700 Message-Id: <20171020232023.15010-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171020232023.15010-1-richard.henderson@linaro.org> References: <20171020232023.15010-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::242 Subject: [Qemu-devel] [PATCH v7 08/52] 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: pbonzini@redhat.com, cota@braap.org, f4bug@amsat.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 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Richard Henderson At the same time, adrop the TCGContext argument and use tcg_ctx instead. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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