From patchwork Tue Jan 19 18:34:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 366210 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1058173jam; Tue, 19 Jan 2021 11:34:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyqD/5DuXmCZE/MtI4ibN5Hnk0W+FVkOOXFiTNLCS6OqbWEKvHLJRvQS6HDj6Bjrw6g3t3 X-Received: by 2002:a25:254e:: with SMTP id l75mr8329598ybl.110.1611084848881; Tue, 19 Jan 2021 11:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611084848; cv=none; d=google.com; s=arc-20160816; b=nQORPWhizrdaZY7yJVtPvPOV84XYb7nVFbWbJBUTBg2n/qDio0hitcsU8Iq+lTHvhC qus8IynB7VSCYR+c9Eog/B5x8DHBIdiyQ4HlHSQCt5JLKY7Squ+kJ44y8QqSthFLWE4e G0anNBKmwYok+MwRTuoCMEJFOJ9xl/X5Z59W1zE4ygRP4US+NbCLaEfcu1J5jqOqCM1X RTNoAPPe6lDf4TRF/iyNoCv01l+c+qGoJYoqdVBRb5VL+giXK6M0L40fmu715rsshOwT j1r1L9Zd74eBgGfNNwQ7uwnKYQerIFhoEwLkHAbN6OF3tKpyBze25mJPzx6tZW0u7irF oSYA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Lb0UT912r2GMFw/dFnRGb/nKNqr4nsQ4gGmPTzEJSYY=; b=h9pP8gcr8wu3C2YlO+8zgnMqODTyf1McOx59n6ZP3FYriOxiND9VfzoKUU5IG3S1t0 ++EJAk6WmOvzHBJROXHqgN9IPHf4pugDW9DDEEA9wmXHtXSWvIHyp2JtHerIaDv4RD2v jihrmX1Ps5ayQeduYT2RPcrxKoQmxGl1YYsTVHP1A0Z7mSskIwI4lNVvlm6geWQPKcs7 G2o+6hjEnJPFGOKCQSGoRPQIVTd36GqDzFJuL9XtZL+sEuRFXA5+uHrvgygUMNzod/RM 9reUiNr30HL9RSuz5PK58bL8LF+AWTx3V9yWL7OmfK8dRT8S6DyEM0N4oxsDmrcdujmi 4SUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AAQqhaRB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id 186si21881618ybl.414.2021.01.19.11.34.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jan 2021 11:34:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AAQqhaRB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:37024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1wlU-0000vo-Bw for patch@linaro.org; Tue, 19 Jan 2021 14:34:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1vpt-0002Yw-67 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 13:34:37 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:36237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1vpr-0001Fe-2o for qemu-devel@nongnu.org; Tue, 19 Jan 2021 13:34:36 -0500 Received: by mail-pl1-x630.google.com with SMTP id e9so6849823plh.3 for ; Tue, 19 Jan 2021 10:34:34 -0800 (PST) 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=Lb0UT912r2GMFw/dFnRGb/nKNqr4nsQ4gGmPTzEJSYY=; b=AAQqhaRBRmkAucA1zbvkxQyFlt6CE4BV4cC6Uc9nJnaPWQ+3srAyGJyEQp8ulLSzmM JlUg/aXBp5mwwhXzDddV+79+6jbSkyooHy4QceB/dxPC7bawU1N80pYCa+oBx+wdC24B 1JbMLGlqb+z/UvCbJqjVFRnZcp4bk3DT4SPxjIHmt10aMY1ms/UegkjZ04E8PYCz4Rz+ V6NcJ+8Ef/sA5jTOsF5G58Dr/u/j75f33b5qLGJsKwGqCmfzbpkeJSLcCafmAktqGOJ/ GEu1MUA+ZNu01q1+tUPhD8+IMkoFyi6rqf0SP4tlzF4hkZvnW2cvBZ0+AGoR1JITRmDT t2nA== 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=Lb0UT912r2GMFw/dFnRGb/nKNqr4nsQ4gGmPTzEJSYY=; b=EnydheSkl+FX3z12oURM1WleYyn+PTS6xz0cPG6IjlSBD+4tGQ8hVU1QRlSo/gNQL3 InK9oKvyzLKar4KAImOicbEtQiI2Lp3JAhONO/gVxXAl0Xj3b2IlZfB1e7+Fasegmyss RXklByME9NdjQvvO+YSVk7zdbBguRVqlkc2gEUx7NMkBfN3MoDODb41NAjTWdN1R18i1 lYwskRWylFy2mnZbWGDVPbbW3JFUuhch8P4HOurcEw4FwJ5IuGWG1uLIeM1VLiW/Xrde N+agWfSXnpKBRc4sPJRNGMld07RFIgsiQDsPDeGk47sGUaMsC41x0XYjVW+zPTC753dU Y5Ew== X-Gm-Message-State: AOAM533ZoHymJuRUnSXQ6P+i8z/3++LKK46SqScQLmBgSynQ7h5odllV RRBLbJMsl/mEl2lRPv7oOY+h1QyHkHnXsQ== X-Received: by 2002:a17:90b:8d7:: with SMTP id ds23mr1120143pjb.116.1611081273549; Tue, 19 Jan 2021 10:34:33 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id a136sm20651359pfd.149.2021.01.19.10.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 10:34:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/5] tcg: Add an index to TCGTemp Date: Tue, 19 Jan 2021 08:34:24 -1000 Message-Id: <20210119183428.556706-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210119183428.556706-1-richard.henderson@linaro.org> References: <20210119183428.556706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, alistair23@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This allows to break the tie between the memory location of TCGTemp and TCGContext->temps[]. Which is the first step to allowing the array to be reallocated. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 5 ++--- tcg/tcg.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 504c5e9bb0..5ef644ceae 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -497,6 +497,7 @@ typedef enum TCGTempKind { } TCGTempKind; typedef struct TCGTemp { + unsigned int index:16; TCGReg reg:8; TCGTempVal val_type:8; TCGType base_type:8; @@ -721,9 +722,7 @@ static inline void *tcg_splitwx_to_rw(const void *rx) 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; + return ts->index; } static inline TCGArg temp_arg(TCGTemp *ts) diff --git a/tcg/tcg.c b/tcg/tcg.c index 8f8badb61c..4a8dfb8f67 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1204,11 +1204,17 @@ void tcg_func_start(TCGContext *s) QSIMPLEQ_INIT(&s->labels); } -static inline TCGTemp *tcg_temp_alloc(TCGContext *s) +static TCGTemp *tcg_temp_alloc(TCGContext *s) { int n = s->nb_temps++; + TCGTemp *ret; + tcg_debug_assert(n < TCG_MAX_TEMPS); - return memset(&s->temps[n], 0, sizeof(TCGTemp)); + ret = &s->temps[n]; + memset(ret, 0, sizeof(TCGTemp)); + ret->index = n; + + return ret; } static inline TCGTemp *tcg_global_alloc(TCGContext *s)