From patchwork Fri Oct 20 23:19:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116547 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2224133qgn; Fri, 20 Oct 2017 16:26:46 -0700 (PDT) X-Received: by 10.200.42.104 with SMTP id l37mr9543493qtl.73.1508542006735; Fri, 20 Oct 2017 16:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508542006; cv=none; d=google.com; s=arc-20160816; b=wxkFYHBaPVZrrnxvCesITzac+lNdkPkcAKFdcxVsuJVgDT0i9l6aSlIXKSz4abfbwF 1m7YwWrtfHhubukw1l/sIjZmku4DPegZ9wUs+Sh59pup7kLwABZh3OzdeI5yt+IeTD5/ 2MuQIPQuJSulMX4dbcOT/gbN51vunvGyTYyC/SvvuYF7xS09nU3NwSSsHxoly81zs7dT 5C28oiT+zmW9B5e9AH1uNOjzEprLZEBsuoeZ7qUF8XQm5zpFYWtKf3JX7UH35vz88G1r 9aDnIsYc282iTlQk5ktyofVp2f8b19wKSjgob1fPtbUyYg6ZpFApT4ds1QSKAzW+4TTl FgyA== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=xSnUOwn9DI8Gqz3X6MahwECIqpmnhwEHzwT4Fit1QLM=; b=Zv71FrK40so3HQVvz69mDew0sbdwGU0DzkMeMftFsTLseFuYjUVJULyMPwK078Q84K RRuJQfmlYkclhB3d7Q+hpz0lt9VLY7FULLmqfU+041Mpy+jewMGRoSlrrnWH3ZTy6PwO JXxiZsRs7/zBjkzLO5E6Aiq4fCyY3kPBv7NSsQx0M3K1Z0KEd47ZmgCIdMsARaMFjdtt Lkq/M6pMjh7/tWi+GDF1WWOAa1ahYP1TawF4sLxQJRsK4XFFrcenDumC5U7RAk8muhg0 uDHPx5vJk41WLvZwTOUj9Qz19qLgVWlabRjjWD3Rs6kiqP9AX4sBoyDo+iUBHUxe61Ug frDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fO5WNjwP; 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 d18si1640986qkj.402.2017.10.20.16.26.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 20 Oct 2017 16:26:46 -0700 (PDT) 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=fO5WNjwP; 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]:56004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gge-0002gV-Lt for patch@linaro.org; Fri, 20 Oct 2017 19:26:44 -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) 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) 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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- tcg/tcg.h | 12 ++++++++++++ tcg/tcg.c | 19 ++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) -- 2.13.6 Reviewed-by: Philippe Mathieu-Daudé 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; +static inline size_t temp_idx(TCGTemp *ts) +{ + ptrdiff_t n = ts - tcg_ctx.temps; + tcg_debug_assert(n >= 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 == 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 = 1; } -static inline int temp_idx(TCGContext *s, TCGTemp *ts) -{ - ptrdiff_t n = ts - s->temps; - tcg_debug_assert(n >= 0 && n < s->nb_temps); - return n; -} - static inline TCGTemp *tcg_temp_alloc(TCGContext *s) { int n = s->nb_temps++; @@ -516,7 +509,7 @@ static int tcg_global_reg_new_internal(TCGContext *s, TCGType type, ts->name = name; tcg_regset_set_reg(s->reserved_regs, reg); - return temp_idx(s, ts); + return temp_idx(ts); } void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size) @@ -605,7 +598,7 @@ int tcg_global_mem_new_internal(TCGType type, TCGv_ptr base, ts->mem_offset = offset; ts->name = name; } - return temp_idx(s, ts); + return temp_idx(ts); } 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 = 1; ts->temp_local = temp_local; } - idx = temp_idx(s, ts); + idx = temp_idx(ts); } #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 = temp_idx(s, ts); + int idx = temp_idx(ts); if (ts->temp_global) { pstrcpy(buf, buf_size, ts->name); @@ -1941,7 +1934,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *temp_state) TCGOp *lop = tcg_op_insert_before(s, op, lopc, 3); lop->args[0] = dir; - lop->args[1] = temp_idx(s, its->mem_base); + lop->args[1] = temp_arg(its->mem_base); lop->args[2] = its->mem_offset; /* Loaded, but synced with memory. */ @@ -2012,7 +2005,7 @@ static bool liveness_pass_2(TCGContext *s, uint8_t *temp_state) TCGOp *sop = tcg_op_insert_after(s, op, sopc, 3); sop->args[0] = dir; - sop->args[1] = temp_idx(s, its->mem_base); + sop->args[1] = temp_arg(its->mem_base); sop->args[2] = its->mem_offset; temp_state[arg] = TS_MEM;