Skip to content

Commit

Permalink
TCG: Use gen_opc_buf from context instead of global variable.
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Voevodin <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
  • Loading branch information
Evgeny Voevodin authored and blueswirl committed Nov 17, 2012
1 parent c4afe5c commit 92414b3
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 94 deletions.
6 changes: 3 additions & 3 deletions target-alpha/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3373,7 +3373,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
int max_insns;

pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

ctx.tb = tb;
ctx.env = env;
Expand Down Expand Up @@ -3406,7 +3406,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -3465,7 +3465,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
6 changes: 3 additions & 3 deletions target-arm/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -9727,7 +9727,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,

dc->tb = tb;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->is_jmp = DISAS_NEXT;
dc->pc = pc_start;
Expand Down Expand Up @@ -9834,7 +9834,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -9974,7 +9974,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
}
#endif
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
8 changes: 4 additions & 4 deletions target-cris/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3232,7 +3232,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
dc->env = env;
dc->tb = tb;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
Expand Down Expand Up @@ -3297,7 +3297,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
check_breakpoint(env, dc);

if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j) {
Expand Down Expand Up @@ -3436,7 +3436,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j) {
gen_opc_instr_start[lj++] = 0;
Expand All @@ -3452,7 +3452,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
log_target_disas(env, pc_start, dc->pc - pc_start,
dc->env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - gen_opc_buf);
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
}
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions target-i386/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -7962,7 +7962,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
cpu_ptr0 = tcg_temp_new_ptr();
cpu_ptr1 = tcg_temp_new_ptr();

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->is_jmp = DISAS_NEXT;
pc_ptr = pc_start;
Expand All @@ -7984,7 +7984,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -8034,7 +8034,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
/* we don't forget to fill the last values */
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
9 changes: 5 additions & 4 deletions target-lm32/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
dc->env = env;
dc->tb = tb;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->is_jmp = DISAS_NEXT;
dc->pc = pc_start;
Expand Down Expand Up @@ -1047,7 +1047,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
check_breakpoint(env, dc);

if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j) {
Expand Down Expand Up @@ -1107,7 +1107,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j) {
gen_opc_instr_start[lj++] = 0;
Expand All @@ -1122,7 +1122,8 @@ static void gen_intermediate_code_internal(CPULM32State *env,
qemu_log("\n");
log_target_disas(env, pc_start, dc->pc - pc_start, 0);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - gen_opc_buf);
dc->pc - pc_start, tcg_ctx.gen_opc_ptr -
tcg_ctx.gen_opc_buf);
}
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions target-m68k/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2982,7 +2982,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,

dc->tb = tb;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->env = env;
dc->is_jmp = DISAS_NEXT;
Expand Down Expand Up @@ -3015,7 +3015,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
break;
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -3075,7 +3075,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
}
#endif
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
9 changes: 5 additions & 4 deletions target-microblaze/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
dc->tb = tb;
org_flags = dc->synced_flags = dc->tb_flags = tb->flags;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

dc->is_jmp = DISAS_NEXT;
dc->jmp = 0;
Expand Down Expand Up @@ -1784,7 +1784,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
check_breakpoint(env, dc);

if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -1899,7 +1899,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand All @@ -1916,7 +1916,8 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
log_target_disas(env, pc_start, dc->pc - pc_start, 0);
#endif
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - gen_opc_buf);
dc->pc - pc_start, tcg_ctx.gen_opc_ptr -
tcg_ctx.gen_opc_buf);
}
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions target-mips/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -15513,7 +15513,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
qemu_log("search pc %d\n", search_pc);

pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.pc = pc_start;
ctx.saved_pc = -1;
ctx.singlestep_enabled = env->singlestep_enabled;
Expand Down Expand Up @@ -15549,7 +15549,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
}

if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -15633,7 +15633,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
9 changes: 5 additions & 4 deletions target-openrisc/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
pc_start = tb->pc;
dc->tb = tb;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
Expand Down Expand Up @@ -1703,7 +1703,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
do {
check_breakpoint(cpu, dc);
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (k < j) {
k++;
while (k < j) {
Expand Down Expand Up @@ -1784,7 +1784,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
k++;
while (k <= j) {
gen_opc_instr_start[k++] = 0;
Expand All @@ -1799,7 +1799,8 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
qemu_log("\n");
log_target_disas(&cpu->env, pc_start, dc->pc - pc_start, 0);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - gen_opc_buf);
dc->pc - pc_start, tcg_ctx.gen_opc_ptr -
tcg_ctx.gen_opc_buf);
}
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions target-ppc/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -9624,7 +9624,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
int max_insns;

pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.nip = pc_start;
ctx.tb = tb;
ctx.exception = POWERPC_EXCP_NONE;
Expand Down Expand Up @@ -9675,7 +9675,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
}
}
if (unlikely(search_pc)) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -9777,7 +9777,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (unlikely(search_pc)) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
6 changes: 3 additions & 3 deletions target-s390x/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5134,7 +5134,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
dc.tb = tb;
dc.cc_op = CC_OP_DYNAMIC;

gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;

Expand All @@ -5156,7 +5156,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j) {
Expand Down Expand Up @@ -5209,7 +5209,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j) {
gen_opc_instr_start[lj++] = 0;
Expand Down
6 changes: 3 additions & 3 deletions target-sh4/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
int max_insns;

pc_start = tb->pc;
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
ctx.pc = pc_start;
ctx.flags = (uint32_t)tb->flags;
ctx.bstate = BS_NONE;
Expand Down Expand Up @@ -1999,7 +1999,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
}
}
if (search_pc) {
i = tcg_ctx.gen_opc_ptr - gen_opc_buf;
i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (ii < i) {
ii++;
while (ii < i)
Expand Down Expand Up @@ -2058,7 +2058,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
i = tcg_ctx.gen_opc_ptr - gen_opc_buf;
i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
ii++;
while (ii <= i)
gen_opc_instr_start[ii++] = 0;
Expand Down
6 changes: 3 additions & 3 deletions target-sparc/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -5257,7 +5257,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
dc->fpu_enabled = tb_fpu_enabled(tb->flags);
dc->address_mask_32bit = tb_am_enabled(tb->flags);
dc->singlestep = (env->singlestep_enabled || singlestep);
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;

num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
Expand All @@ -5279,7 +5279,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
}
if (spc) {
qemu_log("Search PC...\n");
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j)
Expand Down Expand Up @@ -5336,7 +5336,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (spc) {
j = tcg_ctx.gen_opc_ptr - gen_opc_buf;
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j)
gen_opc_instr_start[lj++] = 0;
Expand Down
Loading

0 comments on commit 92414b3

Please sign in to comment.