mirror of https://github.com/inolen/redream.git
jit debug hacks
This commit is contained in:
parent
ffc4049a13
commit
c0114cf749
|
@ -319,6 +319,9 @@ static void jit_promote_fastmem(struct jit *jit, struct jit_block *block,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lse_hack_enable;
|
||||||
|
int lse_hack_count;
|
||||||
|
|
||||||
void jit_compile_code(struct jit *jit, uint32_t guest_addr) {
|
void jit_compile_code(struct jit *jit, uint32_t guest_addr) {
|
||||||
#if 0
|
#if 0
|
||||||
LOG_INFO("jit_compile_block %s 0x%08x", jit->tag, guest_addr);
|
LOG_INFO("jit_compile_block %s 0x%08x", jit->tag, guest_addr);
|
||||||
|
@ -361,7 +364,25 @@ void jit_compile_code(struct jit *jit, uint32_t guest_addr) {
|
||||||
/* run optimization passes */
|
/* run optimization passes */
|
||||||
jit_promote_fastmem(jit, block, &ir);
|
jit_promote_fastmem(jit, block, &ir);
|
||||||
cfa_run(jit->cfa, &ir);
|
cfa_run(jit->cfa, &ir);
|
||||||
lse_run(jit->lse, &ir);
|
|
||||||
|
lse_hack_enable = guest_addr == 0x8c0664c6;
|
||||||
|
lse_hack_count = 0;
|
||||||
|
|
||||||
|
static const uint32_t test[] = {
|
||||||
|
0x0,
|
||||||
|
};
|
||||||
|
int i = 0;
|
||||||
|
int len = ARRAY_SIZE(test);
|
||||||
|
while (i < len) {
|
||||||
|
if (guest_addr == test[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (i == len) {
|
||||||
|
lse_run(jit->lse, &ir);
|
||||||
|
}
|
||||||
|
|
||||||
cprop_run(jit->cprop, &ir);
|
cprop_run(jit->cprop, &ir);
|
||||||
esimp_run(jit->esimp, &ir);
|
esimp_run(jit->esimp, &ir);
|
||||||
dce_run(jit->dce, &ir);
|
dce_run(jit->dce, &ir);
|
||||||
|
|
|
@ -99,12 +99,20 @@ static int lse_test_available(struct lse *lse, int offset, int size) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int lse_hack_enable;
|
||||||
|
extern int lse_hack_count;
|
||||||
|
|
||||||
static void lse_eliminate_loads(struct lse *lse, struct ir *ir,
|
static void lse_eliminate_loads(struct lse *lse, struct ir *ir,
|
||||||
struct ir_block *block) {
|
struct ir_block *block) {
|
||||||
lse_clear_available(lse);
|
lse_clear_available(lse);
|
||||||
|
|
||||||
list_for_each_entry_safe(instr, &block->instrs, struct ir_instr, it) {
|
list_for_each_entry_safe(instr, &block->instrs, struct ir_instr, it) {
|
||||||
if (instr->op == OP_FALLBACK || instr->op == OP_CALL) {
|
if (lse_hack_enable && instr->op == OP_CALL_COND) {
|
||||||
|
if (lse_hack_count < 16) {
|
||||||
|
lse_clear_available(lse);
|
||||||
|
}
|
||||||
|
lse_hack_count++;
|
||||||
|
} else if (instr->op == OP_FALLBACK || instr->op == OP_CALL) {
|
||||||
lse_clear_available(lse);
|
lse_clear_available(lse);
|
||||||
} else if (instr->op == OP_BRANCH || instr->op == OP_BRANCH_COND) {
|
} else if (instr->op == OP_BRANCH || instr->op == OP_BRANCH_COND) {
|
||||||
lse_clear_available(lse);
|
lse_clear_available(lse);
|
||||||
|
|
Loading…
Reference in New Issue