From nobody Wed Apr 9 10:36:32 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1599610678; cv=none; d=zohomail.com; s=zohoarc; b=iwsZRMIvHVpFXe7UwR+jJoZd2c0vgu3V2iEwKEkM9Wwqw3sxRxNfmyMSHyozyqMFk9LqcD05u8iCtnXpGJPScI/hFNJOAGxxbpSpm6p1nGUiy/L0EgHweUT1WFVtBGKtenulAKbXHbKD93tOX60LTqk5K5Y+WtZUx8QT9y8NOdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599610678; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2hOHW45ulVj15284ZrX31Jc4JgC7jvorBgpIK9v2dLM=; b=h1Kk2sFhZDITYcv/eu6fsIWRNrtZLs8Nwy+vkbc7fE+1F9YVsE8iSf/rqy9f/Wgl519n8oKmFdFpf8Xf/+eKwxgpWveZzoucf7ExFXgz09qBmXB5JOshjmhipZ5180LgASpBmOVya1LQNXhF/3PK6aEAroAD33xbqKOiNdSyI4g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599610678727430.6255476986995; Tue, 8 Sep 2020 17:17:58 -0700 (PDT) Received: from localhost ([::1]:57444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFnoD-0000xe-9U for importer@patchew.org; Tue, 08 Sep 2020 20:17:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFnnG-0007dK-3X for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:16:58 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:46700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFnnD-00029H-Uv for qemu-devel@nongnu.org; Tue, 08 Sep 2020 20:16:57 -0400 Received: by mail-pg1-x542.google.com with SMTP id 34so705346pgo.13 for ; Tue, 08 Sep 2020 17:16:55 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id 137sm505437pfu.149.2020.09.08.17.16.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:16:53 -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=2hOHW45ulVj15284ZrX31Jc4JgC7jvorBgpIK9v2dLM=; b=pScfQrMzrDKtwywYe59V1Gm0m6l/wVHCATy8pMh8aRBmG4B1cPBmklfHxW4WnBCYZb dkVrKbjpZ+EsiaCbnNJbP0h9yyYHswQqEvQQODNqJwS1EtSV18WHrxJ8LHXmAJEq9JEZ z/frepYuBRqGzC6HnK+L/vtpSLbLDAtq6DUanv3oFguRu9KAtAFgQwXYuu2NtDTXIbp+ C5G8QbFiTc0sdHEC4cp132gJZyh0BeCOETQBXCqO/qgE7ya7MZvlUU9tfXaJQbrh1hV2 B69gaaNrPEEErR62zc07Uta/wDmj17IDloO7xQir57sUBWI61JR44J+ALWh6LgunoipB /IUw== 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=2hOHW45ulVj15284ZrX31Jc4JgC7jvorBgpIK9v2dLM=; b=mChmM5uZ20/2LDzCgcmvcavb16XRld9+AoK8aIumeKkyBvOOdBhkoXye+pGC5bqXOc xuL+VjczU/M8mBBJUcMKuvx93h+Skyxs90qHJcdcbXsC6JdQqGaSSPktGQqexaAVxQ+t swZh1pILvgBWxXeEy+SHuxjbAGGwvQXuExB+NJYoP8nVjatDgQ20kZripzzXiRYZU4OG gOdgTL/BAWNcTD71NLCEDeBiEONRR5UoSrhbYCWqqziqvR9Lx84E1jdKubLnWTBAgnrC FpL851RsLkroVUwpnbf94kgGKUbQcTtY9RzlT6YcuGfyRDrylAHEDWKHPHpmybB6xcp1 CaRQ== X-Gm-Message-State: AOAM5324gUH2j7nDypbq0jmXAYWVJI6m5sw5m31/c1ojswHPvPbVNq/6 5McdJakEJQkOE9grDVMPHYqgBMx69PIgvQ== X-Google-Smtp-Source: ABdhPJxbQ2QJzXFPkqObHrjy92zgqVL9GjWSnq58h8eqxm6jm2Q+P7B7zYyrM52dGQpqpCbmDeuyPA== X-Received: by 2002:a65:6706:: with SMTP id u6mr938619pgf.404.1599610613861; Tue, 08 Sep 2020 17:16:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 03/43] tcg: Move sorted_args into TCGArgConstraint.sort_index Date: Tue, 8 Sep 2020 17:16:07 -0700 Message-Id: <20200909001647.532249-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200909001647.532249-1-richard.henderson@linaro.org> References: <20200909001647.532249-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This uses an existing hole in the TCGArgConstraint structure and will be convenient for keeping the data in one place. Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 +- tcg/tcg.c | 35 +++++++++++++++++------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index a5a0ea4ada..63955ac85b 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -985,6 +985,7 @@ void tcg_dump_op_count(void); typedef struct TCGArgConstraint { uint16_t ct; uint8_t alias_index; + uint8_t sort_index; TCGRegSet regs; } TCGArgConstraint; =20 @@ -1015,7 +1016,6 @@ typedef struct TCGOpDef { uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args; uint8_t flags; TCGArgConstraint *args_ct; - int *sorted_args; #if defined(CONFIG_DEBUG_TCG) int used; #endif diff --git a/tcg/tcg.c b/tcg/tcg.c index dcb38bf1e0..0a04b6cbd9 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -944,7 +944,6 @@ void tcg_context_init(TCGContext *s) int op, total_args, n, i; TCGOpDef *def; TCGArgConstraint *args_ct; - int *sorted_args; TCGTemp *ts; =20 memset(s, 0, sizeof(*s)); @@ -960,14 +959,11 @@ void tcg_context_init(TCGContext *s) } =20 args_ct =3D g_malloc(sizeof(TCGArgConstraint) * total_args); - sorted_args =3D g_malloc(sizeof(int) * total_args); =20 for(op =3D 0; op < NB_OPS; op++) { def =3D &tcg_op_defs[op]; def->args_ct =3D args_ct; - def->sorted_args =3D sorted_args; n =3D def->nb_iargs + def->nb_oargs; - sorted_args +=3D n; args_ct +=3D n; } =20 @@ -2220,20 +2216,23 @@ static int get_constraint_priority(const TCGOpDef *= def, int k) /* sort from highest priority to lowest */ static void sort_constraints(TCGOpDef *def, int start, int n) { - int i, j, p1, p2, tmp; + int i, j; + TCGArgConstraint *a =3D def->args_ct; =20 - for(i =3D 0; i < n; i++) - def->sorted_args[start + i] =3D start + i; - if (n <=3D 1) + for (i =3D 0; i < n; i++) { + a[start + i].sort_index =3D start + i; + } + if (n <=3D 1) { return; - for(i =3D 0; i < n - 1; i++) { - for(j =3D i + 1; j < n; j++) { - p1 =3D get_constraint_priority(def, def->sorted_args[start + i= ]); - p2 =3D get_constraint_priority(def, def->sorted_args[start + j= ]); + } + for (i =3D 0; i < n - 1; i++) { + for (j =3D i + 1; j < n; j++) { + int p1 =3D get_constraint_priority(def, a[start + i].sort_inde= x); + int p2 =3D get_constraint_priority(def, a[start + j].sort_inde= x); if (p1 < p2) { - tmp =3D def->sorted_args[start + i]; - def->sorted_args[start + i] =3D def->sorted_args[start + j= ]; - def->sorted_args[start + j] =3D tmp; + int tmp =3D a[start + i].sort_index; + a[start + i].sort_index =3D a[start + j].sort_index; + a[start + j].sort_index =3D tmp; } } } @@ -3659,7 +3658,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) for (k =3D 0; k < nb_iargs; k++) { TCGRegSet i_preferred_regs, o_preferred_regs; =20 - i =3D def->sorted_args[nb_oargs + k]; + i =3D def->args_ct[nb_oargs + k].sort_index; arg =3D op->args[i]; arg_ct =3D &def->args_ct[i]; ts =3D arg_temp(arg); @@ -3695,7 +3694,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) int k2, i2; reg =3D ts->reg; for (k2 =3D 0 ; k2 < k ; k2++) { - i2 =3D def->sorted_args[nb_oargs + k2]; + i2 =3D def->args_ct[nb_oargs + k2].sort_index; if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && reg =3D=3D new_args[i2]) { goto allocate_in_reg; @@ -3760,7 +3759,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCG= Op *op) =20 /* satisfy the output constraints */ for(k =3D 0; k < nb_oargs; k++) { - i =3D def->sorted_args[k]; + i =3D def->args_ct[k].sort_index; arg =3D op->args[i]; arg_ct =3D &def->args_ct[i]; ts =3D arg_temp(arg); --=20 2.25.1