From patchwork Wed Nov 28 05:38:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 152184 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp688104ljp; Tue, 27 Nov 2018 21:42:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UjO5KiC1bL/rQLsBtlC553EZsiBh8iNfGVE1R70jf/PwEeZl76Rsc1bFMCr0CYjulQcT3s X-Received: by 2002:a25:4214:: with SMTP id p20-v6mr37690963yba.46.1543383721616; Tue, 27 Nov 2018 21:42:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543383721; cv=none; d=google.com; s=arc-20160816; b=rj81p4CJPvkNhckNejUjJLSzlzQ3jE0RRQ1Trp+eCpajnTGr3qFJwdXSwz8r/lL2/p 7r65kNouKyvfuqAB+zgaV5EKPtce3igPg7XNBXIVhWW+6bG0g4Z60QWugFtQb2ov61c5 0zQ7zYFPG+7bTlX1xOn/5EMiwvBegKUD27mW+vmrrQAhJmFHQQOzXMV9Y5myyMD0NjxK sU2u3t1Kiuuv2IfEsedrwrGyOZkilEOH/hxlXKVcQESEy+qlyTw3flT8RR2oTor4428m KW7IjP5271UaHXJRpbpT4gTkQD+TjQ66xinMZ8aE7BJBlwWiFoT6iA3l6ZeIMaXm6HLx PAaA== 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=BO3Y+feOPDtdGYpH71CChV1kkmUFSxlaNa8lwq9tJKY=; b=WVZT7+RklvoGB/ehuZjYFlPZ07cwUUFMa3ZywnpbjURGcn6aqIC19g7dYZ+1EWBRLg YIFoluuvUQNqz3M25N3V2cy0O/WRkbeQ9PGqwfS0lGZyqqZEf23hpqOjXdhufcy3n9M2 Xzr3MOLK90ORmtqCNnXckWR76qDu0ITY0DMqmKkRzD3267DNFDOmipx4pUcSamdDaOT2 wGAE4qkBT9pXel4Y3+a3u75/OnurCK1tg2McyOg1JLW4lVoYScstcqkmoHacjWPvScDQ JCD7HuA9kf8kqPRqPqH21qlRtmOIM1YQNuPBRSw/p8HqO6grL0zHHB67ybqayGD9Ad+2 UmvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JjN7VvOa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y14-v6si4348479ybr.371.2018.11.27.21.42.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Nov 2018 21:42:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JjN7VvOa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:46043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRsbo-0006fi-Vi for patch@linaro.org; Wed, 28 Nov 2018 00:42:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRsYm-000418-5s for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRsYl-0004PM-AG for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:52 -0500 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:41503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRsYl-0004Ou-46 for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:51 -0500 Received: by mail-pf1-x441.google.com with SMTP id b7so9606342pfi.8 for ; Tue, 27 Nov 2018 21:38:51 -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=BO3Y+feOPDtdGYpH71CChV1kkmUFSxlaNa8lwq9tJKY=; b=JjN7VvOa/lNosBzuh+GWFqfM1ouPuwmprJH+qOIMAMJA1VjukHl2shEinsyRzvXBlB 063OM1i929K3BsU/eCx3NNts6EJCOiPHDAXoUcP7TKZg0KdYFzljgtif+vSac0WJyzpW YTyCyckXcwXSQ7cU5pMvWmpQ24rjX24ScaYmQ= 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=BO3Y+feOPDtdGYpH71CChV1kkmUFSxlaNa8lwq9tJKY=; b=GvGOYsCJtxkkn8HQLNeSlP1/cv1Rew+1OvNuxtoSp9riYCVam6beRAfYD3vn4Nyk+a v7SjimtlWcDrXdyUscb8AIm4U9Y5dq1uNxVlsUIFYQY9Vr01w8JxJXQq993CaOpsHciw b98kcuUgsNAHMMW75W0BT4ghxOot2th0f2NpYSYlo5ZLmA8gShY3flpguBgyrGL/U+LJ phjKUdI0HU0wEl2iIIxiu28zILYg4jB23BO3mI4aXWDeK1qwpUbD4xG40zUD9kJ9Mqdm 0ThgjSIMpJRLZ16AIKWITrC4N2Fdpk8PSYlsYJVEC7z8F9Zd3NCnxYqXc7UyqWlUHtIn NF8A== X-Gm-Message-State: AGRZ1gIIk8bVAxl0dzMVahZU+/6WYDVo7kNj1E/RSd6ltzcj0SYPhxgL DESVo5ioobbg+IxUPOY4bqmDAXaU4FM= X-Received: by 2002:a62:a1a:: with SMTP id s26mr36210640pfi.31.1543383529747; Tue, 27 Nov 2018 21:38:49 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-170-180.tukw.qwest.net. [97.113.170.180]) by smtp.gmail.com with ESMTPSA id 19sm8569336pfs.108.2018.11.27.21.38.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 21:38:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 21:38:33 -0800 Message-Id: <20181128053834.10861-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181128053834.10861-1-richard.henderson@linaro.org> References: <20181128053834.10861-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::441 Subject: [Qemu-devel] [PATCH 11/12] 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: cota@braap.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. 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 ac5d01c223..abbf9c836a 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -1037,20 +1037,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 21668831a1..673aaf52a1 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2446,6 +2446,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) { @@ -2634,7 +2635,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);