From patchwork Tue Dec 25 20:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154505 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5223563ljp; Tue, 25 Dec 2018 13:22:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Z31+qZlrCcdT3o6en/KEynb7ZnxVLNvPUgfHHeHjtTO6VHweKE1nGs58GIEUX7NaqWCFU X-Received: by 2002:a37:8b41:: with SMTP id n62mr15795460qkd.262.1545772927447; Tue, 25 Dec 2018 13:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545772927; cv=none; d=google.com; s=arc-20160816; b=nhLbpQSKRLHVEeJSqBixh31JkCOVfe+iICz68gmHlXfbMjYRAIvZgvkV1EDNtC6LxV B7NlK2QYOPjpBuppFP8oj4DNb5pIr+fHlX2k6IswaPIEAjHYgdU9NwOd5XuCBApm5s5c pCS21w9f+Zrq4P/Rsd7k2jPe18Gz61WT63wXOSNsH8CKEhpFjtjZ5IhHsyLDBw9/voKy RvAra+yveuSGMTQ6u8XjqauJ8GoQJwnXHHCUQdqriy5gZzwwzd0bAVvGPL/neAQkEvQC LBs2G3fRFwZrLhJpBm7W71VmyxjN+qTCeBjn6fnW/q4aCUjyd8An8QbeYy8MpUn2GgdQ 4pqg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=W3MJU8k1INx2eAZ6THgZjlhnFYT7Ou+CT2Ez8PjoyT4=; b=ptHKJbtQBTHrYzt/BYqXOZF9Ac9J09vdBEUYJvCZa7ynu6FIMHEQ9CQcjf9/vK2rBU mr0NBBmeAt+iI+0TLb4B7B/WMrS2pAnPdZFeWtpkUzJl95eaYHBa8gqoe378nWzVLPeR EAnzz7C91PYOKbVwL6F0sWJQuBSJdOkdL5Y9KCzuQCAgXGpVFiijmqxGfL597osScq/j bdtl6yCONugNrdePZ9/mlfzVVuolOsmnTq+VJpcEK+ZqCtSbW9KZRAtuRn+59xK0TeMl 4Z3uhR9xy69LGqkV5Mt3qqFSqah64fsp4/HHIyjutQDGv7wK3QtsD4FC3F1gIjdmoRQ6 fMBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=afqlab+q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id a76si1124872qka.92.2018.12.25.13.22.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 25 Dec 2018 13:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=afqlab+q; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:43260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbu9O-0003rZ-T5 for patch@linaro.org; Tue, 25 Dec 2018 16:22:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbtoD-0000Oj-Ux for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbtoB-00029x-Sw for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:13 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:36700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbto9-00023z-Sv for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:10 -0500 Received: by mail-pg1-x536.google.com with SMTP id n2so6828510pgm.3 for ; Tue, 25 Dec 2018 13:00:08 -0800 (PST) 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; bh=W3MJU8k1INx2eAZ6THgZjlhnFYT7Ou+CT2Ez8PjoyT4=; b=afqlab+qp4RvAkdhFMqbqS8KdTYXqgwENsGRFGO4efD4x3Sl8KwJL0MnyIxcbjpMT5 m+MDFojsa2E0tHgZtJfNzAnXf7rU5yq4Hr+w1li7i+EhPGqMChPZXmCEVptPznyd2yDb W3UWONhnD7+edDn6vLYO4b/HijiHZaRnVp4ME= 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; bh=W3MJU8k1INx2eAZ6THgZjlhnFYT7Ou+CT2Ez8PjoyT4=; b=fLAkelIoC9f6G3EK/JfHIzwHTOG270h/g2tVLHHoFgsKlt2SvTRAoSI7csjJErnbwy 2ULanDIJVZ6jNn1+fP6ABFEfZlGhxhdA1QhL6B+tzLmVmtVJRNuI6RYizjInsYUz3OMl um4fuwn9HjbLUOuMZf+G+HMm/cuttKJ0mmpwobg1alXsWnZLvKFKdhwFX3NeLzvtvovO RkaQeq2CWeEzcdZscK+AF0l868U7TBMNBP6gg3HJBJSOOBLsOg4dN9gZWekMV//C15lR cA+kqsHpanlGFpu8ZEFI4p4ohFVoSRN/O/c89QILMQRNrhEJSGv/j2qf70H0mAnrnln2 bA2w== X-Gm-Message-State: AJcUuket8hobMmYJ4BRy8rFil/u6Mlc6R0RnUQ5BoF3sBI7N7NacqA1I TvkuZNf3Pi+3zhwpDbZX9BY6NSif2Yk= X-Received: by 2002:a63:dd15:: with SMTP id t21mr16085271pgg.347.1545771607648; Tue, 25 Dec 2018 13:00:07 -0800 (PST) Received: from cloudburst.home (c211-28-135-144.sunsh3.vic.optusnet.com.au. [211.28.135.144]) by smtp.gmail.com with ESMTPSA id t21sm48501628pgg.24.2018.12.25.13.00.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Dec 2018 13:00:06 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Dec 2018 07:55:27 +1100 Message-Id: <20181225205529.10874-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181225205529.10874-1-richard.henderson@linaro.org> References: <20181225205529.10874-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 Subject: [Qemu-devel] [PULL 40/42] tcg: Add TCG_OPF_BB_EXIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use this to notice the opcodes that exit the TB, which implies that local temps are really dead and need not be synced. Previously we so marked the true end of the TB, but that was immediately overwritten by the la_bb_end invoked by any TCG_OPF_BB_END opcode, like exit_tb. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/tcg-opc.h | 7 ++++--- tcg/tcg.h | 14 ++++++++------ tcg/tcg.c | 5 ++++- 3 files changed, 16 insertions(+), 10 deletions(-) -- 2.17.2 diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index e3a43aabb6..7a8a3edb5b 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -191,9 +191,10 @@ DEF(mulsh_i64, 1, 2, 0, IMPL64 | IMPL(TCG_TARGET_HAS_mulsh_i64)) /* QEMU specific */ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_WORDS, TCG_OPF_NOT_PRESENT) -DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_END) -DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_END) -DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr)) +DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) +DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END) +DEF(goto_ptr, 0, 1, 0, + TCG_OPF_BB_EXIT | TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr)) DEF(qemu_ld_i32, 1, TLADDR_ARGS, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) diff --git a/tcg/tcg.h b/tcg/tcg.h index 5e5cf686a3..3a629991ca 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -1030,20 +1030,22 @@ typedef struct TCGArgConstraint { /* Bits for TCGOpDef->flags, 8 bits available. */ enum { + /* Instruction exits the translation block. */ + TCG_OPF_BB_EXIT = 0x01, /* Instruction defines the end of a basic block. */ - TCG_OPF_BB_END = 0x01, + TCG_OPF_BB_END = 0x02, /* Instruction clobbers call registers and potentially update globals. */ - TCG_OPF_CALL_CLOBBER = 0x02, + TCG_OPF_CALL_CLOBBER = 0x04, /* Instruction has side effects: it cannot be removed if its outputs are not used, and might trigger exceptions. */ - TCG_OPF_SIDE_EFFECTS = 0x04, + TCG_OPF_SIDE_EFFECTS = 0x08, /* Instruction operands are 64-bits (otherwise 32-bits). */ - TCG_OPF_64BIT = 0x08, + TCG_OPF_64BIT = 0x10, /* Instruction is optional and not implemented by the host, or insn is generic and should not be implemened by the host. */ - TCG_OPF_NOT_PRESENT = 0x10, + TCG_OPF_NOT_PRESENT = 0x20, /* Instruction operands are vectors. */ - TCG_OPF_VECTOR = 0x20, + TCG_OPF_VECTOR = 0x40, }; typedef struct TCGOpDef { diff --git a/tcg/tcg.c b/tcg/tcg.c index 4f0acf8863..d40edb4f57 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2424,6 +2424,7 @@ static void liveness_pass_1(TCGContext *s) int nb_temps = s->nb_temps; TCGOp *op, *op_prev; + /* ??? Should be redundant with the exit_tb that ends the TB. */ la_func_end(s, nb_globals, nb_temps); QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) { @@ -2612,7 +2613,9 @@ static void liveness_pass_1(TCGContext *s) } /* if end of basic block, update */ - if (def->flags & TCG_OPF_BB_END) { + if (def->flags & TCG_OPF_BB_EXIT) { + la_func_end(s, nb_globals, nb_temps); + } else if (def->flags & TCG_OPF_BB_END) { la_bb_end(s, nb_globals, nb_temps); } else if (def->flags & TCG_OPF_SIDE_EFFECTS) { la_global_sync(s, nb_globals);