mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 11:04:58 -06:00
tcg: Split out tcg_out_goto_tb
The INDEX_op_goto_tb opcode needs no register allocation. Split out a dedicated helper function for it. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
becc452a36
commit
cf7d6b8e98
11 changed files with 199 additions and 173 deletions
|
@ -1079,6 +1079,25 @@ static void tcg_out_exit_tb(TCGContext *s, uintptr_t a0)
|
|||
}
|
||||
}
|
||||
|
||||
static void tcg_out_goto_tb(TCGContext *s, int which)
|
||||
{
|
||||
/*
|
||||
* Ensure that patch area is 8-byte aligned so that an
|
||||
* atomic write can be used to patch the target address.
|
||||
*/
|
||||
if ((uintptr_t)s->code_ptr & 7) {
|
||||
tcg_out_nop(s);
|
||||
}
|
||||
set_jmp_insn_offset(s, which);
|
||||
/*
|
||||
* actual branch destination will be patched by
|
||||
* tb_target_set_jmp_target later
|
||||
*/
|
||||
tcg_out_opc_pcaddu18i(s, TCG_REG_TMP0, 0);
|
||||
tcg_out_opc_jirl(s, TCG_REG_ZERO, TCG_REG_TMP0, 0);
|
||||
set_jmp_reset_offset(s, which);
|
||||
}
|
||||
|
||||
static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
||||
const TCGArg args[TCG_MAX_OP_ARGS],
|
||||
const int const_args[TCG_MAX_OP_ARGS])
|
||||
|
@ -1089,24 +1108,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|||
int c2 = const_args[2];
|
||||
|
||||
switch (opc) {
|
||||
case INDEX_op_goto_tb:
|
||||
/*
|
||||
* Ensure that patch area is 8-byte aligned so that an
|
||||
* atomic write can be used to patch the target address.
|
||||
*/
|
||||
if ((uintptr_t)s->code_ptr & 7) {
|
||||
tcg_out_nop(s);
|
||||
}
|
||||
set_jmp_insn_offset(s, a0);
|
||||
/*
|
||||
* actual branch destination will be patched by
|
||||
* tb_target_set_jmp_target later
|
||||
*/
|
||||
tcg_out_opc_pcaddu18i(s, TCG_REG_TMP0, 0);
|
||||
tcg_out_opc_jirl(s, TCG_REG_ZERO, TCG_REG_TMP0, 0);
|
||||
set_jmp_reset_offset(s, a0);
|
||||
break;
|
||||
|
||||
case INDEX_op_mb:
|
||||
tcg_out_mb(s, a0);
|
||||
break;
|
||||
|
@ -1501,6 +1502,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|||
case INDEX_op_mov_i64:
|
||||
case INDEX_op_call: /* Always emitted via tcg_out_call. */
|
||||
case INDEX_op_exit_tb: /* Always emitted via tcg_out_exit_tb. */
|
||||
case INDEX_op_goto_tb: /* Always emitted via tcg_out_goto_tb. */
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue