From patchwork Sun Jan 8 02:36:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640343 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1517457pvb; Sat, 7 Jan 2023 18:40:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXskwiBaj4Zjqn81xpKE2sGQG51Y2Lr9Yby0WWKm9/0gB1s7Aj/rGrxh9AVQA3mAHuPNe90s X-Received: by 2002:ac8:4c9a:0:b0:3a8:cfb:6e9e with SMTP id j26-20020ac84c9a000000b003a80cfb6e9emr82253542qtv.65.1673145625067; Sat, 07 Jan 2023 18:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673145625; cv=none; d=google.com; s=arc-20160816; b=dS7fgCJIeNRHl9EQkrwmtuS0cgvpcRfA8+7IKzylcaFMk5gglicHoz+aPtT+iodgHI ZWohrtslxtzPVPcpAuHnzHL98lQrXUmS9vHCCk4dUJvKmaW2eEF6muXMnawVZEcni13T uovBdc4/a0eL6kVlNj0CqldR+tZUpRaivQ9v2nmEwQ30iHorGondsqhiAdUQfV2MU3Mg +VTQU3UFLiFhRi4ICTVrAwvKrGgh6N8DtsojhXOG1bEHfNjT/Wsi1ZP2uzUoCufWzGJY Ueg5VvIQcpmip+gP2ZHGl/TmDr1amKC3MxXxQw+GG33x/7j+GnkSKauiV3B86JDIfPyo Tp5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=ie3FlFBACJeq4X/M6VQiwe1m8Ml1Kbx+Yprz1q0XbrA=; b=vMfzDQz3JRJCpKByDq99ZIVvyo7dSt3xhgI4BhKDrr7VSq50GhRQJGlT+VFXxDXodR znz9hfyzFyu+65Z0DQMj9s2qsx8T/lb/ty8pCvNvIPRsbf6ok2mZpSQEyaxMbKYthZ6I 2RU4I39HYjADkr0zHVxeIIlYVkXdV9IlURJtbLPw3M9c+V1uj2UgLPk/2WhhLxaJTmiI /kfbdM9+osij6QlKgRUdjGwTEIZIk9VOVPJ9XS6ERH+y/dCjOQM+x1gBFqz+b4S4HLx3 zoLX/ElH0a7WEWWe3frFedFFNknSx4Avd6s6e7WQ7NUzxVwaiUc3HQSmoiGy+He5Rfei Ll1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z15r7KZx; 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=pass (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 bq26-20020a05622a1c1a00b003a55b624080si2781244qtb.48.2023.01.07.18.40.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jan 2023 18:40:25 -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=pass header.i=@linaro.org header.s=google header.b=Z15r7KZx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pELZ4-0004ga-Tn; Sat, 07 Jan 2023 21:37:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pELZ2-0004eb-Ho for qemu-devel@nongnu.org; Sat, 07 Jan 2023 21:37:36 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pELYs-0004Vf-37 for qemu-devel@nongnu.org; Sat, 07 Jan 2023 21:37:36 -0500 Received: by mail-pj1-x102d.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so8701099pjb.0 for ; Sat, 07 Jan 2023 18:37:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ie3FlFBACJeq4X/M6VQiwe1m8Ml1Kbx+Yprz1q0XbrA=; b=Z15r7KZxo6FKWk9NQI5CRhE+8/7Y/WGTW39Y29D4hKJUkIKkC6fUGY6fDsLJ8Uj1OJ 4mkSehnvjsUrwpkvvSOFrB4ULe04PPEt3eE3rSS805ppw6s3/6g8JHQ+31MHlEQx5kBb dRB/QdEIL49sKWQYZNzMtgInpZdQdeeeq7pkejuZNfbUS8YNAZCEswSTW4IuCvt6DEsl nOpvnNbv1DWAwEycMigmUBmJmYJNKN1eJiL6K8HHZfAYtBWVmnJRduLAIEegXGE1qY+U Sh9HdkSX4qeIbwI34dmRNaKjKuBbGOQn9t7zVOAxGpOtYz/oj5b5pSXEsvyJl07ruErH HaRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ie3FlFBACJeq4X/M6VQiwe1m8Ml1Kbx+Yprz1q0XbrA=; b=Q/tkWuuVasRT/B43OZKYnlmw65/at53hnkiMcxAziANges688VIY7wjdU8D87WMZvU QSJC79DPcsj/JxCaa40JW+0T14xtnztYFeCfkGdTeY6Hlvhek1/SPB3ibXFM04sL/UVC ja7Op7OJPu7RJoUy53ve5o1+m6NRR2CWVYvfsBv5GktZA3dM6wXetgEItq/GlZE/tGkz uH49BB0hDWgYTfDb36BOWRBSEFArRyFdCaeHgfpT3uPvf+vaD+PoEj3RMB8VGJS4rrf8 gphzsLfrv0woZJk6+yKNYLHxX9mlNs6s8vsXHd9hRd19/4qZJ6DjojVeFTWQn7XYVQz6 GG5A== X-Gm-Message-State: AFqh2koJLhN9OO1grfZgHeNP2kIbrqLtWlgFcSjJTNmlBNYxVIjcIVuO CJ4U5GtdQJPQHlhdgSjLfj9I7XKRe+rnXMj0 X-Received: by 2002:a05:6a20:a584:b0:ad:a5fd:b664 with SMTP id bc4-20020a056a20a58400b000ada5fdb664mr68551943pzb.37.1673145444802; Sat, 07 Jan 2023 18:37:24 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:8a2d:2011:f402:6f82]) by smtp.gmail.com with ESMTPSA id o17-20020a170902d4d100b00189d4c666c8sm3394775plg.153.2023.01.07.18.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:37:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com, eduardo@habkost.net Subject: [PATCH v4 03/36] tcg: Allocate objects contiguously in temp_allocate_frame Date: Sat, 7 Jan 2023 18:36:46 -0800 Message-Id: <20230108023719.2466341-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230108023719.2466341-1-richard.henderson@linaro.org> References: <20230108023719.2466341-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When allocating a temp to the stack frame, consider the base type and allocate all parts at once. Signed-off-by: Richard Henderson --- tcg/tcg.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 99e6e4e1a8..7e69e2c9fd 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3242,11 +3242,12 @@ static bool liveness_pass_2(TCGContext *s) static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - int size = tcg_type_size(ts->type); - int align; intptr_t off; + int size, align; - switch (ts->type) { + /* When allocating an object, look at the full type. */ + size = tcg_type_size(ts->base_type); + switch (ts->base_type) { case TCG_TYPE_I32: align = 4; break; @@ -3277,13 +3278,26 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) tcg_raise_tb_overflow(s); } s->current_frame_offset = off + size; - - ts->mem_offset = off; #if defined(__sparc__) - ts->mem_offset += TCG_TARGET_STACK_BIAS; + off += TCG_TARGET_STACK_BIAS; #endif - ts->mem_base = s->frame_temp; - ts->mem_allocated = 1; + + /* If the object was subdivided, assign memory to all the parts. */ + if (ts->base_type != ts->type) { + int part_size = tcg_type_size(ts->type); + int part_count = size / part_size; + + ts -= ts->temp_subindex; + for (int i = 0; i < part_count; ++i) { + ts[i].mem_offset = off + i * part_size; + ts[i].mem_base = s->frame_temp; + ts[i].mem_allocated = 1; + } + } else { + ts->mem_offset = off; + ts->mem_base = s->frame_temp; + ts->mem_allocated = 1; + } } /* Assign @reg to @ts, and update reg_to_temp[]. */