From patchwork Sat Jun 19 18:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 463899 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp1048661jao; Sat, 19 Jun 2021 11:21:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZB2fWSBnjO0cIBj33jFVIXrd4c+uAVi3G8H9trx2qneIsZ3j1lk0uM3RJFmv13AhZSNQ2 X-Received: by 2002:a1f:a897:: with SMTP id r145mr10486838vke.25.1624126891395; Sat, 19 Jun 2021 11:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624126891; cv=none; d=google.com; s=arc-20160816; b=vRy6KzYvpxmt8ljEc7b8lSCbTJHH9P0QCT1rsS5euRB1kUqO3lw5EoPnQd/+FjhNow tZYg7jexRB937qyp+6jgyV/PYQaRdxuZx9A4xTR4Dl+KXb5Y6XKOqMLfzNaIwFpuLm9Z /AikB/M05EkHfe4YLegnVkfJtEz9Wwso3NxQ5TQ1doHaPA9G3TRuAh0Scc+Ci9XKgtHa pg0PJBoaMOhyM6/8ysT9Kuj+z4/9x9MYcMyrJYV4a0Dgllu4kD/mNXvq10JYr18YW+P8 cfuJ+1LqanNtj2MbEHiPdezev4b0rLcW3VqFtxWltNgQIZyR4qGFG3CHVuGXi5sjIaXb E2fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=EdhOR4bbdTkQJ8JwWauxjmsHhxrFc7wx39xQEmIIlNk=; b=vDU1n8fT01m+OFm9jnKM3rS10s5/JSlXYsjvxhnuXkxKjJVHZkkX0NTeiVQWWsKjdv EChcul0ys+wgioliJVLlq4KzPIrOW4yoLYIcsZczUu3u81XodXBpd2xF6w7xhABa74Gk DR02dBUx//dy2U9EmHQ0JhBVIOdWhX2GAtGZcXIMIFelH8mbKPZb4DVpDaXexQy5om5x HheAcm1Kr1HhfCUmuYy3DWmOb41wJQxex2cVCIWAOnnX+zVc/IHRuMkHR+RUo+7I2sM3 lEQI3S8Arq13BoibQTAYf5VpDGyw62TVUULPyq8f18r4GhYZ5TXSLc0Orem/27qQRVMX zarQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTw6s8p5; 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 n13si4523423vkl.80.2021.06.19.11.21.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 Jun 2021 11:21:31 -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=aTw6s8p5; 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]:49350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lufb0-0005ye-OR for patch@linaro.org; Sat, 19 Jun 2021 14:21:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lufUj-0000gk-33 for qemu-devel@nongnu.org; Sat, 19 Jun 2021 14:15:01 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:44693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lufUd-0002Cz-UD for qemu-devel@nongnu.org; Sat, 19 Jun 2021 14:15:00 -0400 Received: by mail-pf1-x42f.google.com with SMTP id u18so4989552pfk.11 for ; Sat, 19 Jun 2021 11:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EdhOR4bbdTkQJ8JwWauxjmsHhxrFc7wx39xQEmIIlNk=; b=aTw6s8p5DLyQl0qMrZeY4HFjOKnbBdgC6t6qLQ2eQP79GW+SbbdfL67rTjHHYfj8Fa wSVWKt0H/5Fo9iuuqsuOMRzKS0j5YaPw7QNmy4n4C/G4W0fT66SBz2mqPuedpyjbrnna geF0V8GDwCQn6lcn9ThU4BtgXUF2ohH4MBQylVQo5EXUIbNCL06L86v0K3A+cR79evXa N2UcevSMDru128REHTGF1o0aT797rLoRfhqH3PSL7l5HoTwN4gqbBrW/eIqRjWIlgVBu IEz73LxFJtR5YOBAVkj3TnryAQOuNFfn23/coHQeB5QBg1r9QhlgUYQgTneIhuTVjC2V LoZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EdhOR4bbdTkQJ8JwWauxjmsHhxrFc7wx39xQEmIIlNk=; b=kO6+DGIyL+/tBq4loQiVBOnG6I68jlozK0bqbJDRtrgyKDrDS3I6RA9em5y1dtZsnY jmVQgTcUXIO4xkfDU+8K+SCWsR9LSJgM73uGv3EgYRgKLDd3Fe9VtCrQsOE+V/S/ndbH dwPOs3mO/KeNSSiwe3w4YbsBeNRgv71mEZ5DEbySONvrDnTMz30fbPdSP9MuqVjE+lpt 8WOxSsuG43Qu7qShnQ6gj05+vHRC+ojToArwUNoThOjOD4aP0UkBWin9ouSyEUrE97l0 DjxEk+MciKrLfpWqiWp4M+lK0Y8jz6Q8T7J6tFZn/DhK9TvFtztK5EmaHsIGGJuytLVu BYvw== X-Gm-Message-State: AOAM532hMb3JsNDirgEoJ7ZqNVprll7t9ffxFAanqpiZJXIF95Q1JC34 m7y+FkjyL9nclndoU67u9Os1CiXWx0wuzQ== X-Received: by 2002:a63:bf0d:: with SMTP id v13mr15762243pgf.303.1624126494561; Sat, 19 Jun 2021 11:14:54 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id k35sm12059113pgi.21.2021.06.19.11.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Jun 2021 11:14:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/33] tcg: Add tcg_call_flags Date: Sat, 19 Jun 2021 11:14:21 -0700 Message-Id: <20210619181452.877683-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210619181452.877683-1-richard.henderson@linaro.org> References: <20210619181452.877683-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We're going to change how to look up the call flags from a TCGop, so extract it as a helper. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/tcg-internal.h | 5 +++++ tcg/optimize.c | 3 ++- tcg/tcg.c | 14 ++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h index 181f86507a..0796407c13 100644 --- a/tcg/tcg-internal.h +++ b/tcg/tcg-internal.h @@ -37,4 +37,9 @@ bool tcg_region_alloc(TCGContext *s); void tcg_region_initial_alloc(TCGContext *s); void tcg_region_prologue_set(TCGContext *s); +static inline unsigned tcg_call_flags(TCGOp *op) +{ + return op->args[TCGOP_CALLO(op) + TCGOP_CALLI(op) + 1]; +} + #endif /* TCG_INTERNAL_H */ diff --git a/tcg/optimize.c b/tcg/optimize.c index 37c902283e..211a4209a0 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "tcg/tcg-op.h" +#include "tcg-internal.h" #define CASE_OP_32_64(x) \ glue(glue(case INDEX_op_, x), _i32): \ @@ -1481,7 +1482,7 @@ void tcg_optimize(TCGContext *s) break; case INDEX_op_call: - if (!(op->args[nb_oargs + nb_iargs + 1] + if (!(tcg_call_flags(op) & (TCG_CALL_NO_READ_GLOBALS | TCG_CALL_NO_WRITE_GLOBALS))) { for (i = 0; i < nb_globals; i++) { if (test_bit(i, temps_used.l)) { diff --git a/tcg/tcg.c b/tcg/tcg.c index 3d6e6b260c..51c1f61828 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1766,9 +1766,9 @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs) nb_cargs = def->nb_cargs; /* function name, flags, out args */ - col += qemu_log(" %s %s,$0x%" TCG_PRIlx ",$%d", def->name, + col += qemu_log(" %s %s,$0x%x,$%d", def->name, tcg_find_helper(s, op->args[nb_oargs + nb_iargs]), - op->args[nb_oargs + nb_iargs + 1], nb_oargs); + tcg_call_flags(op), nb_oargs); for (i = 0; i < nb_oargs; i++) { col += qemu_log(",%s", tcg_get_arg_str(s, buf, sizeof(buf), op->args[i])); @@ -2155,7 +2155,6 @@ static void reachable_code_pass(TCGContext *s) QTAILQ_FOREACH_SAFE(op, &s->ops, link, op_next) { bool remove = dead; TCGLabel *label; - int call_flags; switch (op->opc) { case INDEX_op_set_label: @@ -2200,8 +2199,7 @@ static void reachable_code_pass(TCGContext *s) case INDEX_op_call: /* Notice noreturn helper calls, raising exceptions. */ - call_flags = op->args[TCGOP_CALLO(op) + TCGOP_CALLI(op) + 1]; - if (call_flags & TCG_CALL_NO_RETURN) { + if (tcg_call_flags(op) & TCG_CALL_NO_RETURN) { dead = true; } break; @@ -2402,7 +2400,7 @@ static void liveness_pass_1(TCGContext *s) nb_oargs = TCGOP_CALLO(op); nb_iargs = TCGOP_CALLI(op); - call_flags = op->args[nb_oargs + nb_iargs + 1]; + call_flags = tcg_call_flags(op); /* pure functions can be removed if their result is unused */ if (call_flags & TCG_CALL_NO_SIDE_EFFECTS) { @@ -2717,7 +2715,7 @@ static bool liveness_pass_2(TCGContext *s) if (opc == INDEX_op_call) { nb_oargs = TCGOP_CALLO(op); nb_iargs = TCGOP_CALLI(op); - call_flags = op->args[nb_oargs + nb_iargs + 1]; + call_flags = tcg_call_flags(op); } else { nb_iargs = def->nb_iargs; nb_oargs = def->nb_oargs; @@ -3799,7 +3797,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) TCGRegSet allocated_regs; func_addr = (tcg_insn_unit *)(intptr_t)op->args[nb_oargs + nb_iargs]; - flags = op->args[nb_oargs + nb_iargs + 1]; + flags = tcg_call_flags(op); nb_regs = ARRAY_SIZE(tcg_target_call_iarg_regs); if (nb_regs > nb_iargs) {