From patchwork Mon Aug 30 06:24:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 504302 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp1516491jai; Sun, 29 Aug 2021 23:38:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEuTuPoGB+clUbR6hdl1dylTmYGFKIlJyWpVUl74tE7hJzEKyLYma1HomjKeN6dsxvOGLR X-Received: by 2002:a25:bec2:: with SMTP id k2mr21665188ybm.234.1630305519154; Sun, 29 Aug 2021 23:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630305519; cv=none; d=google.com; s=arc-20160816; b=uJC9NCOb4WDbxPJofZ1AgHnGco6P0vJqY7YGo1LqMnysJd5uERvQtCb18dK12SjInM SchUJxef1xQUwfnVy//bUd12sC4BGUL91Jb63S0JxupvLfA7myQVygf2gSrYfDq1GP8u nimd0Yc9jko1mCNKj7iJ7h7x/XTGvKYUTjj6tcA2oLdugQjesXSWXEyZYdxy8NeRo1p4 rZNhNNOPzyXgfwbQVEYsRF//q0FzzoXJP0ltp/roPXsabuVPd9qWNz0zLG3Ny8HsbtGm KZIo4kodZHFHOh1TK7HrjkuUA+lM7Cf2Q+9tiwWP02uNfr5n2sTinJFw7d1tNJvnpzdq WsNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=EGSJJ61X3FkAvzFRiCSr9bHCfCMYIoiBfLCMNZS+yck=; b=o9piMqF33yqBCKkSEao7QPn9XbZV2Fg2MylVYhFpyPHxjF8/ZMXYb2j+moA+/4Xpyq 6vP4Vd1m3vsjfqHHZF/2b0SZAulyAdTMB4ngz5gj/V/sPDKuZr2yca37Fo9TzKQhhgeQ BLXdMJFNAZrIFdrNZMNGXj3cEQd904NAdqrngoL6smHtCZVgH9rQOpYKXr9OIdEi6Ss2 OmKJXtl2ecIwi4IcLMHRgBeaIp2DGK1CLEw/eHqHlrrLdRbDKE9GS0lWHXpXGhN8af3o 4r3m06nKrBH6AG5gfuxCEPhTCU2gdtuak6Ghztva+/hxPcNBa2jMx09qJAnlxnZSxdC9 vQIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hC9xeXaT; 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 c4si12399566ybi.210.2021.08.29.23.38.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Aug 2021 23:38:39 -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=hC9xeXaT; 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]:36674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKawI-00028U-Iv for patch@linaro.org; Mon, 30 Aug 2021 02:38:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKaj6-0003bW-Lq for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:00 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:45002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKaj5-0007QU-79 for qemu-devel@nongnu.org; Mon, 30 Aug 2021 02:25:00 -0400 Received: by mail-pg1-x530.google.com with SMTP id s11so12390804pgr.11 for ; Sun, 29 Aug 2021 23:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EGSJJ61X3FkAvzFRiCSr9bHCfCMYIoiBfLCMNZS+yck=; b=hC9xeXaTlJG4g3rn+/GDLXnI6j0SKXtwIxCGO60FHMmuzP62cLb7ldck+wcgRJ/oOq fmDkOxro6DdDAxQtY1dVs02vdBNNHqzb9OV+kEXHKJ8HDRBP0/a3ghzD5AhnBdvOP4S6 pIzz5mHSuB3W60nudPUnUFhn5ErtELAx8W2BZX3sFt0VxDG1BMER2mtWSV0SIX9SwtPE Z2POqOxROnnryjQQ/0aENqCbdntPq7rZeU+8pWWbTX9ncT09L+OvPvMHjDdk+nmCXng5 hYinjexMLMVhsdwzgXhkLpG7t5nmu9tjG1Sc3GV4J0F0ZKX/9tBjCsMDZivjxtJfH8uS wCng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EGSJJ61X3FkAvzFRiCSr9bHCfCMYIoiBfLCMNZS+yck=; b=Ya0jBv7bopvi9qKRfM0VCTcZS8U3wejgJUTOT2LAOGmbRKXnV9KTiJzKWbEEnKdfJA U9sadJA+03gdGisKX0Fq/fkQvTMDRXUef5NhIBaMLv6i+syccwQElN/6fzBlYIfwqCEZ dWeVRp9v4uAhJPxegjzBdY/uF8eMVJBuH2pxYXXH1eIDsf/jyr53HMDmxilewYSy9xXP qZf2Z8gvGF0HQmAbz1uo/jGtwuy2tjuC9Qr8Xl4fwLtID7EpP6W1Def9S4Iw5WCJOnWm sKTZAW6El63xenmZKT8CArvaKrAfD/smY84MkCMLaGzTdLCBEbSFpWYmzviRGa0u4Krj OWJQ== X-Gm-Message-State: AOAM531jKUWl9j9Cp4zSTp/qi8v1V+nS5pjhDMDm8B8XbVqkQwJAnI0D moNMCPU30dIyFOfzvK2akOVNU4jA4a547g== X-Received: by 2002:a63:ce0f:: with SMTP id y15mr16282354pgf.249.1630304697876; Sun, 29 Aug 2021 23:24:57 -0700 (PDT) Received: from localhost.localdomain (174-21-72-39.tukw.qwest.net. [174.21.72.39]) by smtp.gmail.com with ESMTPSA id b12sm13942084pff.63.2021.08.29.23.24.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 23:24:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/48] tcg/optimize: Split out copy_propagate Date: Sun, 29 Aug 2021 23:24:10 -0700 Message-Id: <20210830062451.639572-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830062451.639572-1-richard.henderson@linaro.org> References: <20210830062451.639572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Continue splitting tcg_optimize. Signed-off-by: Richard Henderson --- tcg/optimize.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.25.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tcg/optimize.c b/tcg/optimize.c index b1b5096a9d..a668c5f0df 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -611,6 +611,19 @@ static void init_arguments(OptContext *ctx, TCGOp *op, int nb_args) } } +static void copy_propagate(OptContext *ctx, TCGOp *op, + int nb_oargs, int nb_iargs) +{ + TCGContext *s = ctx->tcg; + + for (int i = nb_oargs; i < nb_oargs + nb_iargs; i++) { + TCGTemp *ts = arg_temp(op->args[i]); + if (ts && ts_is_copy(ts)) { + op->args[i] = temp_arg(find_better_copy(s, ts)); + } + } +} + /* Propagate constants and copies, fold constant expressions. */ void tcg_optimize(TCGContext *s) { @@ -646,14 +659,7 @@ void tcg_optimize(TCGContext *s) nb_iargs = def->nb_iargs; } init_arguments(&ctx, op, nb_oargs + nb_iargs); - - /* Do copy propagation */ - for (i = nb_oargs; i < nb_oargs + nb_iargs; i++) { - TCGTemp *ts = arg_temp(op->args[i]); - if (ts && ts_is_copy(ts)) { - op->args[i] = temp_arg(find_better_copy(s, ts)); - } - } + copy_propagate(&ctx, op, nb_oargs, nb_iargs); /* For commutative operations make constant second argument */ switch (opc) {