diff --git a/src/jit/jit.c b/src/jit/jit.c index 8745aa35..4801db67 100644 --- a/src/jit/jit.c +++ b/src/jit/jit.c @@ -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) { #if 0 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 */ jit_promote_fastmem(jit, block, &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); esimp_run(jit->esimp, &ir); dce_run(jit->dce, &ir); diff --git a/src/jit/passes/load_store_elimination_pass.c b/src/jit/passes/load_store_elimination_pass.c index 64d3b1bc..1e6db787 100644 --- a/src/jit/passes/load_store_elimination_pass.c +++ b/src/jit/passes/load_store_elimination_pass.c @@ -99,12 +99,20 @@ static int lse_test_available(struct lse *lse, int offset, int size) { return 1; } +extern int lse_hack_enable; +extern int lse_hack_count; + static void lse_eliminate_loads(struct lse *lse, struct ir *ir, struct ir_block *block) { lse_clear_available(lse); 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); } else if (instr->op == OP_BRANCH || instr->op == OP_BRANCH_COND) { lse_clear_available(lse);