From patchwork Thu Jan 26 04:37:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 647063 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp58822pvb; Wed, 25 Jan 2023 20:42:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyb/WjT3cYjjdzNy2uflu+Ty6oKCcA4Z2XqwpfotqceL6OwVdMTrmoqhj0YDdYUI4ORr5k X-Received: by 2002:a05:622a:4897:b0:3a5:3cb5:2485 with SMTP id fc23-20020a05622a489700b003a53cb52485mr58291814qtb.0.1674708166391; Wed, 25 Jan 2023 20:42:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674708166; cv=none; d=google.com; s=arc-20160816; b=VqlnYFtQy32rw1ft/3VZzOJ1eQRWDfq9Z6xV03FlzEEy6ThKb9m+R6L/pctEpvzdVc ejnwSbL8kvwoQ7Tcket9W5lpxtvIrwbT+HW3Jn64Tg03xAxlOC/H6qkcy+0nS84vdWyM ihHEt+xFQ5xg8hqmqIPltveG6KNl1iCmR+QRdaMeaJdv17JfwkpzCtPW5ZyS0cSSf5Na zWXBVIM9TMcWPpngt6ukduP/y/5cgOgHRw8PQMEBkjVkhgVG5rPuPjSoMKtH1Ly8aEEn vwwaCFDTPJCa/grGKN7of33xjbDe6va7M6o3g2H3uMuyfjwtm6VfpIw68oD39j/YJfks +B5w== 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=P9o9Kqlm4R8WHQAINVfaYH28J5DgA1McwtQxHNZ+nmQ=; b=DKfZYnIwKVI8XARGMFseJGKLenYwCeujXOrk7aYdAOg7c6TRpxXIWxARgan2yYEokL siCGDkL1Z2hdR3evH2hkDsOJP0SSUhOC478Cq6XJqKV36zy1s1h+aHWek7ftQoNyEYPn rUVK98JUS7ZDlncbPa6xpv8EkHHmwQcpZn/uVqnF8IdalEbbN6KnuiI0MsQHdV8FdsVN K7fzMYYU77NNbxosrUnUspKwBNDHGuOiKKzNFTX4q4iOdT3yyx+CXeckRVPpgqrO2Bvb i8a0fL+Y9D6k7hjX/C3ttTWdbTgT2sPWWty2YJt4vFpxoUTiEo5JxecF8SRLF6j9/uKL hETA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+6TR3Wy; 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 c3-20020a05622a024300b003b6461eaff1si122980qtx.553.2023.01.25.20.42.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jan 2023 20:42:46 -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=i+6TR3Wy; 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 1pKu27-00007y-B9; Wed, 25 Jan 2023 23:38:43 -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 1pKu23-00006N-Gd for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:38:40 -0500 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKu21-0004OR-TW for qemu-devel@nongnu.org; Wed, 25 Jan 2023 23:38:39 -0500 Received: by mail-pl1-x636.google.com with SMTP id z13so912795plg.6 for ; Wed, 25 Jan 2023 20:38:33 -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=P9o9Kqlm4R8WHQAINVfaYH28J5DgA1McwtQxHNZ+nmQ=; b=i+6TR3WypDeSkb5T1+LwAjTNom+Yf8SM7IBIzWXbFHMZuYkBnP43Ni+tfT+MDvQVZw wf7tg0OkDXu3kbWEDxlB3hpvyuUxY9HMEjp9q2JIBm1tCbXYMOsO3eBjr3dn1qTYncOd Y+/mQiRwfH7lg8GfcEyCeuxjqxnKoPdXTNneCv4mxqdPfiaCKqqQ23NteAziPHLyI1pm zAE5TZ7Sry6FXEa0M2JpIqy2g/sZUGoFYNhTdzR7YbytPGcrKOYAdt3noYeXvU4aRA9U VFbnBTMcLYtRPiSy26rSS0RN9vtxWhI5c+0ScKM6rsU412qag9S/SLFEoduDhKtgwzr4 f4jw== 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=P9o9Kqlm4R8WHQAINVfaYH28J5DgA1McwtQxHNZ+nmQ=; b=HN1DMQLn6jnQyxtjW6yI7OXOqOBf6AFVzmBpX2XmwBjzcuCF6Wr0f+xPjcOYNK3DuY eu/P2gPIbDZxMsRtSwHy3AENeXlul5V1pmcnc2pIk3t4hfpxga8o65Na8hnvF6DMBRQ9 N0DEEYHKGyCJaKYJzJCV3L0UnZqsWHOQTphaEIzcV3sdi3uWcOA7J1hRvR5nSb8wbNl7 aM26l3sZXmt32CEX574NFC2vjwnaB/k3zvEXKI2A8VoQEUbh/Li25SgzbdYSHms/mIUU NbHKsBJ5JPKe3pPFI2UrTDdNjEip9fM23c821N/YHSD0jeKArApCITKoP9EWecfliQZS Nk4w== X-Gm-Message-State: AO0yUKXPU/WzBHrD/JGFtEYhjtEPKJkCOZfhhEUISzzVcb+NzbdLALX9 ecscLtBqAA2RqD9JhCDTIHVLVMK9ZnXnTPhSl4c= X-Received: by 2002:a17:90a:1da:b0:22b:e2ef:6845 with SMTP id 26-20020a17090a01da00b0022be2ef6845mr10552033pjd.41.1674707912408; Wed, 25 Jan 2023 20:38:32 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id s62-20020a17090a69c400b00228e56d375asm233376pjj.33.2023.01.25.20.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 20:38:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org Subject: [PATCH v5 03/36] tcg: Allocate objects contiguously in temp_allocate_frame Date: Wed, 25 Jan 2023 18:37:51 -1000 Message-Id: <20230126043824.54819-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126043824.54819-1-richard.henderson@linaro.org> References: <20230126043824.54819-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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.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 Reviewed-by: Alex Bennée --- tcg/tcg.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index ffddda96ed..ff30f5e141 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3264,11 +3264,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; @@ -3299,13 +3300,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[]. */