All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PULL 12/24] tcg/s390: Split out target constraints to tcg-target-con-str.h
Date: Tue,  2 Feb 2021 16:15:38 -1000	[thread overview]
Message-ID: <20210203021550.375058-13-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210203021550.375058-1-richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/s390/tcg-target-con-str.h | 28 ++++++++++++++++++
 tcg/s390/tcg-target.h         |  1 +
 tcg/s390/tcg-target.c.inc     | 53 +++++++++--------------------------
 3 files changed, 42 insertions(+), 40 deletions(-)
 create mode 100644 tcg/s390/tcg-target-con-str.h

diff --git a/tcg/s390/tcg-target-con-str.h b/tcg/s390/tcg-target-con-str.h
new file mode 100644
index 0000000000..892d8f8c06
--- /dev/null
+++ b/tcg/s390/tcg-target-con-str.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Define S390 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)
+/*
+ * A (single) even/odd pair for division.
+ * TODO: Add something to the register allocator to allow
+ * this kind of regno+1 pairing to be done more generally.
+ */
+REGS('a', 1u << TCG_REG_R2)
+REGS('b', 1u << TCG_REG_R3)
+
+/*
+ * Define constraint letters for constants:
+ * CONST(letter, TCG_CT_CONST_* bit set)
+ */
+CONST('A', TCG_CT_CONST_S33)
+CONST('I', TCG_CT_CONST_S16)
+CONST('J', TCG_CT_CONST_S32)
+CONST('Z', TCG_CT_CONST_ZERO)
diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
index 641464eea4..c43d6aba84 100644
--- a/tcg/s390/tcg-target.h
+++ b/tcg/s390/tcg-target.h
@@ -159,5 +159,6 @@ static inline void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_rx,
 #define TCG_TARGET_NEED_LDST_LABELS
 #endif
 #define TCG_TARGET_NEED_POOL_LABELS
+#define TCG_TARGET_CON_STR_H
 
 #endif
diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc
index 8517e55232..3fec7fec5f 100644
--- a/tcg/s390/tcg-target.c.inc
+++ b/tcg/s390/tcg-target.c.inc
@@ -42,6 +42,19 @@
 #define TCG_CT_CONST_S33   0x400
 #define TCG_CT_CONST_ZERO  0x800
 
+#define ALL_GENERAL_REGS     MAKE_64BIT_MASK(0, 16)
+/*
+ * For softmmu, we need to avoid conflicts with the first 3
+ * argument registers to perform the tlb lookup, and to call
+ * the helper function.
+ */
+#ifdef CONFIG_SOFTMMU
+#define SOFTMMU_RESERVE_REGS MAKE_64BIT_MASK(TCG_REG_R2, 3)
+#else
+#define SOFTMMU_RESERVE_REGS 0
+#endif
+
+
 /* Several places within the instruction set 0 means "no register"
    rather than TCG_REG_R0.  */
 #define TCG_REG_NONE    0
@@ -403,46 +416,6 @@ static bool patch_reloc(tcg_insn_unit *src_rw, int type,
     return false;
 }
 
-/* parse target specific constraints */
-static const char *target_parse_constraint(TCGArgConstraint *ct,
-                                           const char *ct_str, TCGType type)
-{
-    switch (*ct_str++) {
-    case 'r':                  /* all registers */
-        ct->regs = 0xffff;
-        break;
-    case 'L':                  /* qemu_ld/st constraint */
-        ct->regs = 0xffff;
-        tcg_regset_reset_reg(ct->regs, TCG_REG_R2);
-        tcg_regset_reset_reg(ct->regs, TCG_REG_R3);
-        tcg_regset_reset_reg(ct->regs, TCG_REG_R4);
-        break;
-    case 'a':                  /* force R2 for division */
-        ct->regs = 0;
-        tcg_regset_set_reg(ct->regs, TCG_REG_R2);
-        break;
-    case 'b':                  /* force R3 for division */
-        ct->regs = 0;
-        tcg_regset_set_reg(ct->regs, TCG_REG_R3);
-        break;
-    case 'A':
-        ct->ct |= TCG_CT_CONST_S33;
-        break;
-    case 'I':
-        ct->ct |= TCG_CT_CONST_S16;
-        break;
-    case 'J':
-        ct->ct |= TCG_CT_CONST_S32;
-        break;
-    case 'Z':
-        ct->ct |= 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)
-- 
2.25.1



  parent reply	other threads:[~2021-02-03  2:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03  2:15 [PULL 00/24] tcg patch queue Richard Henderson
2021-02-03  2:15 ` [PULL 01/24] tcg/tci: Drop L and S constraints Richard Henderson
2021-02-03  2:15 ` [PULL 02/24] tcg/tci: Remove TCG_TARGET_HAS_* ifdefs Richard Henderson
2021-02-03  2:15 ` [PULL 03/24] tcg/i386: Move constraint type check to tcg_target_const_match Richard Henderson
2021-02-03  2:15 ` [PULL 04/24] tcg/i386: Tidy register constraint definitions Richard Henderson
2021-02-03  2:15 ` [PULL 05/24] tcg/i386: Split out target constraints to tcg-target-con-str.h Richard Henderson
2021-02-03  2:15 ` [PULL 06/24] tcg/arm: " Richard Henderson
2021-02-03  2:15 ` [PULL 07/24] tcg/aarch64: " Richard Henderson
2021-02-03  2:15 ` [PULL 08/24] tcg/ppc: " Richard Henderson
2021-02-03  2:15 ` [PULL 09/24] tcg/tci: " Richard Henderson
2021-02-03  2:15 ` [PULL 10/24] tcg/mips: " Richard Henderson
2021-02-03  2:15 ` [PULL 11/24] tcg/riscv: " Richard Henderson
2021-02-03  2:15 ` Richard Henderson [this message]
2021-02-03  2:15 ` [PULL 13/24] tcg/sparc: " Richard Henderson
2021-02-03  2:15 ` [PULL 14/24] tcg: Remove TCG_TARGET_CON_STR_H Richard Henderson
2021-02-03  2:15 ` [PULL 15/24] tcg/i386: Split out constraint sets to tcg-target-con-set.h Richard Henderson
2021-02-03  2:15 ` [PULL 16/24] tcg/aarch64: " Richard Henderson
2021-02-03  2:15 ` [PULL 17/24] tcg/arm: " Richard Henderson
2021-02-03  2:15 ` [PULL 18/24] tcg/mips: " Richard Henderson
2021-02-03  2:15 ` [PULL 19/24] tcg/ppc: " Richard Henderson
2021-02-03  2:15 ` [PULL 20/24] tcg/riscv: " Richard Henderson
2021-02-03  2:15 ` [PULL 21/24] tcg/s390: " Richard Henderson
2021-02-03  2:15 ` [PULL 22/24] tcg/sparc: " Richard Henderson
2021-02-03  2:15 ` [PULL 23/24] tcg/tci: " Richard Henderson
2021-02-03  2:15 ` [PULL 24/24] tcg: Remove TCG_TARGET_CON_SET_H Richard Henderson
2021-02-03  2:39 ` [PULL 00/24] tcg patch queue no-reply
2021-02-04 10:00 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210203021550.375058-13-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.