From patchwork Sun Oct 29 21:08:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 739069 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp846116wrt; Sun, 29 Oct 2023 14:10:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAdf3E76iS7d5ziw11+Rk9DlhBCV6g7d0VTOeCpAQZY8TyOcXuY/uXC666YELxhsjjBnvC X-Received: by 2002:ad4:5f8f:0:b0:671:49d7:6077 with SMTP id jp15-20020ad45f8f000000b0067149d76077mr5352812qvb.30.1698613800255; Sun, 29 Oct 2023 14:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698613800; cv=none; d=google.com; s=arc-20160816; b=ASNE3pbrVT3/68B/OdYKii/S0E5flY5gml0gAW/r3qujFgxwsJZ/g6ReN9670g0/Hp kteaU+zn1exyBr8mDPdsE4MHiUOIFeWjavNazIoQMA4oFCHINT7VwpMJd5Yrb55yjoJj t1cRn/1hulx90aJhSaeZldE2NRif6p4v22dm5Gr2ICx4cgqwHSKVSRQ1VQi929BO3sxh qmZq0n9XoYDai7gimqfjF4OH8W8YC2hvLD3u3TnnNm3odl+luujdzrh+vLFnjTFR1S9i VnLl5druwieUG/c/PCe6ekDXlgnKw4IRp41hkYkPSLwvnRQUH3KaQzpYTBamqls+clqJ CBMw== 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:to:from :dkim-signature; bh=yIEZ8p0+QQTNAMNRSoKjZTD6g/pQ7cEjDl2k36Rpcsg=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=bJ3UrOcoJLhC4x2QchvxhDXB1KgCgEtiFrMtPDqvMmwbNSPL04sLSdYMOMf5GYFXFf Nh53DdAR3t0Y2B7LLTso5as9lMB4M7xMrQ9127TvQWGsIFjSlepa4ys3Kd2woyyIpWx5 xpnVYuvmjlwhjgOhcFzqTbeNv4MDGXEtQqwZqykqyI4JIN4B27CvNcos4VL9ZdPW5JxE F1TOCKJDfkrK21+FyyUXT+gqHTBjy6OHL9wblUHjrb9YK77Qx0oTPSfEypIQK/trFjUY HYxSOclpSDmKYGaCTB6IfLHfm88IV10fc2MiSxCDYFkgUZWO32MY2C2o1xJHWBf67x8S keDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=laKdn6ve; 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 f21-20020a05620a20d500b00774067d659csi4323056qka.92.2023.10.29.14.10.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Oct 2023 14:10:00 -0700 (PDT) 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=laKdn6ve; 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 1qxD1m-0002f5-UY; Sun, 29 Oct 2023 17:08:58 -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 1qxD1k-0002eB-Dw for qemu-devel@nongnu.org; Sun, 29 Oct 2023 17:08:56 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxD1h-0005DT-3O for qemu-devel@nongnu.org; Sun, 29 Oct 2023 17:08:56 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6bee11456baso3188598b3a.1 for ; Sun, 29 Oct 2023 14:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698613731; x=1699218531; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yIEZ8p0+QQTNAMNRSoKjZTD6g/pQ7cEjDl2k36Rpcsg=; b=laKdn6vezn+fYpF1UmRR32gwJCXGPVIkUNsDDJbB8w+pAVZYLLkPUIfgFIV3Ar/lRN HCyqiTwNcIhuAgQ7nWbpYB4+ZNFx0qzaHEIDNLGmDTfBU7vefakgicYO1STnB8G5CeF5 0AB5dX5vb2IWA9FtJ6xTyQZa/H+coG62Dy0P2yneah0T9yb6WE9YcKcFtEH5YcRwqtsL sBZhkQO1HO0F5ZSU5nnZ6xFyoQqmsFWayU4UuLvdXUphcx7QH+0vhMJltcCwcxEkCrrk ssRzHGbItFoRnA1mcwMRe3jbVjnRqqy4n08jhIi475xMijMNidlFGF73+8/N5Y6wfoTa G9CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698613731; x=1699218531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yIEZ8p0+QQTNAMNRSoKjZTD6g/pQ7cEjDl2k36Rpcsg=; b=VQbkrOZ9XmmW9d1FXsJv8VybxWVN4nSXHzIFSXhTK5g2QZ9Mbtj9dgwuN6DAXxa9C6 9xEtMBqbs2FWOb64Ww76S/6eQlsV9wTHoiPkIc0FP5VxNXYAuoN4uaflR63PU4lOfCSp y5j/OArEIHEK1rVud5cQePqII+7eHyBzoNt1sRpR8OGXpY0eL3YkrxR/Pebp4azIH0Hm 83wBIX7l/sUufokOXyOCAdtTkmC6JBSGVsDvebT7auLZEFXIuGkxst+gqegDSgGvK4I1 BQ+EmNBXysFsLfYKWasVv2RbmQctMe16Bkmy1WQ0mihhjF/YPW58UsOiZdVZaLuiyP+7 p1xA== X-Gm-Message-State: AOJu0YxBTiQp6hG7Ub60Wm7Ab7P1ZpUqrGA7TlR+35xOueALdikqD8lG +RXJOaMODnVUxPQvx+b1BjTZ5p4A+I/SkIgZjNs= X-Received: by 2002:a05:6a00:2296:b0:693:3e55:59b4 with SMTP id f22-20020a056a00229600b006933e5559b4mr7569334pfe.8.1698613731512; Sun, 29 Oct 2023 14:08:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id z11-20020aa785cb000000b006c0685422e0sm4622847pfn.214.2023.10.29.14.08.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 14:08:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 01/11] tcg: Mark tcg_gen_op* as noinline Date: Sun, 29 Oct 2023 14:08:38 -0700 Message-Id: <20231029210848.78234-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029210848.78234-1-richard.henderson@linaro.org> References: <20231029210848.78234-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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 Encourage the compiler to tail-call rather than inline across the dozens of opcode expanders. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- tcg/tcg-op.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 828eb9ee46..9aed19e957 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -31,20 +31,26 @@ #include "tcg-internal.h" -void tcg_gen_op1(TCGOpcode opc, TCGArg a1) +/* + * Encourage the compiler to tail-call to a function, rather than inlining. + * Minimizes code size across 99 bottles of beer on the wall. + */ +#define NI __attribute__((noinline)) + +void NI tcg_gen_op1(TCGOpcode opc, TCGArg a1) { TCGOp *op = tcg_emit_op(opc, 1); op->args[0] = a1; } -void tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) +void NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2) { TCGOp *op = tcg_emit_op(opc, 2); op->args[0] = a1; op->args[1] = a2; } -void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) +void NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) { TCGOp *op = tcg_emit_op(opc, 3); op->args[0] = a1; @@ -52,7 +58,7 @@ void tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3) op->args[2] = a3; } -void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) +void NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) { TCGOp *op = tcg_emit_op(opc, 4); op->args[0] = a1; @@ -61,8 +67,8 @@ void tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4) op->args[3] = a4; } -void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5) +void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, + TCGArg a4, TCGArg a5) { TCGOp *op = tcg_emit_op(opc, 5); op->args[0] = a1; @@ -72,8 +78,8 @@ void tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, op->args[4] = a5; } -void tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, - TCGArg a4, TCGArg a5, TCGArg a6) +void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, + TCGArg a4, TCGArg a5, TCGArg a6) { TCGOp *op = tcg_emit_op(opc, 6); op->args[0] = a1;