tcg: Massage process_op_defs()

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>
This commit is contained in:
Philippe Mathieu-Daudé 2022-12-19 23:09:23 +01:00 committed by Richard Henderson
parent 568e010b89
commit 8940ea0d32
1 changed files with 34 additions and 27 deletions

View File

@ -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? */