[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/47] tcg: Massage process_op_defs()
From: |
Richard Henderson |
Subject: |
[PULL 18/47] tcg: Massage process_op_defs() |
Date: |
Thu, 29 Dec 2022 16:01:52 -0800 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
In preparation of introducing paired registers,
massage a bit process_op_defs()'s switch case.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
[PMD: Split from bigger patch, 1/3]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221219220925.79218-2-philmd@linaro.org>
---
tcg/tcg.c | 61 +++++++++++++++++++++++++++++++------------------------
1 file changed, 34 insertions(+), 27 deletions(-)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index c330d114bc..92141bd79a 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2012,7 +2012,7 @@ static void process_op_defs(TCGContext *s)
for (op = 0; op < NB_OPS; op++) {
TCGOpDef *def = &tcg_op_defs[op];
const TCGTargetOpDef *tdefs;
- int i, nb_args;
+ int i, o, nb_args;
if (def->flags & TCG_OPF_NOT_PRESENT) {
continue;
@@ -2034,53 +2034,60 @@ static void process_op_defs(TCGContext *s)
for (i = 0; i < nb_args; i++) {
const char *ct_str = tdefs->args_ct_str[i];
+ bool input_p = i >= def->nb_oargs;
+
/* Incomplete TCGTargetOpDef entry. */
tcg_debug_assert(ct_str != NULL);
- while (*ct_str != '\0') {
- switch(*ct_str) {
- case '0' ... '9':
- {
- int oarg = *ct_str - '0';
- tcg_debug_assert(ct_str == tdefs->args_ct_str[i]);
- tcg_debug_assert(oarg < def->nb_oargs);
- tcg_debug_assert(def->args_ct[oarg].regs != 0);
- def->args_ct[i] = def->args_ct[oarg];
- /* The output sets oalias. */
- def->args_ct[oarg].oalias = true;
- def->args_ct[oarg].alias_index = i;
- /* The input sets ialias. */
- def->args_ct[i].ialias = true;
- def->args_ct[i].alias_index = oarg;
- }
- ct_str++;
- break;
- case '&':
- def->args_ct[i].newreg = true;
- ct_str++;
- break;
+ switch (*ct_str) {
+ case '0' ... '9':
+ o = *ct_str - '0';
+ tcg_debug_assert(input_p);
+ tcg_debug_assert(o < def->nb_oargs);
+ tcg_debug_assert(def->args_ct[o].regs != 0);
+ tcg_debug_assert(!def->args_ct[o].oalias);
+ def->args_ct[i] = def->args_ct[o];
+ /* The output sets oalias. */
+ def->args_ct[o].oalias = 1;
+ def->args_ct[o].alias_index = i;
+ /* The input sets ialias. */
+ def->args_ct[i].ialias = 1;
+ def->args_ct[i].alias_index = o;
+ tcg_debug_assert(ct_str[1] == '\0');
+ continue;
+
+ case '&':
+ tcg_debug_assert(!input_p);
+ def->args_ct[i].newreg = true;
+ ct_str++;
+ break;
+ }
+
+ do {
+ switch (*ct_str) {
case 'i':
def->args_ct[i].ct |= TCG_CT_CONST;
- ct_str++;
break;
/* Include all of the target-specific constraints. */
#undef CONST
#define CONST(CASE, MASK) \
- case CASE: def->args_ct[i].ct |= MASK; ct_str++; break;
+ case CASE: def->args_ct[i].ct |= MASK; break;
#define REGS(CASE, MASK) \
- case CASE: def->args_ct[i].regs |= MASK; ct_str++; break;
+ case CASE: def->args_ct[i].regs |= MASK; break;
#include "tcg-target-con-str.h"
#undef REGS
#undef CONST
default:
+ case '0' ... '9':
+ case '&':
/* Typo in TCGTargetOpDef constraint. */
g_assert_not_reached();
}
- }
+ } while (*++ct_str != '\0');
}
/* TCGTargetOpDef entry with too much information? */
--
2.34.1
- [PULL 07/47] target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt, (continued)
- [PULL 07/47] target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_maybe_interrupt, Richard Henderson, 2022/12/29
- [PULL 15/47] tcg: Fix tcg_reg_alloc_dup*, Richard Henderson, 2022/12/29
- [PULL 08/47] target/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in cpu_interrupt_exittb, Richard Henderson, 2022/12/29
- [PULL 11/47] accel/tcg: Use QEMU_IOTHREAD_LOCK_GUARD in io_readx/io_writex, Richard Henderson, 2022/12/29
- [PULL 12/47] tcg: Tidy tcg_reg_alloc_op, Richard Henderson, 2022/12/29
- [PULL 13/47] tcg: Remove TCG_TARGET_STACK_GROWSUP, Richard Henderson, 2022/12/29
- [PULL 10/47] hw/ppc: Use QEMU_IOTHREAD_LOCK_GUARD in ppc_set_irq, Richard Henderson, 2022/12/29
- [PULL 16/47] tcg: Centralize updates to reg_to_temp, Richard Henderson, 2022/12/29
- [PULL 14/47] tci: MAX_OPC_PARAM_IARGS is no longer used, Richard Henderson, 2022/12/29
- [PULL 17/47] tcg: Remove check_regs, Richard Henderson, 2022/12/29
- [PULL 18/47] tcg: Massage process_op_defs(),
Richard Henderson <=
- [PULL 20/47] accel/tcg: Set cflags_next_tb in cpu_common_initfn, Richard Henderson, 2022/12/29
- [PULL 19/47] tcg: Introduce paired register allocation, Richard Henderson, 2022/12/29
- [PULL 21/47] target/sparc: Avoid TCGV_{LOW,HIGH}, Richard Henderson, 2022/12/29
- [PULL 22/47] tcg: Move TCG_{LOW,HIGH} to tcg-internal.h, Richard Henderson, 2022/12/29
- [PULL 36/47] tcg: Vary the allocation size for TCGOp, Richard Henderson, 2022/12/29
- [PULL 26/47] tcg: Move TCG_TYPE_COUNT outside enum, Richard Henderson, 2022/12/29
- [PULL 33/47] accel/tcg/plugin: Avoid duplicate copy in copy_call, Richard Henderson, 2022/12/29
- [PULL 34/47] accel/tcg/plugin: Use copy_op in append_{udata,mem}_cb, Richard Henderson, 2022/12/29
- [PULL 23/47] tcg: Add temp_subindex to TCGTemp, Richard Henderson, 2022/12/29
- [PULL 35/47] tcg: Pass number of arguments to tcg_emit_op() / tcg_op_insert_*(), Richard Henderson, 2022/12/29