From patchwork Tue Dec 25 20:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154500 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5221863ljp; Tue, 25 Dec 2018 13:18:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN7z0bWI3HAwwZODI33wLIRjw5029C4E8FLBFx7ShGTdo4sXTCOkj1WOpENNSR5fWpPZ0LKn X-Received: by 2002:aed:3722:: with SMTP id i31mr16954590qtb.289.1545772723460; Tue, 25 Dec 2018 13:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545772723; cv=none; d=google.com; s=arc-20160816; b=J6v3lDrYHgGYpKAXGwPilLZXitjpw+32an3Kh/CbxGqdp4pc7trLBnk+hx6jj5fx2P /IwDOo51SwC3jp26l2N6U1nl6HgbCrTCM7rIJPgwHf3Ab35pLB4C4djrFsbB/8DFZtJv TxZ8ZJSaHdf7zMkAHEBX4buu4rMuSg/zfDZR83TfCmO7/pVdXCuoZ3MPxuj99f81X7tv pPYeFlkJ6eit5qw4R5rc+b69sfgekQKSnAXTVJAWBwP2HJtSLiEfkF9hhx8Yo4hSld42 5/FTBlTTFpWQ3tf3vcmbRHmi/9QQB0GLl50FRXz8SshHi4gSaLN/98T+CSqvK42mJnbM pQOw== 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=+PnTvLpWSGULHJfofTJ2nNNXUW59+5rdyU2Q/snqAIo=; b=GVJfonP6U5ohd4Qk2rPk7u+3zJnnwuEclDrM5/1j9EsmguNsuf1k6ZIpAL+z6NS4XL gK0XOAM/quK7wiU/7fqd1N6LZfoxnSMX+q3TTgni4yHLfaUetooI+UAxXIZI2hq6qgbX nt/ccKEUnWPBedEsbtNwx19Hbdo1tpwdKL9tckn03mRb4937THr/Qm3/n9p1skh0tmwT Y2gBCA2uaJEQ0xnlmektzftuuzn6EwHYnhzTzu2rSvDbEbRZzYy9PgtzFZb0YWRIcx4l Upvx36D7ANOpwI/5BL1iFfStM/crSAft6VABii80TEmEF9wIfEkIvr51vATSuAswWQqY gJfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hfYGRdM7; 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 o5si1023439qtg.188.2018.12.25.13.18.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 25 Dec 2018 13:18:43 -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=hfYGRdM7; 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]:43219 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbu66-0007pQ-Rz for patch@linaro.org; Tue, 25 Dec 2018 16:18:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbto7-0000Bk-KQ for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbto4-00020T-G3 for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:07 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:40559) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gbto4-0001ze-AH for qemu-devel@nongnu.org; Tue, 25 Dec 2018 16:00:04 -0500 Received: by mail-pl1-x635.google.com with SMTP id u18so6803614plq.7 for ; Tue, 25 Dec 2018 13:00:04 -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=+PnTvLpWSGULHJfofTJ2nNNXUW59+5rdyU2Q/snqAIo=; b=hfYGRdM7dl3T/vXHwmoWjBKaHI+fQj5r9ZqOqaf5OECtfewmWocrtj6DcwVXq1XKia EHjYoek0VZuStXLbgsN7H/vjKmUAmnWzjxgqccqciN9EV9NjGVnxn//ffTCO88T4cpRO bpHOolTFrTaY3u2bdzalrhu+QUfq5urytXV2I= 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=+PnTvLpWSGULHJfofTJ2nNNXUW59+5rdyU2Q/snqAIo=; b=X6+xHrzxSsEUdh1/NxnfcHv5LqRELch4pBohTutY2vz5zSe57rbapHHpiQ2bFkyKlk ArRRyVP/+dLctBfMlPLmYTyzi3JIIUs2+v0wdLhsE2c8XCZz0ZSvgDwwauQ98on9I/R3 xhwvi8KhQH7OHlfjf7wX4jwyfF+yj+f1451CpUuSAxQgBH2+wnoUMtVVNfXPgDaNWMTQ 6honJlNAPyVTthq7o0Afa/LKTU0vf4Dxn9QC6xYHE9R0V+yH/uDLbvRsFlGsXRtZ9yyX 3hl6ig1gq3Pgq4xRodKBUQB+1Us8bsCvUhu5s1XkAcwrj+0kYAC4jx/nu94tEMQ/f2Dj joCw== X-Gm-Message-State: AJcUukc7Gqrm/INV1NdwM2Ioux3GpJmbdgpFo4EkEJF5VR69vFZQerMk Ewk8SrgVTXk6P9O7CEp4jpEmZ6z+Hdc= X-Received: by 2002:a17:902:d68c:: with SMTP id v12mr17289484ply.4.1545771602818; Tue, 25 Dec 2018 13:00:02 -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.12.59.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Dec 2018 13:00:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Dec 2018 07:55:26 +1100 Message-Id: <20181225205529.10874-40-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::635 Subject: [Qemu-devel] [PULL 39/42] 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Emilio G. Cota 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 0afc6ba1e6..4f0acf8863 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2395,6 +2395,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. */ @@ -2450,15 +2470,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 */ @@ -2601,10 +2615,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 */