From patchwork Fri Jan 15 21:04:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 363775 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp209187jap; Fri, 15 Jan 2021 13:11:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKamNoSQNM0IENx8+zV8ntdY2JODY1jqjxSACjxYVYiL5prcZ0++EkVzI8pBMCVxcVEUjU X-Received: by 2002:a25:2e4c:: with SMTP id b12mr21036094ybn.308.1610745101431; Fri, 15 Jan 2021 13:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610745101; cv=none; d=google.com; s=arc-20160816; b=otcYEPVFxm/MgUqrvNZG/VCMZKF3hqr+L8H/sArdaJgMvRsA3BoiG0lDWPSCLXRW6R n/zcnBxdJCFU46gGP3k/V/dnL/WW/EZz6QkG5++1KCRpLFX9maFmhlhyp2adq/Nw2Z9l M+HFpQJ2g6KN1mZc0HjVvqHB0V65A6vUr9Z91dNiKmMwBW41o3ZJwMyi6yMY41JCJ6sJ VkSu9IGyokwvOrKpZD0BhdgRJ4A8Xb6L2n8OTJS9c+/dpHTvz7OfcNbzQxlg8wQ09/4k BVpwGeTGm9ud/T8iwJVysfO/HLaswvpvo8xBr9oDkgvM2yST3/ffLl/nBPZuAqcVaq6a 0XHw== 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=aaFp/1lSSPP6WRQBD7tlB4PsGTqLnK3cNb0Bx6YGQzo=; b=kzL8qvJgBSt1YNEX2OLZlTPpkiViFlkLfIQpNkEQqdaxqes6xOxJ87y9/b+58yLYCa kpXUFlMRcpoJ62Wq4apmjOFUh+RzbFkxSTXCF+HhUm2qnr7vYz0URRsBm2EbxfUc4kbL 1etoN3u+8lyLOwE/qNMpDx0NuOw6CLommPlaByEdOuUUggF6vXuWgx3DapzL4CNl8bak IYkspQX2CKhWQk9TRJWPexNhWnuG3swXP6+LkmjgAGOJPhSLVK80f7kbgMsFCzDz4FDy g6W2lGdi+hrnNhaJsLY5C5bxptneruQwC6T0r5hF9K5Hq5Z5eAZKzKKXBbCkA3PPEfMW TyCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vz5x8Icv; 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 c18si8423717ybq.10.2021.01.15.13.11.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jan 2021 13:11:41 -0800 (PST) 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=Vz5x8Icv; 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]:59742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0WNg-0002fm-Ta for patch@linaro.org; Fri, 15 Jan 2021 16:11:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0WHW-0003sj-5c for qemu-devel@nongnu.org; Fri, 15 Jan 2021 16:05:20 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:46630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0WHU-0004FE-9k for qemu-devel@nongnu.org; Fri, 15 Jan 2021 16:05:17 -0500 Received: by mail-pf1-x435.google.com with SMTP id w2so6237188pfc.13 for ; Fri, 15 Jan 2021 13:05:15 -0800 (PST) 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=aaFp/1lSSPP6WRQBD7tlB4PsGTqLnK3cNb0Bx6YGQzo=; b=Vz5x8Icv2XB//uRcuFkHy7ZIPribYvkbwPw4/eapTRgyno9GWCprf70REbPFk+V4Te 8PH0/OG3u7VVvDArNzTHqsknjAD1RzgCvH79yrhJap2Cl2+21SQZqYoiXHBZLy4n5SIl oKPOf1QV9tOLXzzEp4BFnNOjLJmC8HO46GDrsKIUOwbr0dcAAjAYcxm1embwP+gqwR8t 9RbLx6SAtPmCA+bQyiLtWVQK/wMjx4F1u7akrDyDsa+aGmIY9daitLIIzO9Xu0Usk920 Rrbk8sD9t98qRhCjx+wNbfyMN5aAhU/3H8vuL4kLNcBo0gCrDG8cFQ1yoL73WviAdZSZ FAQA== 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=aaFp/1lSSPP6WRQBD7tlB4PsGTqLnK3cNb0Bx6YGQzo=; b=lKduwJNQ7OE5tkIB2g/hZED7SJoBAEQo61uiVIyEXOjkEHDYhXFeMnNI/Spr43r2u0 WdBt6bRKt3S9qCyjbx/PsTV1CNAZ6OZSvqtHPC451N7lAlTT8XV8bGCkE5B38ftUmdi+ B41a3I1IwpXz28TCV6QEp4YDbfbrIOjxcBNP/SsIrjDqC0LWZJvIhcxOPmYGlaKgZ6LV IUaEOR+h/wawpX9+m6D1UM2d7YNGN8olZBfiDnMAJZoZLCDwRgu6Tj3aZlIzjRNYVY9L kN4zRNjAuzRfuCDxF8J3sC73pfuoxZYqhNP5IiezxDHQiKB5Hee7+iCDapT5/7o7iyy6 VZZw== X-Gm-Message-State: AOAM532QFIGNIwerFJjcCQZ5/UBYxcF1+qM6f0OMtZfmrLttl7j10eO6 4j6uGwiH/6HfNf8wtBsamGw1ygU2ufakYejc X-Received: by 2002:a63:fb54:: with SMTP id w20mr14342396pgj.419.1610744715101; Fri, 15 Jan 2021 13:05:15 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id h15sm8920221pfo.71.2021.01.15.13.05.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 13:05:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/22] tcg/sparc: Split out target constraints to tcg-target-con-str.h Date: Fri, 15 Jan 2021 11:04:45 -1000 Message-Id: <20210115210456.1053477-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210115210456.1053477-1-richard.henderson@linaro.org> References: <20210115210456.1053477-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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" Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target-con-str.h | 22 +++++++++++++++++ tcg/sparc/tcg-target.h | 5 +--- tcg/sparc/tcg-target.c.inc | 45 +++++----------------------------- 3 files changed, 29 insertions(+), 43 deletions(-) create mode 100644 tcg/sparc/tcg-target-con-str.h -- 2.25.1 diff --git a/tcg/sparc/tcg-target-con-str.h b/tcg/sparc/tcg-target-con-str.h new file mode 100644 index 0000000000..6dc5b95f33 --- /dev/null +++ b/tcg/sparc/tcg-target-con-str.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Define Sparc target-specific operand constraints. + * Copyright (c) 2021 Linaro + */ + +/* + * Define constraint letters for register sets: + * REGS(letter, register_mask) + */ +REGS('r', 0xffffffff) +REGS('R', ALL_64) +REGS('s', 0xffffffff & ~RESERVE_QLDST) +REGS('S', ALL_64 & ~RESERVE_QLDST) + +/* + * Define constraint letters for constants: + * CONST(letter, TCG_CT_CONST_* bit set) + */ +CONST('I', TCG_CT_CONST_S11) +CONST('J', TCG_CT_CONST_S13) +CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index 95ab9af955..5185b00524 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -66,10 +66,6 @@ typedef enum { TCG_REG_I7, } TCGReg; -#define TCG_CT_CONST_S11 0x100 -#define TCG_CT_CONST_S13 0x200 -#define TCG_CT_CONST_ZERO 0x400 - /* used for function call generation */ #define TCG_REG_CALL_STACK TCG_REG_O6 @@ -172,5 +168,6 @@ extern bool use_vis3_instructions; void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t); #define TCG_TARGET_NEED_POOL_LABELS +#define TCG_TARGET_CON_STR_H #endif diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 28b5b6559a..ea2b3274d4 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -67,6 +67,10 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { # define SPARC64 0 #endif +#define TCG_CT_CONST_S11 0x100 +#define TCG_CT_CONST_S13 0x200 +#define TCG_CT_CONST_ZERO 0x400 + /* Note that sparcv8plus can only hold 64 bit quantities in %g and %o registers. These are saved manually by the kernel in full 64-bit slots. The %i and %l registers are saved by the register window @@ -79,6 +83,8 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { # define ALL_64 0xffffu #endif +#define RESERVE_QLDST (7u << TCG_REG_O0) /* O0, O1, O2 */ + /* Define some temporary registers. T2 is used for constant generation. */ #define TCG_REG_T1 TCG_REG_G1 #define TCG_REG_T2 TCG_REG_O7 @@ -320,45 +326,6 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type, return true; } -/* parse target specific constraints */ -static const char *target_parse_constraint(TCGArgConstraint *ct, - const char *ct_str, TCGType type) -{ - switch (*ct_str++) { - case 'r': - ct->regs = 0xffffffff; - break; - case 'R': - ct->regs = ALL_64; - break; - case 'A': /* qemu_ld/st address constraint */ - ct->regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; - reserve_helpers: - tcg_regset_reset_reg(ct->regs, TCG_REG_O0); - tcg_regset_reset_reg(ct->regs, TCG_REG_O1); - tcg_regset_reset_reg(ct->regs, TCG_REG_O2); - break; - case 's': /* qemu_st data 32-bit constraint */ - ct->regs = 0xffffffff; - goto reserve_helpers; - case 'S': /* qemu_st data 64-bit constraint */ - ct->regs = ALL_64; - goto reserve_helpers; - case 'I': - ct->ct |= TCG_CT_CONST_S11; - break; - case 'J': - ct->ct |= TCG_CT_CONST_S13; - break; - case 'Z': - ct->ct |= TCG_CT_CONST_ZERO; - break; - default: - return NULL; - } - return ct_str; -} - /* test if a constant matches the constraint */ static inline int tcg_target_const_match(tcg_target_long val, TCGType type, const TCGArgConstraint *arg_ct)