tcg: remove obsolete jmp op

The TCG jmp operation doesn't really make sense in the QEMU context, it
is unused, it is not implemented by some targets, and it is wrongly
implemented by some others.

This patch simply removes it.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Stefan Weil<sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Aurelien Jarno 2012-10-01 21:00:43 +02:00
parent f783cb2240
commit 626cd050e2
13 changed files with 1 additions and 71 deletions

View File

@ -88,8 +88,7 @@ supported.
* Branches: * Branches:
Use the instruction 'br' to jump to a label. Use 'jmp' to jump to an Use the instruction 'br' to jump to a label.
explicit address. Conditional branches can only jump to labels.
3.3) Code Optimizations 3.3) Code Optimizations
@ -129,10 +128,6 @@ call function 'ptr' (pointer type)
********* Jumps/Labels ********* Jumps/Labels
* jmp t0
Absolute jump to address t0 (pointer type).
* set_label $label * set_label $label
Define label 'label' at the current program point. Define label 'label' at the current program point.

View File

@ -1530,12 +1530,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
else else
tcg_out_callr(s, COND_AL, args[0]); tcg_out_callr(s, COND_AL, args[0]);
break; break;
case INDEX_op_jmp:
if (const_args[0])
tcg_out_goto(s, COND_AL, args[0]);
else
tcg_out_bx(s, COND_AL, args[0]);
break;
case INDEX_op_br: case INDEX_op_br:
tcg_out_goto_label(s, COND_AL, args[0]); tcg_out_goto_label(s, COND_AL, args[0]);
break; break;
@ -1769,7 +1763,6 @@ static const TCGTargetOpDef arm_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -1353,11 +1353,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
} }
break; break;
case INDEX_op_jmp:
fprintf(stderr, "unimplemented jmp\n");
tcg_abort();
break;
case INDEX_op_br: case INDEX_op_br:
tcg_out_branch(s, args[0], 1); tcg_out_branch(s, args[0], 1);
break; break;
@ -1592,7 +1587,6 @@ static const TCGTargetOpDef hppa_op_defs[] = {
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "r" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -1513,14 +1513,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
tcg_out_modrm(s, OPC_GRP5, EXT5_CALLN_Ev, args[0]); tcg_out_modrm(s, OPC_GRP5, EXT5_CALLN_Ev, args[0]);
} }
break; break;
case INDEX_op_jmp:
if (const_args[0]) {
tcg_out_jmp(s, args[0]);
} else {
/* jmp *reg */
tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, args[0]);
}
break;
case INDEX_op_br: case INDEX_op_br:
tcg_out_jxx(s, JCC_JMP, args[0], 0); tcg_out_jxx(s, JCC_JMP, args[0], 0);
break; break;
@ -1848,7 +1840,6 @@ static const TCGTargetOpDef x86_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },
{ INDEX_op_movi_i32, { "r" } }, { INDEX_op_movi_i32, { "r" } },

View File

@ -1916,9 +1916,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
case INDEX_op_goto_tb: case INDEX_op_goto_tb:
tcg_out_goto_tb(s, args[0]); tcg_out_goto_tb(s, args[0]);
break; break;
case INDEX_op_jmp:
tcg_out_jmp(s, args[0]);
break;
case INDEX_op_movi_i32: case INDEX_op_movi_i32:
tcg_out_movi(s, TCG_TYPE_I32, args[0], args[1]); tcg_out_movi(s, TCG_TYPE_I32, args[0], args[1]);
@ -2156,7 +2153,6 @@ static const TCGTargetOpDef ia64_op_defs[] = {
{ INDEX_op_call, { "r" } }, { INDEX_op_call, { "r" } },
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_jmp, { "r" } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },
{ INDEX_op_movi_i32, { "r" } }, { INDEX_op_movi_i32, { "r" } },

View File

@ -1322,10 +1322,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
tcg_out_opc_reg(s, OPC_JALR, TCG_REG_RA, args[0], 0); tcg_out_opc_reg(s, OPC_JALR, TCG_REG_RA, args[0], 0);
tcg_out_nop(s); tcg_out_nop(s);
break; break;
case INDEX_op_jmp:
tcg_out_opc_reg(s, OPC_JR, 0, args[0], 0);
tcg_out_nop(s);
break;
case INDEX_op_br: case INDEX_op_br:
tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO, args[0]); tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO, args[0]);
break; break;
@ -1577,7 +1573,6 @@ static const TCGTargetOpDef mips_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "C" } }, { INDEX_op_call, { "C" } },
{ INDEX_op_jmp, { "r" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -1417,15 +1417,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
case INDEX_op_call: case INDEX_op_call:
tcg_out_call (s, args[0], const_args[0]); tcg_out_call (s, args[0], const_args[0]);
break; break;
case INDEX_op_jmp:
if (const_args[0]) {
tcg_out_b (s, 0, args[0]);
}
else {
tcg_out32 (s, MTSPR | RS (args[0]) | CTR);
tcg_out32 (s, BCCTR | BO_ALWAYS);
}
break;
case INDEX_op_movi_i32: case INDEX_op_movi_i32:
tcg_out_movi(s, TCG_TYPE_I32, args[0], args[1]); tcg_out_movi(s, TCG_TYPE_I32, args[0], args[1]);
break; break;
@ -1904,7 +1895,6 @@ static const TCGTargetOpDef ppc_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -1245,15 +1245,6 @@ static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args,
case INDEX_op_call: case INDEX_op_call:
tcg_out_call (s, args[0], const_args[0]); tcg_out_call (s, args[0], const_args[0]);
break; break;
case INDEX_op_jmp:
if (const_args[0]) {
tcg_out_b (s, 0, args[0]);
}
else {
tcg_out32 (s, MTSPR | RS (args[0]) | CTR);
tcg_out32 (s, BCCTR | BO_ALWAYS);
}
break;
case INDEX_op_movi_i32: case INDEX_op_movi_i32:
tcg_out_movi (s, TCG_TYPE_I32, args[0], args[1]); tcg_out_movi (s, TCG_TYPE_I32, args[0], args[1]);
break; break;
@ -1588,7 +1579,6 @@ static const TCGTargetOpDef ppc_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -2037,11 +2037,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
break; break;
#endif /* TCG_TARGET_REG_BITS == 64 */ #endif /* TCG_TARGET_REG_BITS == 64 */
case INDEX_op_jmp:
/* This one is obsolete and never emitted. */
tcg_abort();
break;
default: default:
fprintf(stderr,"unimplemented opc 0x%x\n",opc); fprintf(stderr,"unimplemented opc 0x%x\n",opc);
tcg_abort(); tcg_abort();
@ -2052,7 +2047,6 @@ static const TCGTargetOpDef s390_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -1097,7 +1097,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
/* delay slot */ /* delay slot */
tcg_out_nop(s); tcg_out_nop(s);
break; break;
case INDEX_op_jmp:
case INDEX_op_br: case INDEX_op_br:
tcg_out_branch_i32(s, COND_A, args[0]); tcg_out_branch_i32(s, COND_A, args[0]);
tcg_out_nop(s); tcg_out_nop(s);
@ -1367,7 +1366,6 @@ static const TCGTargetOpDef sparc_op_defs[] = {
{ INDEX_op_exit_tb, { } }, { INDEX_op_exit_tb, { } },
{ INDEX_op_goto_tb, { } }, { INDEX_op_goto_tb, { } },
{ INDEX_op_call, { "ri" } }, { INDEX_op_call, { "ri" } },
{ INDEX_op_jmp, { "ri" } },
{ INDEX_op_br, { } }, { INDEX_op_br, { } },
{ INDEX_op_mov_i32, { "r", "r" } }, { INDEX_op_mov_i32, { "r", "r" } },

View File

@ -38,7 +38,6 @@ DEF(discard, 1, 0, 0, 0)
DEF(set_label, 0, 0, 1, TCG_OPF_BB_END) DEF(set_label, 0, 0, 1, TCG_OPF_BB_END)
DEF(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */ DEF(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */
DEF(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS) DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
#define IMPL(X) (X ? 0 : TCG_OPF_NOT_PRESENT) #define IMPL(X) (X ? 0 : TCG_OPF_NOT_PRESENT)

View File

@ -69,7 +69,6 @@ static const TCGTargetOpDef tcg_target_op_defs[] = {
{ INDEX_op_exit_tb, { NULL } }, { INDEX_op_exit_tb, { NULL } },
{ INDEX_op_goto_tb, { NULL } }, { INDEX_op_goto_tb, { NULL } },
{ INDEX_op_call, { RI } }, { INDEX_op_call, { RI } },
{ INDEX_op_jmp, { RI } },
{ INDEX_op_br, { NULL } }, { INDEX_op_br, { NULL } },
{ INDEX_op_mov_i32, { R, R } }, { INDEX_op_mov_i32, { R, R } },
@ -583,9 +582,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
case INDEX_op_call: case INDEX_op_call:
tcg_out_ri(s, const_args[0], args[0]); tcg_out_ri(s, const_args[0], args[0]);
break; break;
case INDEX_op_jmp:
TODO();
break;
case INDEX_op_setcond_i32: case INDEX_op_setcond_i32:
tcg_out_r(s, args[0]); tcg_out_r(s, args[0]);
tcg_out_r(s, args[1]); tcg_out_r(s, args[1]);

1
tci.c
View File

@ -505,7 +505,6 @@ tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *cpustate, uint8_t *tb_ptr)
tci_write_reg(TCG_REG_R0, tmp64); tci_write_reg(TCG_REG_R0, tmp64);
#endif #endif
break; break;
case INDEX_op_jmp:
case INDEX_op_br: case INDEX_op_br:
label = tci_read_label(&tb_ptr); label = tci_read_label(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size); assert(tb_ptr == old_code_ptr + op_size);