Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/rth/tags/tcg-pull-20150313' int…
Browse files Browse the repository at this point in the history
…o staging

Pool TCG data, and ALWAYS/NEVER fix

# gpg: Signature made Fri Mar 13 20:09:09 2015 GMT using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/tcg-pull-20150313:
  tcg: Complete handling of ALWAYS and NEVER
  tcg: Use tcg_malloc to allocate TCGLabel
  tcg: Change generator-side labels to a pointer
  tcg: Change translator-side labels to a pointer
  tcg-ia64: Use tcg_malloc to allocate TCGLabelQemuLdst
  tcg: Use tcg_malloc to allocate TCGLabelQemuLdst

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Mar 16, 2015
2 parents 7ccfb49 + 37ed3bf commit a8f1b43
Show file tree
Hide file tree
Showing 35 changed files with 433 additions and 446 deletions.
4 changes: 2 additions & 2 deletions include/exec/gen-icount.h
Expand Up @@ -6,8 +6,8 @@
/* Helpers for instruction counting code generation. */

static TCGArg *icount_arg;
static int icount_label;
static int exitreq_label;
static TCGLabel *icount_label;
static TCGLabel *exitreq_label;

static inline void gen_tb_start(TranslationBlock *tb)
{
Expand Down
4 changes: 2 additions & 2 deletions target-alpha/translate.c
Expand Up @@ -388,7 +388,7 @@ static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,
/* ??? In system mode we are never multi-threaded, so CAS can be
implemented via a non-atomic load-compare-store sequence. */
{
int lab_fail, lab_done;
TCGLabel *lab_fail, *lab_done;
TCGv val;

lab_fail = gen_new_label();
Expand Down Expand Up @@ -465,7 +465,7 @@ static ExitStatus gen_bcond_internal(DisasContext *ctx, TCGCond cond,
TCGv cmp, int32_t disp)
{
uint64_t dest = ctx->pc + (disp << 2);
int lab_true = gen_new_label();
TCGLabel *lab_true = gen_new_label();

if (use_goto_tb(ctx, dest)) {
tcg_gen_brcondi_i64(cond, cmp, 0, lab_true);
Expand Down
26 changes: 13 additions & 13 deletions target-arm/translate-a64.c
Expand Up @@ -1096,7 +1096,7 @@ static void disas_comp_b_imm(DisasContext *s, uint32_t insn)
{
unsigned int sf, op, rt;
uint64_t addr;
int label_match;
TCGLabel *label_match;
TCGv_i64 tcg_cmp;

sf = extract32(insn, 31, 1);
Expand Down Expand Up @@ -1125,7 +1125,7 @@ static void disas_test_b_imm(DisasContext *s, uint32_t insn)
{
unsigned int bit_pos, op, rt;
uint64_t addr;
int label_match;
TCGLabel *label_match;
TCGv_i64 tcg_cmp;

bit_pos = (extract32(insn, 31, 1) << 5) | extract32(insn, 19, 5);
Expand Down Expand Up @@ -1164,7 +1164,7 @@ static void disas_cond_b_imm(DisasContext *s, uint32_t insn)

if (cond < 0x0e) {
/* genuinely conditional branches */
int label_match = gen_new_label();
TCGLabel *label_match = gen_new_label();
arm_gen_test_cc(cond, label_match);
gen_goto_tb(s, 0, s->pc);
gen_set_label(label_match);
Expand Down Expand Up @@ -1711,8 +1711,8 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
* }
* env->exclusive_addr = -1;
*/
int fail_label = gen_new_label();
int done_label = gen_new_label();
TCGLabel *fail_label = gen_new_label();
TCGLabel *done_label = gen_new_label();
TCGv_i64 addr = tcg_temp_local_new_i64();
TCGv_i64 tmp;

Expand Down Expand Up @@ -3537,7 +3537,7 @@ static void disas_adc_sbc(DisasContext *s, uint32_t insn)
static void disas_cc(DisasContext *s, uint32_t insn)
{
unsigned int sf, op, y, cond, rn, nzcv, is_imm;
int label_continue = -1;
TCGLabel *label_continue = NULL;
TCGv_i64 tcg_tmp, tcg_y, tcg_rn;

if (!extract32(insn, 29, 1)) {
Expand All @@ -3557,7 +3557,7 @@ static void disas_cc(DisasContext *s, uint32_t insn)
nzcv = extract32(insn, 0, 4);

if (cond < 0x0e) { /* not always */
int label_match = gen_new_label();
TCGLabel *label_match = gen_new_label();
label_continue = gen_new_label();
arm_gen_test_cc(cond, label_match);
/* nomatch: */
Expand Down Expand Up @@ -3630,8 +3630,8 @@ static void disas_cond_select(DisasContext *s, uint32_t insn)
/* OPTME: we could use movcond here, at the cost of duplicating
* a lot of the arm_gen_test_cc() logic.
*/
int label_match = gen_new_label();
int label_continue = gen_new_label();
TCGLabel *label_match = gen_new_label();
TCGLabel *label_continue = gen_new_label();

arm_gen_test_cc(cond, label_match);
/* nomatch: */
Expand Down Expand Up @@ -4104,7 +4104,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
{
unsigned int mos, type, rm, cond, rn, op, nzcv;
TCGv_i64 tcg_flags;
int label_continue = -1;
TCGLabel *label_continue = NULL;

mos = extract32(insn, 29, 3);
type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
Expand All @@ -4124,7 +4124,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
}

if (cond < 0x0e) { /* not always */
int label_match = gen_new_label();
TCGLabel *label_match = gen_new_label();
label_continue = gen_new_label();
arm_gen_test_cc(cond, label_match);
/* nomatch: */
Expand Down Expand Up @@ -4165,7 +4165,7 @@ static void gen_mov_fp2fp(DisasContext *s, int type, int dst, int src)
static void disas_fp_csel(DisasContext *s, uint32_t insn)
{
unsigned int mos, type, rm, cond, rn, rd;
int label_continue = -1;
TCGLabel *label_continue = NULL;

mos = extract32(insn, 29, 3);
type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
Expand All @@ -4184,7 +4184,7 @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
}

if (cond < 0x0e) { /* not always */
int label_match = gen_new_label();
TCGLabel *label_match = gen_new_label();
label_continue = gen_new_label();
arm_gen_test_cc(cond, label_match);
/* nomatch: */
Expand Down
8 changes: 4 additions & 4 deletions target-arm/translate.c
Expand Up @@ -736,10 +736,10 @@ static void gen_thumb2_parallel_addsub(int op1, int op2, TCGv_i32 a, TCGv_i32 b)
* generate a conditional branch based on ARM condition code cc.
* This is common between ARM and Aarch64 targets.
*/
void arm_gen_test_cc(int cc, int label)
void arm_gen_test_cc(int cc, TCGLabel *label)
{
TCGv_i32 tmp;
int inv;
TCGLabel *inv;

switch (cc) {
case 0: /* eq: Z */
Expand Down Expand Up @@ -7440,8 +7440,8 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
{
TCGv_i32 tmp;
TCGv_i64 val64, extaddr;
int done_label;
int fail_label;
TCGLabel *done_label;
TCGLabel *fail_label;

/* if (env->exclusive_addr == addr && env->exclusive_val == [addr]) {
[addr] = {Rt};
Expand Down
4 changes: 2 additions & 2 deletions target-arm/translate.h
Expand Up @@ -9,7 +9,7 @@ typedef struct DisasContext {
/* Nonzero if this instruction has been conditionally skipped. */
int condjmp;
/* The label that will be jumped to when the instruction is skipped. */
int condlabel;
TCGLabel *condlabel;
/* Thumb-2 conditional execution bits. */
int condexec_mask;
int condexec_cond;
Expand Down Expand Up @@ -119,6 +119,6 @@ static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
}
#endif

void arm_gen_test_cc(int cc, int label);
void arm_gen_test_cc(int cc, TCGLabel *label);

#endif /* TARGET_ARM_TRANSLATE_H */
23 changes: 6 additions & 17 deletions target-cris/translate.c
Expand Up @@ -311,9 +311,7 @@ static void t_gen_asr(TCGv d, TCGv a, TCGv b)

static void t_gen_cris_dstep(TCGv d, TCGv a, TCGv b)
{
int l1;

l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();

/*
* d <<= 1
Expand Down Expand Up @@ -509,9 +507,7 @@ static inline void t_gen_swapr(TCGv d, TCGv s)

static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false)
{
int l1;

l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();

/* Conditional jmp. */
tcg_gen_mov_tl(env_pc, pc_false);
Expand Down Expand Up @@ -774,8 +770,7 @@ static void cris_alu_op_exec(DisasContext *dc, int op,
break;
case CC_OP_BOUND:
{
int l1;
l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();
tcg_gen_mov_tl(dst, a);
tcg_gen_brcond_tl(TCG_COND_LEU, a, b, l1);
tcg_gen_mov_tl(dst, b);
Expand Down Expand Up @@ -1488,10 +1483,8 @@ static int dec_scc_r(CPUCRISState *env, DisasContext *dc)
cc_name(cond), dc->op1);

if (cond != CC_A) {
int l1;

TCGLabel *l1 = gen_new_label();
gen_tst_cc(dc, cpu_R[dc->op1], cond);
l1 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->op1], 0, l1);
tcg_gen_movi_tl(cpu_R[dc->op1], 1);
gen_set_label(l1);
Expand Down Expand Up @@ -3040,9 +3033,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc)
#if !defined(CONFIG_USER_ONLY)
/* Single-stepping ? */
if (dc->tb_flags & S_FLAG) {
int l1;

l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_PR[PR_SPC], dc->pc, l1);
/* We treat SPC as a break with an odd trap vector. */
cris_evaluate_flags(dc);
Expand Down Expand Up @@ -3256,9 +3247,7 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb,
}

if (dc->jmp == JMP_DIRECT_CC) {
int l1;

l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();
cris_evaluate_flags(dc);

/* Conditional jmp. */
Expand Down
6 changes: 2 additions & 4 deletions target-cris/translate_v10.c
Expand Up @@ -65,7 +65,7 @@ static inline void cris_illegal_insn(DisasContext *dc)
static void gen_store_v10_conditional(DisasContext *dc, TCGv addr, TCGv val,
unsigned int size, int mem_index)
{
int l1 = gen_new_label();
TCGLabel *l1 = gen_new_label();
TCGv taddr = tcg_temp_local_new();
TCGv tval = tcg_temp_local_new();
TCGv t1 = tcg_temp_local_new();
Expand Down Expand Up @@ -537,10 +537,8 @@ static void dec10_reg_scc(DisasContext *dc)

if (cond != CC_A)
{
int l1;

TCGLabel *l1 = gen_new_label();
gen_tst_cc (dc, cpu_R[dc->src], cond);
l1 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_R[dc->src], 0, l1);
tcg_gen_movi_tl(cpu_R[dc->src], 1);
gen_set_label(l1);
Expand Down
33 changes: 16 additions & 17 deletions target-i386/translate.c
Expand Up @@ -613,14 +613,14 @@ static void gen_exts(TCGMemOp ot, TCGv reg)
gen_ext_tl(reg, reg, ot, true);
}

static inline void gen_op_jnz_ecx(TCGMemOp size, int label1)
static inline void gen_op_jnz_ecx(TCGMemOp size, TCGLabel *label1)
{
tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]);
gen_extu(size, cpu_tmp0);
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_tmp0, 0, label1);
}

static inline void gen_op_jz_ecx(TCGMemOp size, int label1)
static inline void gen_op_jz_ecx(TCGMemOp size, TCGLabel *label1)
{
tcg_gen_mov_tl(cpu_tmp0, cpu_regs[R_ECX]);
gen_extu(size, cpu_tmp0);
Expand Down Expand Up @@ -1078,7 +1078,7 @@ static inline void gen_compute_eflags_c(DisasContext *s, TCGv reg)

/* generate a conditional jump to label 'l1' according to jump opcode
value 'b'. In the fast case, T0 is guaranted not to be used. */
static inline void gen_jcc1_noeob(DisasContext *s, int b, int l1)
static inline void gen_jcc1_noeob(DisasContext *s, int b, TCGLabel *l1)
{
CCPrepare cc = gen_prepare_cc(s, b, cpu_T[0]);

Expand All @@ -1096,7 +1096,7 @@ static inline void gen_jcc1_noeob(DisasContext *s, int b, int l1)
/* Generate a conditional jump to label 'l1' according to jump opcode
value 'b'. In the fast case, T0 is guaranted not to be used.
A translation block must end soon. */
static inline void gen_jcc1(DisasContext *s, int b, int l1)
static inline void gen_jcc1(DisasContext *s, int b, TCGLabel *l1)
{
CCPrepare cc = gen_prepare_cc(s, b, cpu_T[0]);

Expand All @@ -1115,12 +1115,10 @@ static inline void gen_jcc1(DisasContext *s, int b, int l1)

/* XXX: does not work with gdbstub "ice" single step - not a
serious problem */
static int gen_jz_ecx_string(DisasContext *s, target_ulong next_eip)
static TCGLabel *gen_jz_ecx_string(DisasContext *s, target_ulong next_eip)
{
int l1, l2;

l1 = gen_new_label();
l2 = gen_new_label();
TCGLabel *l1 = gen_new_label();
TCGLabel *l2 = gen_new_label();
gen_op_jnz_ecx(s->aflag, l1);
gen_set_label(l2);
gen_jmp_tb(s, next_eip, 1);
Expand Down Expand Up @@ -1213,7 +1211,7 @@ static inline void gen_outs(DisasContext *s, TCGMemOp ot)
static inline void gen_repz_ ## op(DisasContext *s, TCGMemOp ot, \
target_ulong cur_eip, target_ulong next_eip) \
{ \
int l2;\
TCGLabel *l2; \
gen_update_cc_op(s); \
l2 = gen_jz_ecx_string(s, next_eip); \
gen_ ## op(s, ot); \
Expand All @@ -1231,7 +1229,7 @@ static inline void gen_repz_ ## op(DisasContext *s, TCGMemOp ot, \
target_ulong next_eip, \
int nz) \
{ \
int l2;\
TCGLabel *l2; \
gen_update_cc_op(s); \
l2 = gen_jz_ecx_string(s, next_eip); \
gen_ ## op(s, ot); \
Expand Down Expand Up @@ -2227,7 +2225,7 @@ static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
static inline void gen_jcc(DisasContext *s, int b,
target_ulong val, target_ulong next_eip)
{
int l1, l2;
TCGLabel *l1, *l2;

if (s->jmp_opt) {
l1 = gen_new_label();
Expand Down Expand Up @@ -5152,7 +5150,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
case 0x1b0:
case 0x1b1: /* cmpxchg Ev, Gv */
{
int label1, label2;
TCGLabel *label1, *label2;
TCGv t0, t1, t2, a0;

ot = mo_b_d(b, dflag);
Expand Down Expand Up @@ -6196,7 +6194,8 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
case 0x10 ... 0x13: /* fcmovxx */
case 0x18 ... 0x1b:
{
int op1, l1;
int op1;
TCGLabel *l1;
static const uint8_t fcmov_cc[8] = {
(JCC_B << 1),
(JCC_Z << 1),
Expand Down Expand Up @@ -7017,7 +7016,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
case 0xe2: /* loop */
case 0xe3: /* jecxz */
{
int l1, l2, l3;
TCGLabel *l1, *l2, *l3;

tval = (int8_t)insn_get(env, s, MO_8);
next_eip = s->pc - s->cs_base;
Expand Down Expand Up @@ -7515,7 +7514,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
} else
#endif
{
int label1;
TCGLabel *label1;
TCGv t0, t1, t2, a0;

if (!s->pe || s->vm86)
Expand Down Expand Up @@ -7564,7 +7563,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
case 0x102: /* lar */
case 0x103: /* lsl */
{
int label1;
TCGLabel *label1;
TCGv t0;
if (!s->pe || s->vm86)
goto illegal_op;
Expand Down

0 comments on commit a8f1b43

Please sign in to comment.