From patchwork Wed Oct 25 09:34:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117049 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp637379qgn; Wed, 25 Oct 2017 02:40:39 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TVnSjU7uO8MCETf/YFAGrZeSHiEXHKIqoA7Gu6SqsWRlSS2k53oNIrc81ZCj/WpHoPU5f+ X-Received: by 10.129.91.84 with SMTP id p81mr12584975ywb.109.1508924439167; Wed, 25 Oct 2017 02:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508924439; cv=none; d=google.com; s=arc-20160816; b=EGNNAObwAv3mFI46CJ9NO/M7HokuqyOFuuviCgWfGRRbcSauyF4k+SMsfTqC7k0oYS B4cIvAjnvQYX9JvhFSSZXrfgRCESho1lkBZuro/VARLQ4AueBgbItxkap7wxo6/1hivc spiA5i+rgDSf/f90AWnab9UdHpofd1s/AZi5V+pmc0hDCvTMDJPFArmUUSUO8auJ6LR+ SU4bw/eotZPCGyNCrOHefbvndn8K7678xifPiD32sg9KHkTW38b35VCst8HYkhKCYgjF 8KyyHQNH+faYsuE7HcidCr+mUjsXDX/XA5zczu3wgy/sGQs7rB66cg0hPE5pJB9fs4lY CRuw== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=eQ9O/8sjQoYhwVgNKOow61511aq8+4FrGSUPZVPj2f8=; b=LE77O135whXLlFw94oEEFNPZSxbGKQ5VF0tacgfgAzhA+Lr7R1ABqjizoo3wfVyrrA P6mnijYFTSDXPxQLk+FEWMXQFS03oR4dvcyGVKputCxlaMfgQiFGtPpuOVvVzLCKph+g T0EiEh2+L+tAHtDS/98ttFlvCEEDYnzLX2zJ0mKsbWNr4fp2iDZ6QnCT/KVEd1cUmK7y OuY8KjnR30yPREt+3awf9Rk0WzTsABgUyql9dzlChD6SLYW6b6S0LmR95p55MrBAuXDn 3DAylNdzO3aTOikm/mrsKcLTMMftEJ2FWcdIrHcZVm27n/JvAAB4enRc8slIy4/lLThS R8Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LznyzLgR; 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 s8si380405ywl.14.2017.10.25.02.40.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 25 Oct 2017 02:40:39 -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=LznyzLgR; 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]:47322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7IAw-0003M6-IX for patch@linaro.org; Wed, 25 Oct 2017 05:40:38 -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) 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-Received: by 10.223.163.215 with SMTP id m23mr1431857wrb.32.1508924150091; Wed, 25 Oct 2017 02:35:50 -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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson At the same time, drop the TCGContext argument and use tcg_ctx instead. Reviewed-by: Philippe Mathieu-Daudé 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 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;