summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/cpu/mips/mips3drc.c4
-rw-r--r--src/emu/cpu/powerpc/ppcdrc.c4
-rw-r--r--src/emu/cpu/rsp/rspdrc.c70
-rw-r--r--src/emu/cpu/sh2/sh2drc.c4
-rw-r--r--src/emu/profiler.c1
-rw-r--r--src/emu/profiler.h1
6 files changed, 58 insertions, 26 deletions
diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c
index b28ffd8d9ba..752246acb13 100644
--- a/src/emu/cpu/mips/mips3drc.c
+++ b/src/emu/cpu/mips/mips3drc.c
@@ -28,6 +28,7 @@
#include <stddef.h>
#include "cpuintrf.h"
#include "debugger.h"
+#include "profiler.h"
#include "cpuexec.h"
#include "mips3com.h"
#include "mips3fe.h"
@@ -749,6 +750,8 @@ static void code_compile_block(mips3_state *mips3, UINT8 mode, offs_t pc)
drcuml_block *block;
jmp_buf errorbuf;
+ profiler_mark_start(PROFILER_DRC_COMPILE);
+
/* get a description of this sequence */
desclist = drcfe_describe_code(mips3->impstate->drcfe, pc);
if (LOG_UML || LOG_NATIVE)
@@ -832,6 +835,7 @@ static void code_compile_block(mips3_state *mips3, UINT8 mode, offs_t pc)
/* end the sequence */
drcuml_block_end(block);
+ profiler_mark_end();
}
diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c
index e0c4afd3ef8..88d176c8d5b 100644
--- a/src/emu/cpu/powerpc/ppcdrc.c
+++ b/src/emu/cpu/powerpc/ppcdrc.c
@@ -19,6 +19,7 @@
#include <stddef.h>
#include "cpuintrf.h"
#include "debugger.h"
+#include "profiler.h"
#include "ppccom.h"
#include "ppcfe.h"
#include "cpu/drcfe.h"
@@ -953,6 +954,8 @@ static void code_compile_block(powerpc_state *ppc, UINT8 mode, offs_t pc)
drcuml_block *block;
jmp_buf errorbuf;
+ profiler_mark_start(PROFILER_DRC_COMPILE);
+
/* get a description of this sequence */
desclist = drcfe_describe_code(ppc->impstate->drcfe, pc);
if (LOG_UML || LOG_NATIVE)
@@ -1034,6 +1037,7 @@ static void code_compile_block(powerpc_state *ppc, UINT8 mode, offs_t pc)
/* end the sequence */
drcuml_block_end(block);
+ profiler_mark_end();
}
diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c
index 679e277676c..ffd11b1b0e7 100644
--- a/src/emu/cpu/rsp/rspdrc.c
+++ b/src/emu/cpu/rsp/rspdrc.c
@@ -20,6 +20,7 @@
#include "cpuintrf.h"
#include "debugger.h"
+#include "profiler.h"
#include "rsp.h"
#include "rspfe.h"
#include "cpu/drcfe.h"
@@ -172,6 +173,8 @@ static int generate_regimm(rsp_state *rsp, drcuml_block *block, compiler_state *
static int generate_cop0(rsp_state *rsp, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);
static int generate_cop2(rsp_state *rsp, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);
+static void log_add_disasm_comment(rsp_state *rsp, drcuml_block *block, UINT32 pc, UINT32 op);
+
/***************************************************************************
HELPFUL DEFINES
***************************************************************************/
@@ -3617,6 +3620,8 @@ static void code_compile_block(rsp_state *rsp, offs_t pc)
int override = FALSE;
drcuml_block *block;
jmp_buf errorbuf;
+
+ profiler_mark_start(PROFILER_DRC_COMPILE);
/* get a description of this sequence */
desclist = drcfe_describe_code(rsp->impstate->drcfe, pc);
@@ -3697,6 +3702,7 @@ static void code_compile_block(rsp_state *rsp, offs_t pc)
/* end the sequence */
drcuml_block_end(block);
+ profiler_mark_end();
}
/***************************************************************************
@@ -4069,6 +4075,10 @@ static void generate_sequence_instruction(rsp_state *rsp, drcuml_block *block, c
{
offs_t expc;
+ /* add an entry for the log */
+ if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
+ log_add_disasm_comment(rsp, block, desc->pc, desc->opptr.l[0]);
+
/* set the PC map variable */
expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 3 : desc->pc;
UML_MAPVAR(block, MAPVAR_PC, expc); // mapvar PC,expc
@@ -4244,8 +4254,7 @@ static int generate_opcode(rsp_state *rsp, drcuml_block *block, compiler_state *
case 0x09: /* ADDIU - MIPS I */
if (RTREG != 0)
{
- UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL,V
- UML_SEXT(block, R32(RTREG), IREG(0), DWORD); // dsext <rtreg>,i0,dword
+ UML_ADD(block, R32(RTREG), R32(RSREG), IMM(SIMMVAL)); // add i0,<rsreg>,SIMMVAL,V
}
return TRUE;
@@ -4404,48 +4413,42 @@ static int generate_special(rsp_state *rsp, drcuml_block *block, compiler_state
case 0x00: /* SLL - MIPS I */
if (RDREG != 0)
{
- UML_SHL(block, IREG(0), R32(RTREG), IMM(SHIFT)); // shl i0,<rtreg>,<shift>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SHL(block, R32(RDREG), R32(RTREG), IMM(SHIFT)); // shl i0,<rtreg>,<shift>
}
return TRUE;
case 0x02: /* SRL - MIPS I */
if (RDREG != 0)
{
- UML_SHR(block, IREG(0), R32(RTREG), IMM(SHIFT)); // shr i0,<rtreg>,<shift>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SHR(block, R32(RDREG), R32(RTREG), IMM(SHIFT)); // shr i0,<rtreg>,<shift>
}
return TRUE;
case 0x03: /* SRA - MIPS I */
if (RDREG != 0)
{
- UML_SAR(block, IREG(0), R32(RTREG), IMM(SHIFT)); // sar i0,<rtreg>,<shift>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SAR(block, R32(RDREG), R32(RTREG), IMM(SHIFT)); // sar i0,<rtreg>,<shift>
}
return TRUE;
case 0x04: /* SLLV - MIPS I */
if (RDREG != 0)
{
- UML_SHL(block, IREG(0), R32(RTREG), R32(RSREG)); // shl i0,<rtreg>,<rsreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SHL(block, R32(RDREG), R32(RTREG), R32(RSREG)); // shl i0,<rtreg>,<rsreg>
}
return TRUE;
case 0x06: /* SRLV - MIPS I */
if (RDREG != 0)
{
- UML_SHR(block, IREG(0), R32(RTREG), R32(RSREG)); // shr i0,<rtreg>,<rsreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SHR(block, R32(RDREG), R32(RTREG), R32(RSREG)); // shr i0,<rtreg>,<rsreg>
}
return TRUE;
case 0x07: /* SRAV - MIPS I */
if (RDREG != 0)
{
- UML_SAR(block, IREG(0), R32(RTREG), R32(RSREG)); // sar i0,<rtreg>,<rsreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SAR(block, R32(RDREG), R32(RTREG), R32(RSREG)); // sar i0,<rtreg>,<rsreg>
}
return TRUE;
@@ -4454,32 +4457,28 @@ static int generate_special(rsp_state *rsp, drcuml_block *block, compiler_state
case 0x20: /* ADD - MIPS I */
if (RDREG != 0)
{
- UML_ADD(block, IREG(0), R32(RSREG), R32(RTREG)); // add i0,<rsreg>,<rtreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_ADD(block, R32(RDREG), R32(RSREG), R32(RTREG)); // add i0,<rsreg>,<rtreg>
}
return TRUE;
case 0x21: /* ADDU - MIPS I */
if (RDREG != 0)
{
- UML_ADD(block, IREG(0), R32(RSREG), R32(RTREG)); // add i0,<rsreg>,<rtreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_ADD(block, R32(RDREG), R32(RSREG), R32(RTREG)); // add i0,<rsreg>,<rtreg>
}
return TRUE;
case 0x22: /* SUB - MIPS I */
if (RDREG != 0)
{
- UML_SUB(block, IREG(0), R32(RSREG), R32(RTREG)); // sub i0,<rsreg>,<rtreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SUB(block, R32(RDREG), R32(RSREG), R32(RTREG)); // sub i0,<rsreg>,<rtreg>
}
return TRUE;
case 0x23: /* SUBU - MIPS I */
if (RDREG != 0)
{
- UML_SUB(block, IREG(0), R32(RSREG), R32(RTREG)); // sub i0,<rsreg>,<rtreg>
- UML_SEXT(block, R32(RDREG), IREG(0), DWORD); // dsext <rdreg>,i0,dword
+ UML_SUB(block, R32(RDREG), R32(RSREG), R32(RTREG)); // sub i0,<rsreg>,<rtreg>
}
return TRUE;
@@ -4658,15 +4657,15 @@ static int generate_cop0(rsp_state *rsp, drcuml_block *block, compiler_state *co
case 0x00: /* MFCz */
if (RTREG != 0)
{
- UML_SEXT(block, MEM(&rsp->impstate->arg0), IMM(RDREG), DWORD); // mov [arg0],<rtreg>,dword
- UML_SEXT(block, MEM(&rsp->impstate->arg1), IMM(RTREG), DWORD); // mov [arg1],<rdval>,dword
+ UML_MOV(block, MEM(&rsp->impstate->arg0), IMM(RDREG)); // mov [arg0],<rtreg>,dword
+ UML_MOV(block, MEM(&rsp->impstate->arg1), IMM(RTREG)); // mov [arg1],<rdval>,dword
UML_CALLC(block, cfunc_get_cop0_reg, rsp); // callc cfunc_get_cop0_reg
}
return TRUE;
case 0x04: /* MTCz */
- UML_SEXT(block, MEM(&rsp->impstate->arg0), IMM(RDREG), DWORD); // mov [arg0],<rtreg>,dword
- UML_SEXT(block, MEM(&rsp->impstate->arg1), R32(RTREG), DWORD); // mov [arg1],<rdval>,dword
+ UML_MOV(block, MEM(&rsp->impstate->arg0), IMM(RDREG)); // mov [arg0],<rtreg>,dword
+ UML_MOV(block, MEM(&rsp->impstate->arg1), R32(RTREG)); // mov [arg1],<rdval>,dword
UML_CALLC(block, cfunc_set_cop0_reg, rsp); // callc cfunc_set_cop0_reg
return TRUE;
}
@@ -4719,6 +4718,25 @@ static void cfunc_ctc2(void *param)
rsp->flag[RDREG] = RTVAL & 0xffff;
}
+/***************************************************************************
+ CODE LOGGING HELPERS
+***************************************************************************/
+
+/*-------------------------------------------------
+ log_add_disasm_comment - add a comment
+ including disassembly of a RSP instruction
+-------------------------------------------------*/
+
+static void log_add_disasm_comment(rsp_state *rsp, drcuml_block *block, UINT32 pc, UINT32 op)
+{
+#if (LOG_UML)
+ char buffer[100];
+ rsp_dasm_one(buffer, pc, op);
+ UML_COMMENT(block, "%08X: %s", pc, buffer); // comment
+#endif
+}
+
+
static CPU_SET_INFO( rsp )
{
rsp_state *rsp = get_safe_token(device);
diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c
index e92b1cdac9f..7ca7e3574a1 100644
--- a/src/emu/cpu/sh2/sh2drc.c
+++ b/src/emu/cpu/sh2/sh2drc.c
@@ -19,6 +19,7 @@
#include "sh2.h"
#include "sh2comn.h"
#include "eminline.h"
+#include "profiler.h"
CPU_DISASSEMBLE( sh2 );
@@ -930,6 +931,8 @@ static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc)
drcuml_block *block;
jmp_buf errorbuf;
+ profiler_mark_start(PROFILER_DRC_COMPILE);
+
/* get a description of this sequence */
desclist = drcfe_describe_code(sh2->drcfe, pc);
if (LOG_UML || LOG_NATIVE)
@@ -1019,6 +1022,7 @@ static void code_compile_block(SH2 *sh2, UINT8 mode, offs_t pc)
/* end the sequence */
drcuml_block_end(block);
+ profiler_mark_end();
}
/*-------------------------------------------------
diff --git a/src/emu/profiler.c b/src/emu/profiler.c
index 972496abd1d..0d521e6318c 100644
--- a/src/emu/profiler.c
+++ b/src/emu/profiler.c
@@ -115,6 +115,7 @@ astring *_profiler_get_text(running_machine *machine, astring *string)
{
static const profile_string names[] =
{
+ { PROFILER_DRC_COMPILE, "DRC Compilation" },
{ PROFILER_MEMREAD, "Memory Read" },
{ PROFILER_MEMWRITE, "Memory Write" },
{ PROFILER_VIDEO, "Video Update" },
diff --git a/src/emu/profiler.h b/src/emu/profiler.h
index 439216c4eff..bb8de392888 100644
--- a/src/emu/profiler.h
+++ b/src/emu/profiler.h
@@ -36,6 +36,7 @@ enum
{
PROFILER_CPU_FIRST = 0,
PROFILER_CPU_MAX = PROFILER_CPU_FIRST + 32,
+ PROFILER_DRC_COMPILE,
PROFILER_MEMREAD,
PROFILER_MEMWRITE,
PROFILER_VIDEO,