From patchwork Sat Feb 25 08:59:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 656457 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1352627wrb; Sat, 25 Feb 2023 01:04:17 -0800 (PST) X-Google-Smtp-Source: AK7set9AZ4DKSXZP4a9wuIoQHkTKU5yj+Rcp1stttwISpmvWnrCJxf9L2wlyf2/3+CfWoAHoXWi7 X-Received: by 2002:a05:6214:519b:b0:56e:fdff:29f9 with SMTP id kl27-20020a056214519b00b0056efdff29f9mr32726061qvb.18.1677315857708; Sat, 25 Feb 2023 01:04:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677315857; cv=none; d=google.com; s=arc-20160816; b=VdSinr6ZuDNR2w/Q9dNeKwEvl7Wir0C4K0qK9TZ+5MrBNkYpREMkPtEELGI3iGFXz5 gquF4381sQ6iQtIraSKCTlhfykrFcZwtcgxBeHppd9Nt8Tbwnl4WgpJaee/c3ZXGBux3 4rm3scn1VsNQ4H9KV+4W85/X2njZ+vCnpkhE5tINGrYrNU9avX78ogzctNtvaz1597lg 8JLtYX2QM8Rcv+jeWkm5ycxnTPd8dYMpCL+30XGJ0wbvi7dcXpszHnIlVZB89gy/nUaz LRudG1U+7TV59WRclFNVUmFTxp8Zs0+wMdTinTooEttb6K6KFnzbDWECAmdKuhreGjJJ gQxg== 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:cc:to:from:dkim-signature; bh=W5Dq8tNQ7vqT23pi8EJ4sQhJjuVbWctx/4+OGVog4Ac=; b=SPvpYDyHaBFXT6e44dkFNwzDP8+nLewjlT9OtfGchJhxpsPpzVajEJNnQFJIoAjB9T cOt0hKc4K5fz1nUVweLL5CFrhxYR1UnQZ6lv7LELS8HBD2S4mFcUJbEditvQYOb0lkda s7boWqKz+PWpVCxlccnHHwkSraCfFZG7yIth7EQ12agU7IZmQBd61TUDCTF06ArbwNsz iTKYqhHS/AWz6hw7qSQwuaoheNiu1F6ROrYzm+Gh2oxPOrSsgd0lGmI8Xyke/tMBjb0m qsYvEnlV/qSeHE7fdYmqFDS+RYTHRNX0H37EsK14eouKrOUXE83qcTseREwi5CEq1odL DZ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hw3bhKXU; 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 bp10-20020a05620a458a00b0073ba718e297si1364230qkb.465.2023.02.25.01.04.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Feb 2023 01:04:17 -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=hw3bhKXU; 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 1pVqPK-0000Lj-VL; Sat, 25 Feb 2023 03:59:55 -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 1pVqPI-0000LE-R8 for qemu-devel@nongnu.org; Sat, 25 Feb 2023 03:59:52 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVqPG-0004oW-SH for qemu-devel@nongnu.org; Sat, 25 Feb 2023 03:59:52 -0500 Received: by mail-pl1-x633.google.com with SMTP id n6so472606plf.5 for ; Sat, 25 Feb 2023 00:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=W5Dq8tNQ7vqT23pi8EJ4sQhJjuVbWctx/4+OGVog4Ac=; b=hw3bhKXUPPfSxaNvvkMteKwMu0APpKD8T/SNzHemhlKxfvz4CPu7GeHFyjXCdFrlHO PEJJ9RKItp0DHtLkXwv+sMW2H6Ov5/o17oFGg3Q0VpmOdn9l4JZELzPDX1cMP40+dn4c ZJaUUz6WjKzAaTb8aKYE6vWCrwl4mWKJL7vw+afsVAh9LSXhm3ad0j7V4PbrJUwI7RQr igs8eLXPJLMiRLeMP1Vz72oJ9Y2b6xo9pvqBo62VCcBk7WEQb13QuaishlIDNDbno4Y2 mCldHgMF/MscIs5cyMePDNioeCpWzBmIhrkrqqx5WcK0gNyrCPbOdz28eyRT7Um5dKmb vd5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W5Dq8tNQ7vqT23pi8EJ4sQhJjuVbWctx/4+OGVog4Ac=; b=k8kYT4aREdl7tDOeGnbyBLTVrtejQO7ubDyXOS7wyuXaWNPIMvU9BRwr6YMMEGnfjt 3tGwBtfHcN17jKQILCG8TJAek/e4FChbPN9i0SfCNydn9MFC340ngqCf1+6oqyjwhEAz 5eAVkRR4lFeMkYzrTZddSeErzvn58qrQYrz/bSJMZ6BodanGtBzqyj010gGJCm5JXeMX 4MMpAeg7H/qnImapf1MVenRQ9Xn+65AuuKH68A5MZrofxJdbqO9jl0l7Ro9vDbB+pb5X LMq1wwLBehM/K6Jt1WPZHxFtMHJh+LweEPg2eaY3leC42I061k7oPC5jCBaRfqlAqaEL feNw== X-Gm-Message-State: AO0yUKUnmlU9ZMmMYlSH1x7giYo2ARQpWR0ST4cpDO9G/th/hwJugQbS rYaAs21t277o5xbLOYrsPDVneW/yRGykg9rWNWc= X-Received: by 2002:a05:6a20:12c4:b0:bf:6cd3:9510 with SMTP id v4-20020a056a2012c400b000bf6cd39510mr23223539pzg.24.1677315589127; Sat, 25 Feb 2023 00:59:49 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id s17-20020a639251000000b00502ecb91940sm715546pgn.55.2023.02.25.00.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 00:59:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v3 00/30] tcg: Simplify temporary usage Date: Fri, 24 Feb 2023 22:59:15 -1000 Message-Id: <20230225085945.1798188-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 The biggest pitfall for new users of TCG is the fact that "normal" temporaries die at branches, and we must therefore use a different "local" temporary in that case. The following patch set changes that, so that the "normal" temporary is the one that lives across branches, and there is a special temporary that dies at the end of the extended basic block, and this special case is reserved for tcg internals. Patches lacking review: 07-tcg-Add-liveness_pass_0.patch 10-tcg-Use-tcg_constant_i32-in-tcg_gen_io_start.patch 14-tcg-Use-tcg_constant_ptr-in-do_dup.patch 17-tcg-Don-t-re-use-TEMP_TB-temporaries.patch 30-tcg-Update-docs-devel-tcg-ops.rst-for-temporary-c.patch r~ Richard Henderson (30): tcg: Adjust TCGContext.temps_in_use check accel/tcg: Pass max_insn to gen_intermediate_code by pointer accel/tcg: Use more accurate max_insns for tb_overflow tcg: Remove branch-to-next regardless of reference count tcg: Rename TEMP_LOCAL to TEMP_TB tcg: Use noinline for major tcg_gen_code subroutines tcg: Add liveness_pass_0 tcg: Remove TEMP_NORMAL tcg: Pass TCGTempKind to tcg_temp_new_internal tcg: Use tcg_constant_i32 in tcg_gen_io_start tcg: Add tcg_gen_movi_ptr tcg: Add tcg_temp_ebb_new_{i32,i64,ptr} tcg: Use tcg_temp_ebb_new_* in tcg/ tcg: Use tcg_constant_ptr in do_dup accel/tcg/plugin: Use tcg_temp_ebb_* accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers tcg: Don't re-use TEMP_TB temporaries tcg: Change default temp lifetime to TEMP_TB target/arm: Drop copies in gen_sve_{ldr,str} target/arm: Don't use tcg_temp_local_new_* target/cris: Don't use tcg_temp_local_new target/hexagon: Don't use tcg_temp_local_new_* target/hppa: Don't use tcg_temp_local_new target/i386: Don't use tcg_temp_local_new target/mips: Don't use tcg_temp_local_new target/ppc: Don't use tcg_temp_local_new target/xtensa: Don't use tcg_temp_local_new_* exec/gen-icount: Don't use tcg_temp_local_new_i32 tcg: Remove tcg_temp_local_new_*, tcg_const_local_* tcg: Update docs/devel/tcg-ops.rst for temporary changes docs/devel/tcg-ops.rst | 230 +++++++++------- target/hexagon/idef-parser/README.rst | 4 +- include/exec/gen-icount.h | 12 +- include/exec/translator.h | 4 +- include/tcg/tcg-op.h | 7 +- include/tcg/tcg.h | 64 ++--- target/arm/translate-a64.h | 1 - target/hexagon/gen_tcg.h | 4 +- accel/tcg/plugin-gen.c | 32 +-- accel/tcg/translate-all.c | 2 +- accel/tcg/translator.c | 6 +- target/alpha/translate.c | 2 +- target/arm/translate-a64.c | 6 - target/arm/translate-sve.c | 38 +-- target/arm/translate.c | 8 +- target/avr/translate.c | 2 +- target/cris/translate.c | 8 +- target/hexagon/genptr.c | 16 +- target/hexagon/idef-parser/parser-helpers.c | 4 +- target/hexagon/translate.c | 4 +- target/hppa/translate.c | 5 +- target/i386/tcg/translate.c | 29 +- target/loongarch/translate.c | 2 +- target/m68k/translate.c | 2 +- target/microblaze/translate.c | 2 +- target/mips/tcg/translate.c | 59 ++--- target/nios2/translate.c | 2 +- target/openrisc/translate.c | 2 +- target/ppc/translate.c | 8 +- target/riscv/translate.c | 2 +- target/rx/translate.c | 2 +- target/s390x/tcg/translate.c | 2 +- target/sh4/translate.c | 2 +- target/sparc/translate.c | 2 +- target/tricore/translate.c | 2 +- target/xtensa/translate.c | 18 +- tcg/optimize.c | 2 +- tcg/tcg-op-gvec.c | 189 +++++++------ tcg/tcg-op.c | 258 +++++++++--------- tcg/tcg.c | 280 ++++++++++++-------- target/cris/translate_v10.c.inc | 10 +- target/mips/tcg/nanomips_translate.c.inc | 4 +- target/ppc/translate/spe-impl.c.inc | 8 +- target/ppc/translate/vmx-impl.c.inc | 4 +- target/hexagon/README | 8 +- target/hexagon/gen_tcg_funcs.py | 18 +- 46 files changed, 681 insertions(+), 695 deletions(-)