mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
tcg: Change generator-side labels to a pointer
This is less about improved type checking than enabling a subsequent change to the representation of labels. Acked-by: Claudio Fontana <claudio.fontana@huawei.com> Tested-by: Claudio Fontana <claudio.fontana@huawei.com> Cc: Andrzej Zaborowski <balrogg@gmail.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Stefan Weil <sw@weilnetz.de> Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
42a268c241
commit
bec1631100
10 changed files with 108 additions and 125 deletions
|
@ -635,7 +635,7 @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond, TCGReg ret,
|
|||
}
|
||||
|
||||
static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1,
|
||||
TCGReg arg2, int label_index)
|
||||
TCGReg arg2, TCGLabel *l)
|
||||
{
|
||||
static const MIPSInsn b_zero[16] = {
|
||||
[TCG_COND_LT] = OPC_BLTZ,
|
||||
|
@ -644,7 +644,6 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1,
|
|||
[TCG_COND_GE] = OPC_BGEZ,
|
||||
};
|
||||
|
||||
TCGLabel *l;
|
||||
MIPSInsn s_opc = OPC_SLTU;
|
||||
MIPSInsn b_opc;
|
||||
int cmp_map;
|
||||
|
@ -692,11 +691,10 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGReg arg1,
|
|||
}
|
||||
|
||||
tcg_out_opc_br(s, b_opc, arg1, arg2);
|
||||
l = &s->labels[label_index];
|
||||
if (l->has_value) {
|
||||
reloc_pc16(s->code_ptr - 1, l->u.value_ptr);
|
||||
} else {
|
||||
tcg_out_reloc(s, s->code_ptr - 1, R_MIPS_PC16, label_index, 0);
|
||||
tcg_out_reloc(s, s->code_ptr - 1, R_MIPS_PC16, l, 0);
|
||||
}
|
||||
tcg_out_nop(s);
|
||||
}
|
||||
|
@ -765,7 +763,7 @@ static void tcg_out_setcond2(TCGContext *s, TCGCond cond, TCGReg ret,
|
|||
}
|
||||
|
||||
static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah,
|
||||
TCGReg bl, TCGReg bh, int label_index)
|
||||
TCGReg bl, TCGReg bh, TCGLabel *l)
|
||||
{
|
||||
TCGCond b_cond = TCG_COND_NE;
|
||||
TCGReg tmp = TCG_TMP1;
|
||||
|
@ -790,7 +788,7 @@ static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah,
|
|||
break;
|
||||
}
|
||||
|
||||
tcg_out_brcond(s, b_cond, tmp, TCG_REG_ZERO, label_index);
|
||||
tcg_out_brcond(s, b_cond, tmp, TCG_REG_ZERO, l);
|
||||
}
|
||||
|
||||
static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret,
|
||||
|
@ -1367,7 +1365,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|||
s->tb_next_offset[a0] = tcg_current_code_size(s);
|
||||
break;
|
||||
case INDEX_op_br:
|
||||
tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO, a0);
|
||||
tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO,
|
||||
arg_label(a0));
|
||||
break;
|
||||
|
||||
case INDEX_op_ld8u_i32:
|
||||
|
@ -1527,10 +1526,10 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|||
break;
|
||||
|
||||
case INDEX_op_brcond_i32:
|
||||
tcg_out_brcond(s, a2, a0, a1, args[3]);
|
||||
tcg_out_brcond(s, a2, a0, a1, arg_label(args[3]));
|
||||
break;
|
||||
case INDEX_op_brcond2_i32:
|
||||
tcg_out_brcond2(s, args[4], a0, a1, a2, args[3], args[5]);
|
||||
tcg_out_brcond2(s, args[4], a0, a1, a2, args[3], arg_label(args[5]));
|
||||
break;
|
||||
|
||||
case INDEX_op_movcond_i32:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue