mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-07 10:50:44 +00:00
tcg: Fold life data into TCGOp
Reduce the size of other bitfields to make room. This reduces the cache footprint of compilation. Backports commit bee158cb4dde35c41632a3a129c869f14a32f8f0 from qemu
This commit is contained in:
parent
b5e765d562
commit
690985a582
|
@ -1401,11 +1401,7 @@ static inline void tcg_la_br_end(TCGContext *s, uint8_t *mem_temps)
|
||||||
static void tcg_liveness_analysis(TCGContext *s)
|
static void tcg_liveness_analysis(TCGContext *s)
|
||||||
{
|
{
|
||||||
uint8_t *dead_temps, *mem_temps;
|
uint8_t *dead_temps, *mem_temps;
|
||||||
int oi, oi_prev, nb_ops;
|
int oi, oi_prev;
|
||||||
|
|
||||||
nb_ops = s->gen_next_op_idx;
|
|
||||||
|
|
||||||
s->op_arg_life = tcg_malloc(s, nb_ops * sizeof(TCGLifeData));
|
|
||||||
|
|
||||||
dead_temps = tcg_malloc(s, s->nb_temps);
|
dead_temps = tcg_malloc(s, s->nb_temps);
|
||||||
mem_temps = tcg_malloc(s, s->nb_temps);
|
mem_temps = tcg_malloc(s, s->nb_temps);
|
||||||
|
@ -1632,7 +1628,7 @@ static void tcg_liveness_analysis(TCGContext *s)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s->op_arg_life[oi] = arg_life;
|
op->life = arg_life;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -2457,7 +2453,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
|
||||||
TCGArg * const args = &s->gen_opparam_buf[op->args];
|
TCGArg * const args = &s->gen_opparam_buf[op->args];
|
||||||
TCGOpcode opc = op->opc;
|
TCGOpcode opc = op->opc;
|
||||||
const TCGOpDef *def = &s->tcg_op_defs[opc];
|
const TCGOpDef *def = &s->tcg_op_defs[opc];
|
||||||
TCGLifeData arg_life = s->op_arg_life[oi];
|
TCGLifeData arg_life = op->life;
|
||||||
|
|
||||||
oi_next = op->next;
|
oi_next = op->next;
|
||||||
#ifdef CONFIG_PROFILER
|
#ifdef CONFIG_PROFILER
|
||||||
|
|
|
@ -585,25 +585,30 @@ typedef struct TCGTempSet {
|
||||||
#define SYNC_ARG 1
|
#define SYNC_ARG 1
|
||||||
typedef uint16_t TCGLifeData;
|
typedef uint16_t TCGLifeData;
|
||||||
|
|
||||||
|
/* The layout here is designed to avoid crossing of a 32-bit boundary.
|
||||||
|
If we do so, gcc adds padding, expanding the size to 12. */
|
||||||
typedef struct TCGOp {
|
typedef struct TCGOp {
|
||||||
TCGOpcode opc : 8;
|
TCGOpcode opc : 8; /* 8 */
|
||||||
|
|
||||||
/* The number of out and in parameter for a call. */
|
|
||||||
unsigned callo : 2;
|
|
||||||
unsigned calli : 6;
|
|
||||||
|
|
||||||
/* Index of the arguments for this op, or 0 for zero-operand ops. */
|
|
||||||
unsigned args : 16;
|
|
||||||
|
|
||||||
/* Index of the prev/next op, or 0 for the end of the list. */
|
/* Index of the prev/next op, or 0 for the end of the list. */
|
||||||
unsigned prev : 16;
|
unsigned prev : 10; /* 18 */
|
||||||
unsigned next : 16;
|
unsigned next : 10; /* 28 */
|
||||||
|
|
||||||
|
/* The number of out and in parameter for a call. */
|
||||||
|
unsigned calli : 4; /* 32 */
|
||||||
|
unsigned callo : 2; /* 34 */
|
||||||
|
|
||||||
|
/* Index of the arguments for this op, or 0 for zero-operand ops. */
|
||||||
|
unsigned args : 14; /* 48 */
|
||||||
|
|
||||||
|
/* Lifetime data of the operands. */
|
||||||
|
unsigned life : 16; /* 64 */
|
||||||
} TCGOp;
|
} TCGOp;
|
||||||
|
|
||||||
/* Make sure operands fit in the bitfields above. */
|
/* Make sure operands fit in the bitfields above. */
|
||||||
QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8));
|
QEMU_BUILD_BUG_ON(NB_OPS > (1 << 8));
|
||||||
QEMU_BUILD_BUG_ON(OPC_BUF_SIZE > (1 << 16));
|
QEMU_BUILD_BUG_ON(OPC_BUF_SIZE > (1 << 10));
|
||||||
QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 16));
|
QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14));
|
||||||
|
|
||||||
/* Make sure that we don't overflow 64 bits without noticing. */
|
/* Make sure that we don't overflow 64 bits without noticing. */
|
||||||
QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8);
|
QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8);
|
||||||
|
@ -746,9 +751,6 @@ struct TCGContext {
|
||||||
uint16_t *tb_jmp_insn_offset; /* tb->jmp_insn_offset if USE_DIRECT_JUMP */
|
uint16_t *tb_jmp_insn_offset; /* tb->jmp_insn_offset if USE_DIRECT_JUMP */
|
||||||
uintptr_t *tb_jmp_target_addr; /* tb->jmp_target_addr if !USE_DIRECT_JUMP */
|
uintptr_t *tb_jmp_target_addr; /* tb->jmp_target_addr if !USE_DIRECT_JUMP */
|
||||||
|
|
||||||
/* liveness analysis */
|
|
||||||
TCGLifeData *op_arg_life;
|
|
||||||
|
|
||||||
TCGRegSet reserved_regs;
|
TCGRegSet reserved_regs;
|
||||||
intptr_t current_frame_offset;
|
intptr_t current_frame_offset;
|
||||||
intptr_t frame_start;
|
intptr_t frame_start;
|
||||||
|
|
Loading…
Reference in a new issue