From patchwork Fri Oct 20 23:19:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116559 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2229378qgn; Fri, 20 Oct 2017 16:34:49 -0700 (PDT) X-Received: by 10.237.37.132 with SMTP id x4mr9319519qtc.224.1508542489872; Fri, 20 Oct 2017 16:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508542489; cv=none; d=google.com; s=arc-20160816; b=R59ynEK5NbOJMxlVMZriJ4rXQUI+4smwnvA4YOkfElSXU6SWEotcSOv5R9sxkqCleG h8kPmTY9LnAwP952I5vxZAT1+AwTzLOi5WKsJvpdUW+kAh3b8SDGONY5mYb7nmUkOXc9 4N0wtzoXgR2ztlqYpHCzvXn5+zhGFt5l+plzErQzd/H4Lvezh9eDafOifjZeky7vEACW WJihsWKLAB55GeIJ7N+ULDf+S8XAfyjxlQjdFbHPWZuKfjmY08k2E7sWP8ddyWeo2dwY 7ShWHtoV9r+oU/mVthl5DwR5BXNIIjMtlb6AipYHRIiOx1lGFhw86QWVC4UCBIi9e8ER GK1w== 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=mDmQuidLIeY5aP3Lh05q/zqXBNXZsdaQX2mM/b9wNZw=; b=CUl/WLfRelCjlvAvgkEmxkHllO3IS7vJ52wLSji4lnjKR+FFHHPZ2cUB+8m4+PDQ8K R3HtQQMFq2ByNe9Vmt0tegE+2LTANMGtRIw/D36MXvTjcX3Ggos7n/Tuu0znV1WB4C3L 1qYt14I8pIGqYww3S2qbSltWXjelq00Tjt1YhgzzOwitw8C1BHuFEqKA8uOaCgYEDQ3T wahumKWaqXpEdBj60yv61o92nZ4X7HWU5z27Tqv+glMAneJ51L2NSgfWAodWKKupUJP2 3sjvShJY4c5JJ5XfAvFCkvmf7ymWF5d2wqxPHznlCKnLW0S8YRU1DSASFXPkxASCmK3V AObQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KmfOUA3Q; 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 n17si1677191qki.236.2017.10.20.16.34.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 20 Oct 2017 16:34:49 -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=KmfOUA3Q; 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]:56037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5goR-00029x-KO for patch@linaro.org; Fri, 20 Oct 2017 19:34:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gb7-00066S-DF for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5gb5-0007ij-Cm for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:01 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:54404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5gb5-0007iT-6d for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:20:59 -0400 Received: by mail-pf0-x241.google.com with SMTP id n89so13056254pfk.11 for ; Fri, 20 Oct 2017 16:20:59 -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=mDmQuidLIeY5aP3Lh05q/zqXBNXZsdaQX2mM/b9wNZw=; b=KmfOUA3Qkiy2iXFIbD4OmWDe4SqMUL5xdgD3CNl+xmFzZXPKbfOOU6jROjPkgMo1Gs 9oQCpDC6USPtmcftneLsgw8Vo2Zq7T5lmZZICHl34uAqyqRAR7eiiJ9DD+t6IUS1BrvZ DdBryWReSTEUfBmqwwtkM2lZjP0rm0nzqDwVM= 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=mDmQuidLIeY5aP3Lh05q/zqXBNXZsdaQX2mM/b9wNZw=; b=FY0Jo++zJGdotLlcZXMvJZs5+J2SpGH8xZ8AMe0ZX/YbviHsFcpnvHKt6yU0qsx9s9 0o+eHqA0h2kx0N/vgMOCmsGkJRVrzDc6S6Eq/cfmOzGDFOGF3p2CAChR0XOqlu2vd058 04v9FmWmXmRa3VVtOYUdBmujrG4mQQbxu4ZDgw528NOO2oT0zzpXmTUcvO99XPPb/4oE AmfPpgmWCAy2fgYPGMIPutO3qJ8FDokGMUtACO6ekzyqVZyZDkYnMhwdOx0xi/Y4w03S 4qUyX5xGtXBzdTNnyGtADaxIa7/qyyl6qjxrpRDurNgk12C0HeGiXUbBfmQ4zxRbnn8g c7zw== X-Gm-Message-State: AMCzsaUCbAUCtFKuC1YWyR+5qJSK3520w6Offgd4zVn9YszuVkxVD37u glYtEYTbfJSc3Nzusul0myeoW20nOM0= X-Google-Smtp-Source: ABhQp+TyArPzhvXOasw8QriDemhKjNrzykpIAuHVrym9p0fmE00CK+dSWqnNdC2ROdH7H+Tjh6GkrQ== X-Received: by 10.99.116.89 with SMTP id e25mr5800158pgn.383.1508541658075; Fri, 20 Oct 2017 16:20:58 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2017 16:20:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 16:19:53 -0700 Message-Id: <20171020232023.15010-23-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::241 Subject: [Qemu-devel] [PATCH v7 22/52] tcg: Use pointers in TCGOp->args 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This limits the indexing into tcg_ctx.temps to initial opcode generation time. Signed-off-by: Richard Henderson --- tcg/tcg.h | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) -- 2.13.6 Reviewed-by: Emilio G. Cota diff --git a/tcg/tcg.h b/tcg/tcg.h index 7fe0fb9e07..17779393a1 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -701,65 +701,61 @@ static inline size_t temp_idx(TCGTemp *ts) static inline TCGArg temp_arg(TCGTemp *ts) { - ptrdiff_t a = (void *)ts - (void *)&tcg_ctx; - tcg_debug_assert(a >= offsetof(TCGContext, temps) - && a < offsetof(TCGContext, temps[tcg_ctx.nb_temps])); - return a; + return (uintptr_t)ts; } static inline TCGTemp *arg_temp(TCGArg a) { - if (a == TCG_CALL_DUMMY_ARG) { - return NULL; - } - tcg_debug_assert(a >= offsetof(TCGContext, temps) - && a < offsetof(TCGContext, temps[tcg_ctx.nb_temps])); - return (void *)&tcg_ctx + a; + return (TCGTemp *)a; } -static inline TCGArg tcgv_i32_arg(TCGv_i32 t) +static inline TCGTemp *tcgv_i32_temp(TCGv_i32 v) { - return (intptr_t)t; + uintptr_t o = (uintptr_t)v; + TCGTemp *t = (void *)&tcg_ctx + o; + tcg_debug_assert(offsetof(TCGContext, temps[temp_idx(t)]) == o); + return t; } -static inline TCGArg tcgv_i64_arg(TCGv_i64 t) +static inline TCGTemp *tcgv_i64_temp(TCGv_i64 v) { - return (intptr_t)t; + return tcgv_i32_temp((TCGv_i32)v); } -static inline TCGArg tcgv_ptr_arg(TCGv_ptr t) +static inline TCGTemp *tcgv_ptr_temp(TCGv_ptr v) { - return (intptr_t)t; + return tcgv_i32_temp((TCGv_i32)v); } -static inline TCGTemp *tcgv_i32_temp(TCGv_i32 t) +static inline TCGArg tcgv_i32_arg(TCGv_i32 v) { - return arg_temp(tcgv_i32_arg(t)); + return temp_arg(tcgv_i32_temp(v)); } -static inline TCGTemp *tcgv_i64_temp(TCGv_i64 t) +static inline TCGArg tcgv_i64_arg(TCGv_i64 v) { - return arg_temp(tcgv_i64_arg(t)); + return temp_arg(tcgv_i64_temp(v)); } -static inline TCGTemp *tcgv_ptr_temp(TCGv_ptr t) +static inline TCGArg tcgv_ptr_arg(TCGv_ptr v) { - return arg_temp(tcgv_ptr_arg(t)); + return temp_arg(tcgv_ptr_temp(v)); } static inline TCGv_i32 temp_tcgv_i32(TCGTemp *t) { - return (TCGv_i32)temp_arg(t); + (void)temp_idx(t); /* trigger embedded assert */ + return (TCGv_i32)((void *)t - (void *)&tcg_ctx); } static inline TCGv_i64 temp_tcgv_i64(TCGTemp *t) { - return (TCGv_i64)temp_arg(t); + return (TCGv_i64)temp_tcgv_i32(t); } static inline TCGv_ptr temp_tcgv_ptr(TCGTemp *t) { - return (TCGv_ptr)temp_arg(t); + return (TCGv_ptr)temp_tcgv_i32(t); } #if TCG_TARGET_REG_BITS == 32