tcg-arm: Define TCG_TARGET_INSN_UNIT_SIZE
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Cc Peter Maydell <[email protected]>Signed-off-by Richard Henderson <[email protected]>---
(quoted diff) +0
-2@@ -1670,51 +1651,28 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_exit_tb: - if (use_armv7_instructions || check_fit_imm(args[0])) { - tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]);
Review static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, · line 1655
Quoted 10 lines
(quoted diff) +2
-8- tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr); - } else { - uint8_t *ld_ptr = s->code_ptr; - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); - tcg_out_goto(s, COND_AL, (tcg_target_ulong) tb_ret_addr); - *ld_ptr = (uint8_t) (s->code_ptr - ld_ptr) - 8; - tcg_out32(s, args[0]); - } + tcg_out_movi32(s, COND_AL, TCG_REG_R0, args[0]); + tcg_out_goto(s, COND_AL, tb_ret_addr);
Why is it OK not to have the pre-v7/non-fitting-immediate code now? I guess movi32 will handle it all though probably in a less efficient way.
Quoted 22 lines
(quoted diff) +1
-14break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { /* Direct jump method */ -#if defined(USE_DIRECT_JUMP) - s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; + s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); tcg_out_b_noaddr(s, COND_AL); -#else - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, -4); - s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; - tcg_out32(s, 0); -#endif } else { /* Indirect jump method */ -#if 1 - c = (int) (s->tb_next + args[0]) - ((int) s->code_ptr + 8); - if (c > 0xfff || c < -0xfff) { - tcg_out_movi32(s, COND_AL, TCG_REG_R0, - (tcg_target_long) (s->tb_next + args[0])); - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); - } else
Review static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, · line 1667
Quoted 10 lines
(quoted diff) +3
-6- tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_PC, c); -#else - tcg_out_ld32_12(s, COND_AL, TCG_REG_R0, TCG_REG_PC, 0); - tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, 0); - tcg_out32(s, (tcg_target_long) (s->tb_next + args[0])); -#endif + intptr_t ptr = (intptr_t)(s->tb_next + args[0]); + tcg_out_movi32(s, COND_AL, TCG_REG_R0, ptr & ~0xfff); + tcg_out_ld32_12(s, COND_AL, TCG_REG_PC, TCG_REG_R0, ptr & 0xfff); }
This change also confused me but we're again relying on movi32 generating correct-but-inefficient code now, right?
thanks
-- PMM
Quoted 2 lines · Peter Maydell
This change also confused me but we're again relying on movi32 generating correct-but-inefficient code now, right?
Yes. IMO if we want to do a constant pool, let's do a proper one, not just in a few places.
r~
Peter Maydell
Reviewed-byQuoted 6 lines · Richard Henderson
Quoted 2 lines · Peter Maydell
This change also confused me but we're again relying on movi32 generating correct-but-inefficient code now, right?
Yes. IMO if we want to do a constant pool, let's do a proper one, not just in a few places.
Fair enough. I don't care very much about pre-v7 hosts anyway...
-- PMM
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Qemu-devel] [PATCH v3 12/16] tcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 22 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Signed-off-by Richard Henderson <[email protected]>--- tcg/s390/tcg-target.c | 91 ++++++++++++++++++++++++--------------------------- tcg/s390/tcg-target.h | 2 ++ 2 files changed, 45 insertions(+), 48 deletions(-)tcg/s390/tcg-target.c +1
-1@@ -320,7 +320,7 @@ static const uint8_t tcg_cond_to_ltr_cond[] = {#ifdef CONFIG_SOFTMMU /* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr, int mmu_idx) */ -static const void *const qemu_ld_helpers[4 ] = { +static void *const qemu_ld_helpers[4 ] = { helper_ldb_mmu, helper_ldw_mmu, helper_ldl_mmu,
tcg/s390/tcg-target.c static const void * const qemu_ld_helpers[4] = { · line 335
Quoted 8 lines
tcg/s390/tcg-target.c +1
-1@@ -329,7 +329,7 @@ static const void * const qemu_ld_helpers[4] = {/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr, uintxx_t val, int mmu_idx) */ -static const void *const qemu_st_helpers[4 ] = { +static void *const qemu_st_helpers[4 ] = { helper_stb_mmu, helper_stw_mmu, helper_stl_mmu,
Why do these lose the 'const' ?
Patch looks ok otherwise from a quick scan.
thanks
-- PMM
Re: [Qemu-devel] [PATCH v3 12/16] tcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 24 lines · Peter Maydell
Quoted 23 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Signed-off-by Richard Henderson <[email protected]>--- tcg/s390/tcg-target.c | 91 ++++++++++++++++++++++++--------------------------- tcg/s390/tcg-target.h | 2 ++ 2 files changed, 45 insertions(+), 48 deletions(-)tcg/s390/tcg-target.c +1
-1@@ -320,7 +320,7 @@ static const uint8_t tcg_cond_to_ltr_cond[] = {#ifdef CONFIG_SOFTMMU /* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr, int mmu_idx) */ -static const void *const qemu_ld_helpers[4 ] = { +static void *const qemu_ld_helpers[4 ] = { helper_ldb_mmu, helper_ldw_mmu, helper_ldl_mmu,@@ -329,7 +329,7 @@ static const void * const qemu_ld_helpers[4] = {
Quoted 9 lines
tcg/s390/tcg-target.c static const void * const qemu_ld_helpers[4] = { · line 335
Quoted 7 lines
tcg/s390/tcg-target.c +1
-1/* helper signature: helper_st_mmu(CPUState *env, target_ulong addr, uintxx_t val, int mmu_idx) */ -static const void *const qemu_st_helpers[4 ] = { +static void *const qemu_st_helpers[4 ] = { helper_stb_mmu, helper_stw_mmu, helper_stl_mmu,Why do these lose the 'const' ?
Because "const void *" has a conversion warning to non-const "tcg_type_unit *". One would have to carry the const all the way through all of the relocation routines to solve it.
You had the exact same question about the ppc patch.
r~
Re: [Qemu-devel] [PATCH v3 12/16] tcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 7 lines · Richard Henderson
Quoted 1 line · Peter Maydell
Why do these lose the 'const' ?
Because "const void *" has a conversion warning to non-const "
tcg_type_unit*". One would have to carry the const all the way through all of the relocation routines to solve it.
Ah, right.
Quoted 1 line
You had the exact same question about the ppc patch.
Whoops :-)
thanks
-- PMM
A message that is not in the archive (sent off-list or not yet received): [email protected]
Peter Maydell
Reviewed-byRe: [Qemu-devel] [PATCH v3 14/16] tcg-mips: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 4 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Cc Aurelien Jarno <[email protected]>Signed-off-by Richard Henderson <[email protected]>
-- PMM
A message that is not in the archive (sent off-list or not yet received): [email protected]
Peter Maydell
Reviewed-byRe: [Qemu-devel] [PATCH v3 15/16] tci: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 8 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Cc Stefan Weil <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- tcg/tci/tcg-target.c | 19 +++++++++++++------ tcg/tci/tcg-target.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-)
though I note there are a number of functions that use the pattern
uint8_t *old_code_ptr = s->code_ptr;
[...emit stuff...]
old_code_ptr[1] = s->code_ptr - old_code_ptr;which could perhaps use tcg_insn_unit * rather than uint8_t * ?
thanks
-- PMM
Re: [Qemu-devel] [PATCH v3 15/16] tci: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 8 lines · Peter Maydell
though I note there are a number of functions that use the pattern
uint8_t *old_code_ptr = s->code_ptr; [...emit stuff...] old_code_ptr[1] = s->code_ptr - old_code_ptr;which could perhaps use
tcg_insn_unit* rather thanuint8_t* ?
Yes, probably. There are quite a few changes I'd like to make to tci...
r~
A message that is not in the archive (sent off-list or not yet received): [email protected]
Peter Maydell
Reviewed-byRe: [Qemu-devel] [PATCH v3 11/16] tcg-aarch64: Define TCG_TARGET_INSN_UNIT_SIZE
Quoted 4 lines · Richard Henderson
And use tcg pointer differencing functions as appropriate.
Cc Claudio Fontana <[email protected]>Signed-off-by Richard Henderson <[email protected]>
-- PMM