mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 13:05:28 +00:00
tcg: Generalize TCGOp parameters
We had two fields specific to INDEX_op_call. Rename these and add some macros so that the fields may be reused for other opcodes. Backports commit cd9090aa9dbba30db8aec9a2fc103aaf1ab0f5a7 from qemu
This commit is contained in:
parent
7fe5f620df
commit
140058221d
|
@ -627,8 +627,8 @@ void tcg_optimize(TCGContext *s)
|
|||
/* Count the arguments, and initialize the temps that are
|
||||
going to be used */
|
||||
if (opc == INDEX_op_call) {
|
||||
nb_oargs = op->callo;
|
||||
nb_iargs = op->calli;
|
||||
nb_oargs = TCGOP_CALLO(op);
|
||||
nb_iargs = TCGOP_CALLI(op);
|
||||
for (i = 0; i < nb_oargs + nb_iargs; i++) {
|
||||
TCGTemp *ts = arg_temp(op->args[i]);
|
||||
if (ts) {
|
||||
|
|
|
@ -1086,7 +1086,7 @@ void tcg_gen_callN(TCGContext *s, void *func, TCGTemp *ret, int nargs, TCGTemp *
|
|||
} else {
|
||||
nb_rets = 0;
|
||||
}
|
||||
op->callo = nb_rets;
|
||||
TCGOP_CALLO(op) = nb_rets;
|
||||
|
||||
real_args = 0;
|
||||
for (i = 0; i < nargs; i++) {
|
||||
|
@ -1125,10 +1125,10 @@ void tcg_gen_callN(TCGContext *s, void *func, TCGTemp *ret, int nargs, TCGTemp *
|
|||
}
|
||||
op->args[pi++] = (uintptr_t)func;
|
||||
op->args[pi++] = flags;
|
||||
op->calli = real_args;
|
||||
TCGOP_CALLI(op) = real_args;
|
||||
|
||||
/* Make sure the fields didn't overflow. */
|
||||
tcg_debug_assert(op->calli == real_args);
|
||||
tcg_debug_assert(TCGOP_CALLI(op) == real_args);
|
||||
tcg_debug_assert(pi <= ARRAY_SIZE(op->args));
|
||||
#if defined(__sparc__) && !defined(__arch64__) \
|
||||
&& !defined(CONFIG_TCG_INTERPRETER)
|
||||
|
@ -1345,8 +1345,8 @@ void tcg_dump_ops(TCGContext *s)
|
|||
}
|
||||
} else if (c == INDEX_op_call) {
|
||||
/* variable number of arguments */
|
||||
nb_oargs = op->callo;
|
||||
nb_iargs = op->calli;
|
||||
nb_oargs = TCGOP_CALLO(op);
|
||||
nb_iargs = TCGOP_CALLI(op);
|
||||
nb_cargs = def->nb_cargs;
|
||||
|
||||
/* function name, flags, out args */
|
||||
|
@ -1732,8 +1732,8 @@ static void liveness_pass_1(TCGContext *s)
|
|||
{
|
||||
int call_flags;
|
||||
|
||||
nb_oargs = op->callo;
|
||||
nb_iargs = op->calli;
|
||||
nb_oargs = TCGOP_CALLO(op);
|
||||
nb_iargs = TCGOP_CALLI(op);
|
||||
call_flags = op->args[nb_oargs + nb_iargs + 1];
|
||||
|
||||
/* pure functions can be removed if their result is unused */
|
||||
|
@ -1982,8 +1982,8 @@ static bool liveness_pass_2(TCGContext *s)
|
|||
TCGTemp *arg_ts, *dir_ts;
|
||||
|
||||
if (opc == INDEX_op_call) {
|
||||
nb_oargs = op->callo;
|
||||
nb_iargs = op->calli;
|
||||
nb_oargs = TCGOP_CALLO(op);
|
||||
nb_iargs = TCGOP_CALLI(op);
|
||||
call_flags = op->args[nb_oargs + nb_iargs + 1];
|
||||
} else {
|
||||
nb_iargs = def->nb_iargs;
|
||||
|
@ -2663,8 +2663,8 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
|
|||
|
||||
static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op)
|
||||
{
|
||||
const int nb_oargs = op->callo;
|
||||
const int nb_iargs = op->calli;
|
||||
const int nb_oargs = TCGOP_CALLO(op);
|
||||
const int nb_iargs = TCGOP_CALLI(op);
|
||||
const TCGLifeData arg_life = op->life;
|
||||
int flags, nb_regs, i;
|
||||
TCGReg reg;
|
||||
|
|
|
@ -570,9 +570,9 @@ typedef struct TCGOp {
|
|||
TCGOpcode opc : 8; /* 8 */
|
||||
|
||||
/* The number of out and in parameter for a call. */
|
||||
unsigned calli : 4; /* 12 */
|
||||
unsigned callo : 2; /* 14 */
|
||||
unsigned : 2; /* 16 */
|
||||
/* Parameters for this opcode. See below. */
|
||||
unsigned param1 : 4; /* 12 */
|
||||
unsigned param2 : 4; /* 16 */
|
||||
|
||||
/* Lifetime data of the operands. */
|
||||
unsigned life : 16; /* 32 */
|
||||
|
@ -584,6 +584,9 @@ typedef struct TCGOp {
|
|||
TCGArg args[MAX_OPC_PARAM];
|
||||
} TCGOp;
|
||||
|
||||
#define TCGOP_CALLI(X) (X)->param1
|
||||
#define TCGOP_CALLO(X) (X)->param2
|
||||
|
||||
/* Make sure operands fit in the bitfields above. */
|
||||
QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8));
|
||||
|
||||
|
|
Loading…
Reference in a new issue