From nobody Mon Feb 9 12:28:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1756224802; cv=none; d=zohomail.com; s=zohoarc; b=lLmw3A0l9yol3UhGTx0RkO4IpXEQ2LX6QOgTE7ZaAdWkmL+Mueq50RNkpP1W5q+6w7AEREPZ3Xqk0COWk38jfYFFY++g2tiAMnJ7buxi5DymHXloiBJG3qP4YC+E7JzW/vPVtRTz2T8MbCRtgZf4gT1Lvy4j4boZNQ2ySnJJgpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756224802; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=U/fzUvhJeb27HtSyKuJMiX4ymH+63mED0fuMX31N3yI=; b=Gk3Eu9BtBrSDBEv/u/nJNe75BrqtipzkIbp5VsgsRQZ1TeQ0EVau2pDcZwm6ML7cFHcNM6SiOds/qkIXwGfcOcpkCSgINtbHTB8Or/qE8VftRzy4GJPoISe3XniO7YrrKa7+Cw35mdu1kNXW0yGMrRSof53G84gWdAchyLcqWwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175622480235042.04812139862349; Tue, 26 Aug 2025 09:13:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqwH3-0003tZ-Of; Tue, 26 Aug 2025 12:11:53 -0400 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 1uqwH2-0003se-Dr; Tue, 26 Aug 2025 12:11:52 -0400 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 1uqwGz-0007po-Qd; Tue, 26 Aug 2025 12:11:52 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-325393d0ddaso2849008a91.3; Tue, 26 Aug 2025 09:11:47 -0700 (PDT) Received: from ktock.. ([240d:1a:3b6:8b00:561f:1400:11f5:714b]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-32750bc341asm1749747a91.19.2025.08.26.09.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Aug 2025 09:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756224705; x=1756829505; darn=nongnu.org; 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=U/fzUvhJeb27HtSyKuJMiX4ymH+63mED0fuMX31N3yI=; b=LAtPYz1iBywP950XD0aSBqahHhZggcqGkEDX3EMYp6dsH1xJd32LaNb3AYqwe7GuuK vQV8JwsV3cnw/8yfdstmXkMrzNc/qhSs20EZJ5etzyDZIl9D3ot5RGkhb2Eaxl8difZQ aDDQ0ylam1W8uulW4ccbEntly23KJERLSFb9LexjkfJmiQffL/wHddHmXhvLRu45SRDL tRk1YbGbcthflU3pr3c77L61vIsTuhoVdIE5LRstvsMf1ScdUcrWq5/3r03XO9bDE7ku c5EASeFPGdgc+Glwop/qM2/CFQtBgIq3s56uDkamhjujIc69xKp3HWXeujJVRbZCzDV0 EXyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756224705; x=1756829505; 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=U/fzUvhJeb27HtSyKuJMiX4ymH+63mED0fuMX31N3yI=; b=nC7iu1pT/XLqd2FYbGh0XRVLr1fo9EDlr5Z9AqR4NZXbxEeu9rz6lPEsU0AIxlPIc6 zET9xWkDLIBw6v1DmNd/5ixBdHMXpxHTxzJUkwmho4JtUPM4bqHMQ5SmT/lMF3xx7O3V 2TziB4qB/ymxCH6B91j/2y2ywTG5uu5UMBCJMLAdig0pLErQw5ZPZsu4m+d9QHGnzY8K X1XhFBIKavbaKGux4yAdZoFIePDrHc07gtX2do0R4zEuKB9iNA7UExDS1eI/N8h6NB+D fDwoM4mszgUuAPM2jFr4+2sBCAOuycPoyfoc06Jo8tUMZ81Ub7CuXemO0WkHNrFcwxYV 5Rbg== X-Forwarded-Encrypted: i=1; AJvYcCWngcEAhbAAXypVWszrWG9OikTKgpFTbfgn4Nak1Dhd6XG40W2moPG9JZ9/VyblLf+fFdvD5nzSh3USBQ==@nongnu.org, AJvYcCXDjJuxOQOjvVtdTt1Xu/Z22hGWzEKAnytXJNB3HASAgDbH8NV3dk3MsuIe8iR07IDkjXp2t4Lptw==@nongnu.org X-Gm-Message-State: AOJu0YxvJq4H409NLTvm+kUIKdmYrPOZQwpUjQtXXajIeu66ATnLykV+ wBqW+QSWrWxn2iyqA07iqE4K2hbEK04Y/m3BPcvW204k5nlMPmzb5U2kZPIVEA== X-Gm-Gg: ASbGncsdeDyAsrf5sRtg7EzkZKaFD88f9u9fK7yT022PNDZGk78wvS9ogpeR2BV9qxt av6WZpHM5LWSkzPv3QoJhAQehwshl4F8FKLLNLkYVAnRLlT0IBnGrTF89ilBO26F9ilmuo70wVT dkhTzEy6Bn7BgUVI8SBZK6xUN6oAL5m0PHfrDwOv2bPvbEv5Dozxmy7085f0Z8v1Mz4rc5vq2W5 IbW7fbIDT68G+kfs586IJ1zQhKCkG9cqphzxBxTFtLt4J6QI9dOCaCOvrG75lCVq2NHM3nByi46 z8Cusr5pQTOVMyxITD2g9B7Pygz3RU1WHtG7weYqmCaUQvGqFy2Z2cAZb//JI+dSXtw2Gmwsnza 3CWWJWwgPXN0QURVw2m9/rw== X-Google-Smtp-Source: AGHT+IGZxEaqTQRXGPWF9FaWy38eYlIdt17yPJKSFFyS/6cuD/InjA9HI50yt14P82OhG7aAL/TnjQ== X-Received: by 2002:a17:90b:1fcc:b0:327:6823:bfe with SMTP id 98e67ed59e1d1-32768230e60mr483310a91.8.1756224705261; Tue, 26 Aug 2025 09:11:45 -0700 (PDT) From: Kohei Tokunaga To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , WANG Xuerui , Aurelien Jarno , Huacai Chen , Jiaxun Yang , Aleksandar Rikalo , Palmer Dabbelt , Alistair Francis , Stefan Weil , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Stefan Hajnoczi , Pierrick Bouvier , ktokunaga.mail@gmail.com Subject: [PATCH v2 06/35] tcg/wasm: Add register-related definitions Date: Wed, 27 Aug 2025 01:10:11 +0900 Message-ID: <1582a3fb83f9a0f12a988bc159319362f69676e6.1756216429.git.ktokunaga.mail@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=ktokunaga.mail@gmail.com; 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, FREEMAIL_FROM=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1756224805169124100 Content-Type: text/plain; charset="utf-8" This commit adds the register allocation definitions and register names to the Wasm backend. As in TCI, call arguments are stored on the stack buffer and the return value is placed in the registers R0 and R1 when needed. Signed-off-by: Kohei Tokunaga --- tcg/wasm/tcg-target.c.inc | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tcg/wasm/tcg-target.c.inc V2: - Although checkpatch.pl reports the following error in tcg/wasm/tcg-target= .c.inc, this file is based on the TCI code so it is preserved as-is. > New file 'tcg/wasm/tcg-target.c.inc' must not have license boilerplate > header text, only the SPDX-License-Identifier, unless this file was > copied from existing code already having such text. diff --git a/tcg/wasm/tcg-target.c.inc b/tcg/wasm/tcg-target.c.inc new file mode 100644 index 0000000000..3affc17232 --- /dev/null +++ b/tcg/wasm/tcg-target.c.inc @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2009, 2011 Stefan Weil + * + * Based on tci/tcg-target.c.inc + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +static const int tcg_target_reg_alloc_order[] =3D { + TCG_REG_R2, + TCG_REG_R3, + TCG_REG_R4, + TCG_REG_R5, + TCG_REG_R6, + TCG_REG_R7, + TCG_REG_R8, + TCG_REG_R9, + TCG_REG_R10, + TCG_REG_R11, + TCG_REG_R12, + TCG_REG_R13, + TCG_REG_R14, + TCG_REG_R15, + /* 2 of these are call clobbered, so use them last. */ + TCG_REG_R1, + TCG_REG_R0, +}; + +#ifdef CONFIG_DEBUG_TCG +static const char *const tcg_target_reg_names[TCG_TARGET_NB_REGS] =3D { + "r00", + "r01", + "r02", + "r03", + "r04", + "r05", + "r06", + "r07", + "r08", + "r09", + "r10", + "r11", + "r12", + "r13", + "r14", + "r15", +}; +#endif + +/* No call arguments via registers. All will be stored on the "stack". */ +static const int tcg_target_call_iarg_regs[] =3D { }; + +static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) +{ + tcg_debug_assert(kind =3D=3D TCG_CALL_RET_NORMAL); + tcg_debug_assert(slot >=3D 0 && slot < 128 / TCG_TARGET_REG_BITS); + return TCG_REG_R0 + slot; +} --=20 2.43.0