From patchwork Wed Sep 9 00:16:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249382 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5012548ilg; Tue, 8 Sep 2020 17:17:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9YlxxA/bp+J/uOoJWnpZv8MQ6fJI+dTf6ixYnAJlh5FLuapA7N0H4RraNcEUqOmPYkwxY X-Received: by 2002:a25:afd0:: with SMTP id d16mr2291390ybj.177.1599610630539; Tue, 08 Sep 2020 17:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610630; cv=none; d=google.com; s=arc-20160816; b=rG7zIjiCFd4tZ3Phy/UNSzXSRDpnresLiDjeyNoKnEgs+10YqjRM62oK2X5QrQ37dZ ZSnN99Hlg6j43ljH1Vu7O5H7Z+DEq5VXLIp483K6/77HSHwPnjdu0hRCTGBIqIAz0qpb phCydGY4wjKj1oKuZ+IR/HhwD3r8cTL/mTScQGofAO+tuOMYwNSq0PwRTo6jo9BG22eU neqOBPydaRqvteE3VUzxBj/JbMFxh8wu/SnWnPXF9QVrr0BscjWYMpbkFNEmV44RAWFr wZ1WNQ79TM21rqyfeww5jwA7cM+YTtqty94ixkIyUD5bLJdMA/XkrpKhptq+k+5ghdZs +c9A== 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=2hOHW45ulVj15284ZrX31Jc4JgC7jvorBgpIK9v2dLM=; b=fPy/7vaQHTk6D06JkzlzemZwMusL57+KcnH9xDYK1XMUMkMOJdCs6Bl5WyEf4l9VjT ZaWmhr/mm2tA7kb+z7o75A07nPxHf9VRNx/OExUG9Nogm7BjrBMY/Ai7utG5DMQRbo9K RBSqKoVr8LyjWgsPSw166KZY1wwYD4FZNsgUlFSuyfxsk7jqHv5HUi+UuKDpBBmChOks NFK+7eA2fGaEWK7irQGas8jvBcF6ZdzkD8YsYVOqZBq49ZEQRds9R9WZIbsvk1cYSYfV qDAUd1KgFbF+sqYB+TqTTAUk3XZxLsLtcH1mEB0x0tCCNB1HONbB6mccNsQCQKpJ1YhU smzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pScfQrMz; 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 d77si912894ybh.284.2020.09.08.17.17.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Sep 2020 17:17:10 -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=pScfQrMz; 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]:53372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFnnR-0007f2-W1 for patch@linaro.org; Tue, 08 Sep 2020 20:17:10 -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) 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-Received: by 2002:a65:6706:: with SMTP id u6mr938619pgf.404.1599610613861; Tue, 08 Sep 2020 17:16:53 -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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.25.1 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; @@ -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; memset(s, 0, sizeof(*s)); @@ -960,14 +959,11 @@ void tcg_context_init(TCGContext *s) } args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args); - sorted_args = g_malloc(sizeof(int) * total_args); for(op = 0; op < NB_OPS; op++) { def = &tcg_op_defs[op]; def->args_ct = args_ct; - def->sorted_args = sorted_args; n = def->nb_iargs + def->nb_oargs; - sorted_args += n; args_ct += n; } @@ -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 = def->args_ct; - for(i = 0; i < n; i++) - def->sorted_args[start + i] = start + i; - if (n <= 1) + for (i = 0; i < n; i++) { + a[start + i].sort_index = start + i; + } + if (n <= 1) { return; - for(i = 0; i < n - 1; i++) { - for(j = i + 1; j < n; j++) { - p1 = get_constraint_priority(def, def->sorted_args[start + i]); - p2 = get_constraint_priority(def, def->sorted_args[start + j]); + } + for (i = 0; i < n - 1; i++) { + for (j = i + 1; j < n; j++) { + int p1 = get_constraint_priority(def, a[start + i].sort_index); + int p2 = get_constraint_priority(def, a[start + j].sort_index); if (p1 < p2) { - tmp = def->sorted_args[start + i]; - def->sorted_args[start + i] = def->sorted_args[start + j]; - def->sorted_args[start + j] = tmp; + int tmp = a[start + i].sort_index; + a[start + i].sort_index = a[start + j].sort_index; + a[start + j].sort_index = tmp; } } } @@ -3659,7 +3658,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) for (k = 0; k < nb_iargs; k++) { TCGRegSet i_preferred_regs, o_preferred_regs; - i = def->sorted_args[nb_oargs + k]; + i = def->args_ct[nb_oargs + k].sort_index; arg = op->args[i]; arg_ct = &def->args_ct[i]; ts = arg_temp(arg); @@ -3695,7 +3694,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) int k2, i2; reg = ts->reg; for (k2 = 0 ; k2 < k ; k2++) { - i2 = def->sorted_args[nb_oargs + k2]; + i2 = def->args_ct[nb_oargs + k2].sort_index; if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && reg == new_args[i2]) { goto allocate_in_reg; @@ -3760,7 +3759,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) /* satisfy the output constraints */ for(k = 0; k < nb_oargs; k++) { - i = def->sorted_args[k]; + i = def->args_ct[k].sort_index; arg = op->args[i]; arg_ct = &def->args_ct[i]; ts = arg_temp(arg);