From nobody Wed Apr 9 11:48:12 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=1612319291; cv=none; d=zohomail.com; s=zohoarc; b=JNAK0hJ8bh9oWkS+XIsAj+/z9Y1q/Ud2dGHxwsve/3gOtxVpFOxPVtP5UfpTVvv4N22Gc+Qafuq5KdbbAZ0zxPGIR557m5jfbRAWpm0UvihyHwEvIKLnwHd+uQ86a96YThVtruCHdZ5DhOjN82MimRtQ7er4ams8E8Z+2p0T4mI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612319291; h=Content-Transfer-Encoding:Cc: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=RgaHnrXuHrfMPHQIYL9jLCUkdMj6l5Wx64YdF5w4N2M=; b=iK5vCGtRwikZS8NVkfQFCDhPDTM4jnQpTmr3tFs6gFHtiYBcJkPtNYd34tiDMECJObsOojng6ML5ZrarOiv6tT8zFrzwc/6MdOIk7UapwJto4gNlfm+JKSlvmyvP8CxZFvCHqomfN/bjPxoJRJVoCdP8g1sr3Wogasb8nWwfB98= 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 1612319291686908.1454723742146; Tue, 2 Feb 2021 18:28:11 -0800 (PST) Received: from localhost ([::1]:60268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l77tq-0006Ln-Lk for importer@patchew.org; Tue, 02 Feb 2021 21:28:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l77iN-0007mG-8p for qemu-devel@nongnu.org; Tue, 02 Feb 2021 21:16:20 -0500 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40321) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l77iG-00011y-Pw for qemu-devel@nongnu.org; Tue, 02 Feb 2021 21:16:18 -0500 Received: by mail-pj1-x1035.google.com with SMTP id z9so3630700pjl.5 for ; Tue, 02 Feb 2021 18:16:11 -0800 (PST) Received: from localhost.localdomain (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id x1sm270301pgj.37.2021.02.02.18.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 18:16:09 -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 :mime-version:content-transfer-encoding; bh=RgaHnrXuHrfMPHQIYL9jLCUkdMj6l5Wx64YdF5w4N2M=; b=B/WW7SSGP1Rl/VohWw7w6QH/V/iqQfBvNXdhdY8apIiJSwPN51kMQOXqlEYBgc4h4X Lx1jmlNcMvc59QpoLKMiw0w1bzU3rXXnSkBI3tk1R2eYqksxqADyZAAzs0DSW68v7UMx 8h+spN2Vp6Nb//8POLVqIzNgRXFg1IFyIqT049ZPnQbmyXRexHDaULMNT0FOnG6Fy7jF evV+n0J7l6LqfwVX9ii5oVegCSbKPSl/lfv+wb2i4DKLL7RooxgsDoLRLpGPoISs9oFE S56KlXpyckgek9r44YmV2whlL7Je48atKIRxJkpr2f2NgFiEF4pCJTdDcKCbRqbXTsbD LM/Q== 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:mime-version:content-transfer-encoding; bh=RgaHnrXuHrfMPHQIYL9jLCUkdMj6l5Wx64YdF5w4N2M=; b=qpOk815M8leFGBc5odfJBtv5eD6kYr86gIHaRV4wYlG+FpqxSJ56OqdHtLPN+R3g9a J9J0qmtXuOVHW7ILWjrcO5Edw5AAKxG2D6yRHQvGo9KbeIhz5I10AIbhJ1Wl/Gy2Friu Ah0ULTXwFNTaBC17O4chQNsnpR14lsBovxFaUi4CesWOBNg0WgmtttoMzlXVaMgk0iAm uSXQzQ4ScUMSCBJxAjTytzO0cEaeexUVNCpSfk8Cqus9Z5L5ow2P0o1ERTfo/qpIyy5r VCRORJyPBlAUolIQ8ZsH3mmjv0GHEcKKbWqIIj9F1FieQaBYXrbnIfHHlMpDyBz0My4B nyNA== X-Gm-Message-State: AOAM530AwQIFejunqGQM337LVUjkTgYaVjRjRlXQZW+4pRmJ9pOaosKD S3iL2OK6PoU0CPMVNLjIHPLwOLNG/kmHNWng X-Google-Smtp-Source: ABdhPJwxXWgD6+xHxY19m2fUUCYZ8EOvUGsGr5hPXhqUkxy6z6Ptm99CXqauZ8CJTGtq9n5A+1ddyA== X-Received: by 2002:a17:90a:2848:: with SMTP id p8mr858751pjf.232.1612318570351; Tue, 02 Feb 2021 18:16:10 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 11/24] tcg/riscv: Split out target constraints to tcg-target-con-str.h Date: Tue, 2 Feb 2021 16:15:37 -1000 Message-Id: <20210203021550.375058-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210203021550.375058-1-richard.henderson@linaro.org> References: <20210203021550.375058-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: , Cc: peter.maydell@linaro.org 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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target-con-str.h | 21 ++++++++++++++ tcg/riscv/tcg-target.h | 1 + tcg/riscv/tcg-target.c.inc | 52 +++++++++------------------------- 3 files changed, 35 insertions(+), 39 deletions(-) create mode 100644 tcg/riscv/tcg-target-con-str.h diff --git a/tcg/riscv/tcg-target-con-str.h b/tcg/riscv/tcg-target-con-str.h new file mode 100644 index 0000000000..8d8afaee53 --- /dev/null +++ b/tcg/riscv/tcg-target-con-str.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Define RISC-V target-specific operand constraints. + * Copyright (c) 2021 Linaro + */ + +/* + * Define constraint letters for register sets: + * REGS(letter, register_mask) + */ +REGS('r', ALL_GENERAL_REGS) +REGS('L', ALL_GENERAL_REGS & ~SOFTMMU_RESERVE_REGS) + +/* + * Define constraint letters for constants: + * CONST(letter, TCG_CT_CONST_* bit set) + */ +CONST('I', TCG_CT_CONST_S12) +CONST('N', TCG_CT_CONST_N12) +CONST('M', TCG_CT_CONST_M12) +CONST('Z', TCG_CT_CONST_ZERO) diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h index 727c8df418..daf3ef7b5c 100644 --- a/tcg/riscv/tcg-target.h +++ b/tcg/riscv/tcg-target.h @@ -171,5 +171,6 @@ void tb_target_set_jmp_target(uintptr_t, uintptr_t, uin= tptr_t, uintptr_t); #define TCG_TARGET_NEED_POOL_LABELS =20 #define TCG_TARGET_HAS_MEMORY_BSWAP 0 +#define TCG_TARGET_CON_STR_H =20 #endif diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 71c0badc02..20d5b5ef01 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -122,6 +122,19 @@ static const int tcg_target_call_oarg_regs[] =3D { #define TCG_CT_CONST_N12 0x400 #define TCG_CT_CONST_M12 0x800 =20 +#define ALL_GENERAL_REGS MAKE_64BIT_MASK(0, 32) +/* + * For softmmu, we need to avoid conflicts with the first 5 + * argument registers to call the helper. Some of these are + * also used for the tlb lookup. + */ +#ifdef CONFIG_SOFTMMU +#define SOFTMMU_RESERVE_REGS MAKE_64BIT_MASK(TCG_REG_A0, 5) +#else +#define SOFTMMU_RESERVE_REGS 0 +#endif + + static inline tcg_target_long sextreg(tcg_target_long val, int pos, int le= n) { if (TCG_TARGET_REG_BITS =3D=3D 32) { @@ -131,45 +144,6 @@ static inline tcg_target_long sextreg(tcg_target_long = val, int pos, int len) } } =20 -/* parse target specific constraints */ -static const char *target_parse_constraint(TCGArgConstraint *ct, - const char *ct_str, TCGType typ= e) -{ - switch (*ct_str++) { - case 'r': - ct->regs =3D 0xffffffff; - break; - case 'L': - /* qemu_ld/qemu_st constraint */ - ct->regs =3D 0xffffffff; - /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ -#if defined(CONFIG_SOFTMMU) - tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[0]); - tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[1]); - tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[2]); - tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[3]); - tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[4]); -#endif - break; - case 'I': - ct->ct |=3D TCG_CT_CONST_S12; - break; - case 'N': - ct->ct |=3D TCG_CT_CONST_N12; - break; - case 'M': - ct->ct |=3D TCG_CT_CONST_M12; - break; - case 'Z': - /* we can use a zero immediate as a zero register argument. */ - ct->ct |=3D TCG_CT_CONST_ZERO; - break; - default: - return NULL; - } - return ct_str; -} - /* test if a constant matches the constraint */ static int tcg_target_const_match(tcg_target_long val, TCGType type, const TCGArgConstraint *arg_ct) --=20 2.25.1