- merge OP_BL in thumb mode;

winport:
- update SVN tools;
This commit is contained in:
mtabachenko 2013-09-16 08:03:52 +00:00
parent 45658d4543
commit 4d95474f92
10 changed files with 50 additions and 45 deletions

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2006 yopyop /* Copyright (C) 2006 yopyop
Copyright (C) 2011 Loren Merritt Copyright (C) 2011 Loren Merritt
Copyright (C) 2012 DeSmuME team Copyright (C) 2012-2013 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -3868,11 +3868,16 @@ static u32 instr_attributes(u32 opcode)
static bool instr_is_branch(u32 opcode) static bool instr_is_branch(u32 opcode)
{ {
u32 x = instr_attributes(opcode); u32 x = instr_attributes(opcode);
if(bb_thumb) if(bb_thumb)
{
// merge OP_BL_10+OP_BL_11
if (x & MERGE_NEXT) return false;
return (x & BRANCH_ALWAYS) return (x & BRANCH_ALWAYS)
|| ((x & BRANCH_POS0) && ((opcode&7) | ((opcode>>4)&8)) == 15) || ((x & BRANCH_POS0) && ((opcode&7) | ((opcode>>4)&8)) == 15)
|| (x & BRANCH_SWI) || (x & BRANCH_SWI)
|| (x & JIT_BYPASS); || (x & JIT_BYPASS);
}
else else
return (x & BRANCH_ALWAYS) return (x & BRANCH_ALWAYS)
|| ((x & BRANCH_POS12) && REG_POS(opcode,12) == 15) || ((x & BRANCH_POS12) && REG_POS(opcode,12) == 15)
@ -4111,7 +4116,7 @@ static u32 compile_basicblock()
u32 cycles = instr_cycles(opcode); u32 cycles = instr_cycles(opcode);
bEndBlock = (i >= (CommonSettings.jit_max_block_size - 1)) || instr_is_branch(opcode); bEndBlock = instr_is_branch(opcode) || (i >= (CommonSettings.jit_max_block_size - 1));
#if LOG_JIT #if LOG_JIT
if (instr_is_conditional(opcode) && (cycles > 1) || (cycles == 0)) if (instr_is_conditional(opcode) && (cycles > 1) || (cycles == 0))
@ -4236,7 +4241,7 @@ template<int PROCNUM> u32 arm_jit_compile()
template u32 arm_jit_compile<0>(); template u32 arm_jit_compile<0>();
template u32 arm_jit_compile<1>(); template u32 arm_jit_compile<1>();
void arm_jit_reset(bool enable) void arm_jit_reset(bool enable, bool suppress_msg)
{ {
#if LOG_JIT #if LOG_JIT
c.setLogger(&logger); c.setLogger(&logger);
@ -4247,7 +4252,8 @@ void arm_jit_reset(bool enable)
#ifdef HAVE_STATIC_CODE_BUFFER #ifdef HAVE_STATIC_CODE_BUFFER
scratchptr = scratchpad; scratchptr = scratchpad;
#endif #endif
printf("CPU mode: %s\n", enable?"JIT":"Interpreter"); if (!suppress_msg)
printf("CPU mode: %s\n", enable?"JIT":"Interpreter");
saveBlockSizeJIT = CommonSettings.jit_max_block_size; saveBlockSizeJIT = CommonSettings.jit_max_block_size;
if (enable) if (enable)

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2006 yopyop /* Copyright (C) 2006 yopyop
Copyright (C) 2011 Loren Merritt Copyright (C) 2011 Loren Merritt
Copyright (C) 2012 DeSmuME team Copyright (C) 2012-2013 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -26,7 +26,7 @@
typedef u32 (FASTCALL* ArmOpCompiled)(); typedef u32 (FASTCALL* ArmOpCompiled)();
void arm_jit_reset(bool enable); void arm_jit_reset(bool enable, bool suppress_msg = false);
void arm_jit_close(); void arm_jit_close();
void arm_jit_sync(); void arm_jit_sync();
template<int PROCNUM> u32 arm_jit_compile(); template<int PROCNUM> u32 arm_jit_compile();

View File

@ -1,6 +1,6 @@
/* Copyright (C) 2006 yopyop /* Copyright (C) 2006 yopyop
Copyright (C) 2011 Loren Merritt Copyright (C) 2011 Loren Merritt
Copyright (C) 2012 DeSmuME team Copyright (C) 2012-2013 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -41,6 +41,8 @@
#define BRANCH_LDM 0x00004000 #define BRANCH_LDM 0x00004000
#define BRANCH_SWI 0x00008000 // branch if use external SWI - if (cpu->swi_tab == NULL) #define BRANCH_SWI 0x00008000 // branch if use external SWI - if (cpu->swi_tab == NULL)
#define MERGE_NEXT 0x04000000
#define JIT_BYPASS 0x80000000 // JIT makes no assumptions about what this instruction does #define JIT_BYPASS 0x80000000 // JIT makes no assumptions about what this instruction does
static const u32 instruction_attributes[4096] = { static const u32 instruction_attributes[4096] = {
@ -5103,38 +5105,38 @@ INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX
INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX
INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX
INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX INSTR_CYCLES(3) | BRANCH_ALWAYS, //OP_BLX
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(1) | BRANCH_NEVER , //OP_BL_10 INSTR_CYCLES(1) | BRANCH_NEVER | MERGE_NEXT, //OP_BL_10
INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11 INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11
INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11 INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11
INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11 INSTR_CYCLES(4) | BRANCH_ALWAYS, //OP_BL_11

View File

@ -3,7 +3,7 @@
licensed under the terms supplied at the end of this file (for the terms are very long!) licensed under the terms supplied at the end of this file (for the terms are very long!)
Differences from that baseline version are: Differences from that baseline version are:
Copyright (C) 2009-2011 DeSmuME team Copyright (C) 2009-2013 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -97,9 +97,6 @@ void HK_ReloadROM(int, bool justPressed)
#ifdef HAVE_JIT #ifdef HAVE_JIT
void HK_CpuMode(int, bool justPressed) void HK_CpuMode(int, bool justPressed)
{ {
extern void arm_jit_sync();
void arm_jit_reset(bool enable);
arm_jit_sync(); arm_jit_sync();
CommonSettings.use_jit = !CommonSettings.use_jit; CommonSettings.use_jit = !CommonSettings.use_jit;
arm_jit_reset(CommonSettings.use_jit); arm_jit_reset(CommonSettings.use_jit);
@ -119,7 +116,7 @@ void HK_JitBlockSizeDec(int, bool justPressed)
char tmp[256]; char tmp[256];
sprintf(tmp,"JIT block size changed to: %d", CommonSettings.jit_max_block_size); sprintf(tmp,"JIT block size changed to: %d", CommonSettings.jit_max_block_size);
osd->addLine(tmp); osd->addLine(tmp);
arm_jit_reset(CommonSettings.use_jit); arm_jit_reset(CommonSettings.use_jit, true);
} }
void HK_JitBlockSizeInc(int, bool justPressed) void HK_JitBlockSizeInc(int, bool justPressed)
@ -131,7 +128,7 @@ void HK_JitBlockSizeInc(int, bool justPressed)
char tmp[256]; char tmp[256];
sprintf(tmp,"JIT block size changed to: %d", CommonSettings.jit_max_block_size); sprintf(tmp,"JIT block size changed to: %d", CommonSettings.jit_max_block_size);
osd->addLine(tmp); osd->addLine(tmp);
arm_jit_reset(CommonSettings.use_jit); arm_jit_reset(CommonSettings.use_jit, true);
} }
#endif #endif