From patchwork Thu Apr 4 23:05:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 785841 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp1073766wro; Thu, 4 Apr 2024 16:06:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW1YzRN7NvDC2r8rKZB5D4YZBCGLmqgv1lw76ECKLkIqVXGkgBHCX8LAzNboqZ7BGIFlcIsi9krrWlRtgQKsUrX X-Google-Smtp-Source: AGHT+IFVibe5H8VezaKixMKwbDdBF5M/2SdnQjj7kP43DytdFAj8UvNW63dGRLw3nPqdLEurJiPC X-Received: by 2002:ad4:596a:0:b0:699:209f:285a with SMTP id eq10-20020ad4596a000000b00699209f285amr4062496qvb.33.1712272018816; Thu, 04 Apr 2024 16:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712272018; cv=none; d=google.com; s=arc-20160816; b=WJzsrQ/nrzuDfFln6jeLJj3F1cfwsnyseqlROFTJllPPlf+1Ze8ooXpTGe+UIhJ/or oYZV88HB6TLeTeZgbiIpb+P1jFftziMsx1eNyxCYlhENm8yd1hqCBGQOdXxFFp0wwujH YxKwqi7Bc+IdS9x9i0vaRflXFntobD+bK10/79Qu9Ft6tUBOaMD0yiRrr6YzP41KNbha 2+HKOoF2nDraqkNC90jYFYxaY2TS8gcxIv48NZPA1yD16r00qy4iAi+v0+yFApc82xET uAKbM/JPyvffwB7CmzPu7aFjHaOQU7R37gXqg7sBlIKVWRWZe4akjASd/pu2Tt8aGrg/ 1k9A== 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:message-id:date:subject:to:from:dkim-signature; bh=Rr1mCO1Um6MwdRz3KPxmuXvDuPkKMy5I80GI3tAWlUQ=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jLsLBjq/rhTJp47Xyh7M8T6MJUs/xr2+qFDz3R+OVAjC8PJkjCLh8/0OADnO6b/bL1 BYBlFQZnrPnxqqtUpl6eX+L5+y1lTHtDg5DW75YnWt3cZQMyvdpCDi+X2u2aFyU0cEvu zFsMzclNj9fgmI5AHkJa6f6gEtB21QJXqF6LxLGtU7s5RFKAF8CqWErMkfpakYy+nI9M aIXDq3wvrh/yc+mIV2vayWMPSDNlEJk8d/GnvHrAzQgP6WK+19orEiwj2IuXasgoL7zb uLq5Rp45HmDU56YjrCGPjFzpKzVwJqBNb1ANAZFRSAKIWn8s4A4r5uDxUtepN9Koi6Vk wrsw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="H/4Rdsc9"; 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 ec19-20020ad44e73000000b0069939e5fc80si395182qvb.541.2024.04.04.16.06.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2024 16:06:58 -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="H/4Rdsc9"; 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 1rsWA4-0001zx-TS; Thu, 04 Apr 2024 19:06:24 -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 1rsW9y-0001z7-Lm for qemu-devel@nongnu.org; Thu, 04 Apr 2024 19:06:20 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsW9v-0007h7-Q7 for qemu-devel@nongnu.org; Thu, 04 Apr 2024 19:06:18 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-29fa10274e5so1050344a91.3 for ; Thu, 04 Apr 2024 16:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712271974; x=1712876774; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Rr1mCO1Um6MwdRz3KPxmuXvDuPkKMy5I80GI3tAWlUQ=; b=H/4Rdsc9jW3ewKGxn0ARmAgZV5UdFW04qx8m2CsR6FWoiCjm2/ki4yu/H4lvZF8EVm yn/vHkAP2bjXM08EWXxDho+knAlXgLo97ehnP2nOHHkK34Ia7EcEGKuXiBktmn8uz4Zr 9cX1jhq2fBiyigGzODFzYCeMnLBWqecubchbIj/F2JNDgdKHPqN6mI3pCH6kOQFXSh/V nMU3QfYBQm3A82IC4a9HPz2xeHBmm+7Nok88CyC/tLoWR+gUnmeG/YHgDavFe5KbpZpX o9WLwkRf5HgfGzBYbRLwefpvTXOQCDB8EW8VLN+l44OWR8tmU+LNv7EDOhnb7QaXunyd HCTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712271974; x=1712876774; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rr1mCO1Um6MwdRz3KPxmuXvDuPkKMy5I80GI3tAWlUQ=; b=Wvu79BxLLZHyWwNW8aoB7r5/mRZ+Bz6e70mcsvImcEIKT2hrAUUeH5TzCxhIa/uQqR 83pBTNkIvF+dnudMuJ8j7QexBrUThAbZif9JWEq4ZjpSQX4WaX/IOKUroqIkr9grrmO7 +cMg+x7P0aILgFOzd3/syteLF5QuGDJUdpebCPKGd+ysNQx93d0oYyD456r72m1PxsP8 XBAT40K3MbPaNy1Q9pCb00BFfklDQFbUS1CsVd/doRIrS5gy8ED5wmIaxcfk2CWNb1bd V7iwNB8CexT9frCF1ba6OAmA8Fl60HG6eAD4THtXqgFiY00yxyURyX6LRL5s0JbSaVDd P+mQ== X-Gm-Message-State: AOJu0YwgPeIZIPm5C2GtyvL25tWiLS4n4mhB8U3lh+vXB6kefrSe9wNO a2Ujq+dg7wPjIEAUpXg9gQ+o4DAeyI9KuRDm+bpIUE0INZ2JpvX2IO5PlOVgRAJC3laqSPWJN/D 6 X-Received: by 2002:a17:90a:f008:b0:29d:f0f4:1e63 with SMTP id bt8-20020a17090af00800b0029df0f41e63mr3762116pjb.39.1712271973794; Thu, 04 Apr 2024 16:06:13 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id q36-20020a17090a17a700b002a2f3cfc92asm1052592pja.16.2024.04.04.16.06.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 16:06:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 00/21] Rewrite plugin code generation Date: Thu, 4 Apr 2024 13:05:50 -1000 Message-Id: <20240404230611.21231-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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 Add a (trivial) mechanism for emitting code into the middle of the opcode sequence: tcg_ctx->emit_before_op. Rip out all of the "empty" generation and "copy" to modify those sequences. Replace with regular code generation once we know what values to place. Changes for v2: * Fix TCI build failure. * Drop qemu_plugin_insn_cleanup_fn movement; I have another plan for that. Patches requiring review: 7 and 8. r~ Richard Henderson (21): tcg: Add TCGContext.emit_before_op tcg: Make tcg/helper-info.h self-contained tcg: Pass function pointer to tcg_gen_call* plugins: Zero new qemu_plugin_dyn_cb entries plugins: Move function pointer in qemu_plugin_dyn_cb plugins: Create TCGHelperInfo for all out-of-line callbacks plugins: Use emit_before_op for PLUGIN_GEN_AFTER_INSN plugins: Use emit_before_op for PLUGIN_GEN_FROM_TB plugins: Add PLUGIN_GEN_AFTER_TB plugins: Use emit_before_op for PLUGIN_GEN_FROM_INSN plugins: Use emit_before_op for PLUGIN_GEN_FROM_MEM plugins: Remove plugin helpers tcg: Remove TCG_CALL_PLUGIN tcg: Remove INDEX_op_plugin_cb_{start,end} plugins: Simplify callback queues plugins: Introduce PLUGIN_CB_MEM_REGULAR plugins: Replace pr_ops with a proper debug dump flag plugins: Split out common cb expanders plugins: Merge qemu_plugin_tb_insn_get to plugin-gen.c plugins: Inline plugin_gen_empty_callback plugins: Update the documentation block for plugin-gen.c accel/tcg/plugin-helpers.h | 5 - include/exec/helper-gen-common.h | 4 - include/exec/helper-proto-common.h | 4 - include/exec/plugin-gen.h | 4 - include/qemu/log.h | 1 + include/qemu/plugin.h | 67 +- include/tcg/helper-info.h | 3 + include/tcg/tcg-op-common.h | 4 +- include/tcg/tcg-opc.h | 4 +- include/tcg/tcg.h | 32 +- include/exec/helper-gen.h.inc | 24 +- accel/tcg/plugin-gen.c | 1007 +++++++--------------------- plugins/api.c | 26 +- plugins/core.c | 61 +- tcg/tcg-op-ldst.c | 6 +- tcg/tcg-op.c | 8 +- tcg/tcg.c | 92 ++- tcg/tci.c | 1 + util/log.c | 4 + 19 files changed, 417 insertions(+), 940 deletions(-) delete mode 100644 accel/tcg/plugin-helpers.h