From patchwork Wed Nov 28 05:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 152192 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp692694ljp; Tue, 27 Nov 2018 21:48:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/XltBrzNgzAdpTftkayROCK1V8hEWRHUHpqiy3mp3i07eAtlexVTQx78iPCK+U57048Vl/h X-Received: by 2002:a25:198a:: with SMTP id 132-v6mr35323399ybz.22.1543384124379; Tue, 27 Nov 2018 21:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543384124; cv=none; d=google.com; s=arc-20160816; b=PR0hOADeggnEUubnPYtgRjK/hM/JGQzDuv2F6w6N8umqnVB0aqPGlPFZPJaQ8G+uaT we9CDEieDWKqKKOR0S55B/WEl0UBc+CXFqSyHvntcWokh9UcsprBvdq8D6GHSa1zNT4x KlA5nUfHDgOU2YukM+i4wdXZuVsqyLsO8KAFheSvew8eEzpFHw6EGAQ/rAZ8zzgH6bbe xFWJzJa2A8pKSZhrN+s/rVOhPDS6tmRGzALmldioQ4VSoSajsBwxRuOjHT7r8PkWtpAU utFGv+F8jc20hX0y2kJAs9U8oivlPnF5BdZH4lPXHRTxlIC4CprQakzEnUtx1UQMkfpv 88SA== 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=RayPqtg1GIUBRZB3Wq/kgllr6OtflLAyLXeqe+v2dG4=; b=xu/yX5LN8OM8CX2jeKh2uQ+t2lujxmDzyqdVuVBrfuhOD3M76wjsPLqTgk3PZXcLho GEUJ1o3HUFOiArB7KgX6IMVyzo0DNR8OtsnBgUeZyxaFORHYbfUz4Nq/G2oyoiHgUEXO P8btknKzCzrmGEpPHcHZm0q0py0RJ/Cb98siTYNYMgHbuhgj1CFMRKuHILNXk52OCBY4 PV++h4T+eZaXGw8XgfLbBHONcOx6l0DLgu5YNdsbZHUFzdtz/uRsLOFn1TmxcJYKkkUg K7LA6nBI+3hz0Jb7qVFXPMEQ3Z4TVvPvLz1tsvCs7hvvQDIhNkWhMCV77q4MYCHq0CLp saEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eWKc5nDP; 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 f126-v6si4304313ybg.323.2018.11.27.21.48.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 27 Nov 2018 21:48:44 -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=eWKc5nDP; 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]:46078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRsiJ-0005R6-Lk for patch@linaro.org; Wed, 28 Nov 2018 00:48:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRsYl-000413-R7 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 1gRsYk-0004OW-6J for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:51 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:36434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRsYj-0004NP-V1 for qemu-devel@nongnu.org; Wed, 28 Nov 2018 00:38:50 -0500 Received: by mail-pl1-x642.google.com with SMTP id g9so4345340plo.3 for ; Tue, 27 Nov 2018 21:38:49 -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=RayPqtg1GIUBRZB3Wq/kgllr6OtflLAyLXeqe+v2dG4=; b=eWKc5nDPv0WFDIGnFs8CHIhI0TBx8nkNsZuRE3Z0V2/rFKBDJd/RcZnUBw/Y8xm0wX N/vATD/mGaON9kpe3Qm1xNAf/pO4wm7zYo9C3xnnj2lgj84YCo14VbGU1wLByovAghhc PT+LDn89IJcTtsqlEnkcc0F/NX+2YZMOE1eQ8= 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=RayPqtg1GIUBRZB3Wq/kgllr6OtflLAyLXeqe+v2dG4=; b=N52ATB3IS6X5CtmM4wTouTdgX72k+Lkuac5+th0L6i4P62DxHrtFepBtCJntjO0p2C WnoSJsGOGJ/TKMYcuDNiaB5B04LN8/c02xvs4JFQEzAafH/Ceq/yAJjSMVaG9TlNtVR1 KpjQLMpk32ULj2tCpcUgnD56sZnLE0TnF7GXGETiG1L3nAM0IhvyPz2Q74jooWogofC6 JZfkYH6PzGOdIdKdwoyd5iukqjYfA/X/ebxzHndm8+G9rQiEy5DCSBYU3SBzqofqet6B cIYzgxPgMf4MXTuI1/13aqBs2dVRLJfSRqCFJQTpg/qR5DevBwV6xuqnCplVOQIlv31J PKoA== X-Gm-Message-State: AA+aEWbj7X9KXoZeCjNmhHwpB6P/r+lBxnYMhPBYcL+ty5LsCjC8HvJE HkeVnxxgTFDZkgWbVVPMECWaIgCOHWk= X-Received: by 2002:a17:902:714c:: with SMTP id u12mr35141985plm.234.1543383528635; Tue, 27 Nov 2018 21:38:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 21:38:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 21:38:32 -0800 Message-Id: <20181128053834.10861-11-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::642 Subject: [Qemu-devel] [PATCH 10/12] tcg: Split out more subroutines from liveness_pass_1 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" Signed-off-by: Richard Henderson --- tcg/tcg.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) -- 2.17.2 diff --git a/tcg/tcg.c b/tcg/tcg.c index 27814df882..21668831a1 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2417,6 +2417,26 @@ static void la_bb_end(TCGContext *s, int ng, int nt) } } +/* liveness analysis: sync globals back to memory. */ +static void la_global_sync(TCGContext *s, int ng) +{ + int i; + + for (i = 0; i < ng; ++i) { + s->temps[i].state |= TS_MEM; + } +} + +/* liveness analysis: sync globals back to memory and kill. */ +static void la_global_kill(TCGContext *s, int ng) +{ + int i; + + for (i = 0; i < ng; i++) { + s->temps[i].state = TS_DEAD | TS_MEM; + } +} + /* Liveness analysis : update the opc_arg_life array to tell if a given input arguments is dead. Instructions updating dead temporaries are removed. */ @@ -2472,15 +2492,9 @@ static void liveness_pass_1(TCGContext *s) if (!(call_flags & (TCG_CALL_NO_WRITE_GLOBALS | TCG_CALL_NO_READ_GLOBALS))) { - /* globals should go back to memory */ - for (i = 0; i < nb_globals; i++) { - s->temps[i].state = TS_DEAD | TS_MEM; - } + la_global_kill(s, nb_globals); } else if (!(call_flags & TCG_CALL_NO_READ_GLOBALS)) { - /* globals should be synced to memory */ - for (i = 0; i < nb_globals; i++) { - s->temps[i].state |= TS_MEM; - } + la_global_sync(s, nb_globals); } /* record arguments that die in this helper */ @@ -2623,10 +2637,7 @@ static void liveness_pass_1(TCGContext *s) if (def->flags & TCG_OPF_BB_END) { la_bb_end(s, nb_globals, nb_temps); } else if (def->flags & TCG_OPF_SIDE_EFFECTS) { - /* globals should be synced to memory */ - for (i = 0; i < nb_globals; i++) { - s->temps[i].state |= TS_MEM; - } + la_global_sync(s, nb_globals); } /* record arguments that die in this opcode */