mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
tcg: Merge INDEX_op_qemu_*_{a32,a64}_*
Since 64-on-32 is now unsupported, guest addresses always fit in one host register. Drop the replication of opcodes. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
a0ecb8e494
commit
50b7a197e1
15 changed files with 177 additions and 559 deletions
119
tcg/tci.c
119
tcg/tci.c
|
@ -154,16 +154,6 @@ static void tci_args_rrrbb(uint32_t insn, TCGReg *r0, TCGReg *r1,
|
|||
*i4 = extract32(insn, 26, 6);
|
||||
}
|
||||
|
||||
static void tci_args_rrrrr(uint32_t insn, TCGReg *r0, TCGReg *r1,
|
||||
TCGReg *r2, TCGReg *r3, TCGReg *r4)
|
||||
{
|
||||
*r0 = extract32(insn, 8, 4);
|
||||
*r1 = extract32(insn, 12, 4);
|
||||
*r2 = extract32(insn, 16, 4);
|
||||
*r3 = extract32(insn, 20, 4);
|
||||
*r4 = extract32(insn, 24, 4);
|
||||
}
|
||||
|
||||
static void tci_args_rrrr(uint32_t insn,
|
||||
TCGReg *r0, TCGReg *r1, TCGReg *r2, TCGReg *r3)
|
||||
{
|
||||
|
@ -912,43 +902,21 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
|
|||
tb_ptr = ptr;
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld_a32_i32:
|
||||
case INDEX_op_qemu_ld_i32:
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = (uint32_t)regs[r1];
|
||||
goto do_ld_i32;
|
||||
case INDEX_op_qemu_ld_a64_i32:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = regs[r1];
|
||||
} else {
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
taddr = tci_uint64(regs[r2], regs[r1]);
|
||||
oi = regs[r3];
|
||||
}
|
||||
do_ld_i32:
|
||||
taddr = regs[r1];
|
||||
regs[r0] = tci_qemu_ld(env, taddr, oi, tb_ptr);
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld_a32_i64:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = (uint32_t)regs[r1];
|
||||
} else {
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
taddr = (uint32_t)regs[r2];
|
||||
oi = regs[r3];
|
||||
}
|
||||
goto do_ld_i64;
|
||||
case INDEX_op_qemu_ld_a64_i64:
|
||||
case INDEX_op_qemu_ld_i64:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = regs[r1];
|
||||
} else {
|
||||
tci_args_rrrrr(insn, &r0, &r1, &r2, &r3, &r4);
|
||||
taddr = tci_uint64(regs[r3], regs[r2]);
|
||||
oi = regs[r4];
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
taddr = regs[r2];
|
||||
oi = regs[r3];
|
||||
}
|
||||
do_ld_i64:
|
||||
tmp64 = tci_qemu_ld(env, taddr, oi, tb_ptr);
|
||||
if (TCG_TARGET_REG_BITS == 32) {
|
||||
tci_write_reg64(regs, r1, r0, tmp64);
|
||||
|
@ -957,47 +925,23 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
|
|||
}
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_st_a32_i32:
|
||||
case INDEX_op_qemu_st_i32:
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = (uint32_t)regs[r1];
|
||||
goto do_st_i32;
|
||||
case INDEX_op_qemu_st_a64_i32:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
taddr = regs[r1];
|
||||
} else {
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
taddr = tci_uint64(regs[r2], regs[r1]);
|
||||
oi = regs[r3];
|
||||
}
|
||||
do_st_i32:
|
||||
taddr = regs[r1];
|
||||
tci_qemu_st(env, taddr, regs[r0], oi, tb_ptr);
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_st_a32_i64:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
tmp64 = regs[r0];
|
||||
taddr = (uint32_t)regs[r1];
|
||||
} else {
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
tmp64 = tci_uint64(regs[r1], regs[r0]);
|
||||
taddr = (uint32_t)regs[r2];
|
||||
oi = regs[r3];
|
||||
}
|
||||
goto do_st_i64;
|
||||
case INDEX_op_qemu_st_a64_i64:
|
||||
case INDEX_op_qemu_st_i64:
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
tmp64 = regs[r0];
|
||||
taddr = regs[r1];
|
||||
} else {
|
||||
tci_args_rrrrr(insn, &r0, &r1, &r2, &r3, &r4);
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
tmp64 = tci_uint64(regs[r1], regs[r0]);
|
||||
taddr = tci_uint64(regs[r3], regs[r2]);
|
||||
oi = regs[r4];
|
||||
taddr = regs[r2];
|
||||
oi = regs[r3];
|
||||
}
|
||||
do_st_i64:
|
||||
tci_qemu_st(env, taddr, tmp64, oi, tb_ptr);
|
||||
break;
|
||||
|
||||
|
@ -1269,42 +1213,21 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
|
|||
str_r(r3), str_r(r4), str_r(r5));
|
||||
break;
|
||||
|
||||
case INDEX_op_qemu_ld_a32_i32:
|
||||
case INDEX_op_qemu_st_a32_i32:
|
||||
len = 1 + 1;
|
||||
goto do_qemu_ldst;
|
||||
case INDEX_op_qemu_ld_a32_i64:
|
||||
case INDEX_op_qemu_st_a32_i64:
|
||||
case INDEX_op_qemu_ld_a64_i32:
|
||||
case INDEX_op_qemu_st_a64_i32:
|
||||
len = 1 + DIV_ROUND_UP(64, TCG_TARGET_REG_BITS);
|
||||
goto do_qemu_ldst;
|
||||
case INDEX_op_qemu_ld_a64_i64:
|
||||
case INDEX_op_qemu_st_a64_i64:
|
||||
len = 2 * DIV_ROUND_UP(64, TCG_TARGET_REG_BITS);
|
||||
goto do_qemu_ldst;
|
||||
do_qemu_ldst:
|
||||
switch (len) {
|
||||
case 2:
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
info->fprintf_func(info->stream, "%-12s %s, %s, %x",
|
||||
op_name, str_r(r0), str_r(r1), oi);
|
||||
break;
|
||||
case 3:
|
||||
case INDEX_op_qemu_ld_i64:
|
||||
case INDEX_op_qemu_st_i64:
|
||||
if (TCG_TARGET_REG_BITS == 32) {
|
||||
tci_args_rrrr(insn, &r0, &r1, &r2, &r3);
|
||||
info->fprintf_func(info->stream, "%-12s %s, %s, %s, %s",
|
||||
op_name, str_r(r0), str_r(r1),
|
||||
str_r(r2), str_r(r3));
|
||||
break;
|
||||
case 4:
|
||||
tci_args_rrrrr(insn, &r0, &r1, &r2, &r3, &r4);
|
||||
info->fprintf_func(info->stream, "%-12s %s, %s, %s, %s, %s",
|
||||
op_name, str_r(r0), str_r(r1),
|
||||
str_r(r2), str_r(r3), str_r(r4));
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
/* fall through */
|
||||
case INDEX_op_qemu_ld_i32:
|
||||
case INDEX_op_qemu_st_i32:
|
||||
tci_args_rrm(insn, &r0, &r1, &oi);
|
||||
info->fprintf_func(info->stream, "%-12s %s, %s, %x",
|
||||
op_name, str_r(r0), str_r(r1), oi);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue