mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
tcg: Dump register preference info with liveness
Backports commit 1894f69a612b35c2a39b44a824da04d74bfe324a from qemu
This commit is contained in:
parent
494d802781
commit
b356212b33
|
@ -1399,7 +1399,7 @@ static inline TCGReg tcg_regset_first(TCGRegSet d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tcg_dump_ops(TCGContext *s)
|
static void tcg_dump_ops(TCGContext *s, bool have_prefs)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
TCGOp *op;
|
TCGOp *op;
|
||||||
|
@ -1534,12 +1534,15 @@ void tcg_dump_ops(TCGContext *s)
|
||||||
col += qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", op->args[k]);
|
col += qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", op->args[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (op->life) {
|
|
||||||
unsigned life = op->life;
|
|
||||||
|
|
||||||
for (; col < 48; ++col) {
|
if (have_prefs || op->life) {
|
||||||
|
for (; col < 40; ++col) {
|
||||||
putc(' ', qemu_logfile);
|
putc(' ', qemu_logfile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op->life) {
|
||||||
|
unsigned life = op->life;
|
||||||
|
|
||||||
if (life & (SYNC_ARG * 3)) {
|
if (life & (SYNC_ARG * 3)) {
|
||||||
qemu_log(" sync:");
|
qemu_log(" sync:");
|
||||||
|
@ -1559,6 +1562,33 @@ void tcg_dump_ops(TCGContext *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (have_prefs) {
|
||||||
|
for (i = 0; i < nb_oargs; ++i) {
|
||||||
|
TCGRegSet set = op->output_pref[i];
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
qemu_log(" pref=");
|
||||||
|
} else {
|
||||||
|
qemu_log(",");
|
||||||
|
}
|
||||||
|
if (set == 0) {
|
||||||
|
qemu_log("none");
|
||||||
|
} else if (set == MAKE_64BIT_MASK(0, TCG_TARGET_NB_REGS)) {
|
||||||
|
qemu_log("all");
|
||||||
|
#ifdef CONFIG_DEBUG_TCG
|
||||||
|
} else if (tcg_regset_single(set)) {
|
||||||
|
TCGReg reg = tcg_regset_first(set);
|
||||||
|
qemu_log("%s", tcg_target_reg_names[reg]);
|
||||||
|
#endif
|
||||||
|
} else if (TCG_TARGET_NB_REGS <= 32) {
|
||||||
|
qemu_log("%#x", (uint32_t)set);
|
||||||
|
} else {
|
||||||
|
qemu_log("%#" PRIx64, (uint64_t)set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qemu_log("\n");
|
qemu_log("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3083,7 +3113,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
|
||||||
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)
|
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP)
|
||||||
&& qemu_log_in_addr_range(tb->pc))) {
|
&& qemu_log_in_addr_range(tb->pc))) {
|
||||||
qemu_log("OP:\n");
|
qemu_log("OP:\n");
|
||||||
tcg_dump_ops(s);
|
tcg_dump_ops(s, false);
|
||||||
qemu_log("\n");
|
qemu_log("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3109,7 +3139,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
|
||||||
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_IND)
|
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_IND)
|
||||||
&& qemu_log_in_addr_range(tb->pc))) {
|
&& qemu_log_in_addr_range(tb->pc))) {
|
||||||
qemu_log("OP before indirect lowering:\n");
|
qemu_log("OP before indirect lowering:\n");
|
||||||
tcg_dump_ops(s);
|
tcg_dump_ops(s, false);
|
||||||
qemu_log("\n");
|
qemu_log("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3128,7 +3158,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
|
||||||
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT)
|
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT)
|
||||||
&& qemu_log_in_addr_range(tb->pc))) {
|
&& qemu_log_in_addr_range(tb->pc))) {
|
||||||
qemu_log("OP after optimization and liveness analysis:\n");
|
qemu_log("OP after optimization and liveness analysis:\n");
|
||||||
tcg_dump_ops(s);
|
tcg_dump_ops(s, false);
|
||||||
qemu_log("\n");
|
qemu_log("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1191,9 +1191,6 @@ static inline void *tcg_malloc(TCGContext *s, int size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only used for debugging purposes */
|
|
||||||
void tcg_dump_ops(TCGContext *s);
|
|
||||||
|
|
||||||
TCGv_i32 tcg_const_i32(TCGContext *s, int32_t val);
|
TCGv_i32 tcg_const_i32(TCGContext *s, int32_t val);
|
||||||
TCGv_i64 tcg_const_i64(TCGContext *s, int64_t val);
|
TCGv_i64 tcg_const_i64(TCGContext *s, int64_t val);
|
||||||
TCGv_i32 tcg_const_local_i32(TCGContext *s, int32_t val);
|
TCGv_i32 tcg_const_local_i32(TCGContext *s, int32_t val);
|
||||||
|
|
Loading…
Reference in a new issue