merge PPC_PROFILE_REGS_USE fixes from KPX branch

This commit is contained in:
gbeauche 2007-02-17 09:01:31 +00:00
parent 8e0088c4c6
commit b20a76f580
4 changed files with 22 additions and 11 deletions

View File

@ -109,6 +109,7 @@
#define PPC_FLIGHT_RECORDER 1
#define PPC_PROFILE_COMPILE_TIME 0
#define PPC_PROFILE_GENERIC_CALLS 1
#define PPC_PROFILE_REGS_USE 0
#define KPX_MAX_CPUS 1
#if ENABLE_DYNGEN
#define PPC_ENABLE_JIT 1

View File

@ -250,6 +250,14 @@ void powerpc_cpu::initialize()
printf("PowerPC CPU emulator by Gwenole Beauchesne\n");
#endif
#if PPC_PROFILE_REGS_USE
reginfo = new register_info[32];
for (int i = 0; i < 32; i++) {
reginfo[i].id = i;
reginfo[i].count = 0;
}
#endif
init_flight_recorder();
init_decoder();
init_registers();
@ -292,14 +300,6 @@ void powerpc_cpu::initialize()
compile_time = 0;
emul_start_time = clock();
#endif
#if PPC_PROFILE_REGS_USE
reginfo = new register_info[32];
for (int i = 0; i < 32; i++) {
reginfo[i].id = i;
reginfo[i].count = 0;
}
#endif
}
#if PPC_ENABLE_JIT
@ -427,12 +427,12 @@ powerpc_cpu::~powerpc_cpu()
uint64 cum_reg_count = 0;
for (int i = 0; i < 32; i++) {
cum_reg_count += reginfo[i].count;
printf("r%-2d : %16lld %2.1f%% [%3.1f%%]\n",
printf("r%-2d : %16llu %2.1f%% [%3.1f%%]\n",
reginfo[i].id, reginfo[i].count,
100.0*double(reginfo[i].count)/double(tot_reg_count),
100.0*double(cum_reg_count)/double(tot_reg_count));
}
delete reginfo;
delete[] reginfo;
#endif
kill_decode_cache();

View File

@ -328,7 +328,14 @@ bool powerpc_jit::gen_vector_generic_store_word(int mnemo, int vS, int rA, int r
return true;
}
#define xPPC_FIELD(M) ((uintptr)&((powerpc_cpu *)0)->M)
#if PPC_PROFILE_REGS_USE
// XXX update reginfo[] counts for xPPC_GPR() accesses
static uint8 dummy_ppc_context[sizeof(powerpc_cpu)];
#define xPPC_CONTEXT ((powerpc_cpu *)dummy_ppc_context)
#else
#define xPPC_CONTEXT ((powerpc_cpu *)0)
#endif
#define xPPC_FIELD(M) (((uintptr)&xPPC_CONTEXT->M) - (uintptr)xPPC_CONTEXT)
#define xPPC_GPR(N) xPPC_FIELD(gpr(N))
#define xPPC_VR(N) xPPC_FIELD(vr(N))
#define xPPC_CR xPPC_FIELD(cr())

View File

@ -235,6 +235,9 @@ struct powerpc_cpu_base
};
powerpc_cpu_base::powerpc_cpu_base()
#ifndef SHEEPSHAVER
: powerpc_cpu(NULL)
#endif
{
init_decoder();
}