mirror of https://github.com/inolen/redream.git
renamed CALL_FALLBACK to FALLBACK
This commit is contained in:
parent
52e5095933
commit
eb2e1b6bcd
|
@ -654,6 +654,17 @@ static void x64_backend_reset(struct jit_backend *base) {
|
|||
x64_backend_emit_constants(backend);
|
||||
}
|
||||
|
||||
EMITTER(FALLBACK) {
|
||||
void *fallback = (void *)instr->arg[0]->i64;
|
||||
uint32_t addr = instr->arg[1]->i32;
|
||||
uint32_t raw_instr = instr->arg[2]->i32;
|
||||
|
||||
e.mov(arg0, reinterpret_cast<uint64_t>(backend->base.jit));
|
||||
e.mov(arg1, addr);
|
||||
e.mov(arg2, raw_instr);
|
||||
e.call(fallback);
|
||||
}
|
||||
|
||||
EMITTER(LOAD) {
|
||||
const Xbyak::Reg a = x64_backend_reg(backend, instr->arg[0]);
|
||||
|
||||
|
@ -1594,17 +1605,6 @@ EMITTER(CALL) {
|
|||
}
|
||||
}
|
||||
|
||||
EMITTER(CALL_FALLBACK) {
|
||||
void *fallback = (void *)instr->arg[0]->i64;
|
||||
uint32_t addr = instr->arg[1]->i32;
|
||||
uint32_t raw_instr = instr->arg[2]->i32;
|
||||
|
||||
e.mov(arg0, reinterpret_cast<uint64_t>(backend->base.jit));
|
||||
e.mov(arg1, addr);
|
||||
e.mov(arg2, raw_instr);
|
||||
e.call(fallback);
|
||||
}
|
||||
|
||||
EMITTER(DEBUG_INFO) {}
|
||||
|
||||
EMITTER(DEBUG_BREAK) {
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
void armv3_emit_instr(struct armv3_frontend *frontend, struct ir *ir, int flags,
|
||||
uint32_t addr, uint32_t instr) {
|
||||
void *fallback = armv3_fallback(instr);
|
||||
ir_call_fallback(ir, fallback, addr, instr);
|
||||
ir_fallback(ir, fallback, addr, instr);
|
||||
}
|
||||
|
|
|
@ -373,6 +373,16 @@ uint64_t ir_zext_constant(const struct ir_value *v) {
|
|||
}
|
||||
}
|
||||
|
||||
void ir_fallback(struct ir *ir, void *fallback, uint32_t addr,
|
||||
uint32_t raw_instr) {
|
||||
CHECK(fallback);
|
||||
|
||||
struct ir_instr *instr = ir_append_instr(ir, OP_FALLBACK, VALUE_V);
|
||||
ir_set_arg0(ir, instr, ir_alloc_ptr(ir, fallback));
|
||||
ir_set_arg1(ir, instr, ir_alloc_i32(ir, addr));
|
||||
ir_set_arg2(ir, instr, ir_alloc_i32(ir, raw_instr));
|
||||
}
|
||||
|
||||
struct ir_value *ir_load(struct ir *ir, struct ir_value *addr,
|
||||
enum ir_type type) {
|
||||
CHECK_EQ(VALUE_I64, addr->type);
|
||||
|
@ -946,16 +956,6 @@ void ir_call_2(struct ir *ir, struct ir_value *fn, struct ir_value *arg0,
|
|||
ir_set_arg2(ir, instr, arg1);
|
||||
}
|
||||
|
||||
void ir_call_fallback(struct ir *ir, void *fallback, uint32_t addr,
|
||||
uint32_t raw_instr) {
|
||||
CHECK(fallback);
|
||||
|
||||
struct ir_instr *instr = ir_append_instr(ir, OP_CALL_FALLBACK, VALUE_V);
|
||||
ir_set_arg0(ir, instr, ir_alloc_ptr(ir, fallback));
|
||||
ir_set_arg1(ir, instr, ir_alloc_i32(ir, addr));
|
||||
ir_set_arg2(ir, instr, ir_alloc_i32(ir, raw_instr));
|
||||
}
|
||||
|
||||
void ir_debug_info(struct ir *ir, const char *desc, uint32_t addr,
|
||||
uint32_t raw_instr) {
|
||||
struct ir_instr *instr = ir_append_instr(ir, OP_DEBUG_INFO, VALUE_V);
|
||||
|
|
|
@ -266,6 +266,10 @@ void ir_replace_uses(struct ir_value *v, struct ir_value *other);
|
|||
|
||||
uint64_t ir_zext_constant(const struct ir_value *v);
|
||||
|
||||
/* call into interpeter fallback */
|
||||
void ir_fallback(struct ir *ir, void *fallback, uint32_t addr,
|
||||
uint32_t raw_instr);
|
||||
|
||||
/* direct access to host memory */
|
||||
struct ir_value *ir_load(struct ir *ir, struct ir_value *addr,
|
||||
enum ir_type type);
|
||||
|
@ -394,8 +398,6 @@ void ir_call(struct ir *ir, struct ir_value *fn);
|
|||
void ir_call_1(struct ir *ir, struct ir_value *fn, struct ir_value *arg0);
|
||||
void ir_call_2(struct ir *ir, struct ir_value *fn, struct ir_value *arg0,
|
||||
struct ir_value *arg1);
|
||||
void ir_call_fallback(struct ir *ir, void *fallback, uint32_t addr,
|
||||
uint32_t raw_instr);
|
||||
|
||||
/* debug */
|
||||
void ir_debug_info(struct ir *ir, const char *desc, uint32_t addr,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
IR_OP(FALLBACK)
|
||||
IR_OP(LOAD)
|
||||
IR_OP(STORE)
|
||||
IR_OP(LOAD_FAST)
|
||||
|
@ -50,7 +51,6 @@ IR_OP(BRANCH)
|
|||
IR_OP(BRANCH_FALSE)
|
||||
IR_OP(BRANCH_TRUE)
|
||||
IR_OP(CALL)
|
||||
IR_OP(CALL_FALLBACK)
|
||||
IR_OP(DEBUG_INFO)
|
||||
IR_OP(DEBUG_BREAK)
|
||||
IR_OP(ASSERT_LT)
|
||||
|
|
|
@ -133,7 +133,9 @@ static void lse_set_available(struct lse *lse, int offset, struct ir_value *v) {
|
|||
static void lse_eliminate_loads_r(struct lse *lse, struct ir *ir,
|
||||
struct ir_block *block) {
|
||||
list_for_each_entry_safe(instr, &block->instrs, struct ir_instr, it) {
|
||||
if (instr->op == OP_LABEL) {
|
||||
if (instr->op == OP_FALLBACK) {
|
||||
lse_clear_available(lse);
|
||||
} else if (instr->op == OP_LABEL) {
|
||||
lse_clear_available(lse);
|
||||
} else if (instr->op == OP_BRANCH) {
|
||||
if (instr->arg[0]->type != VALUE_BLOCK) {
|
||||
|
@ -215,7 +217,9 @@ static void lse_eliminate_stores_r(struct lse *lse, struct ir *ir,
|
|||
}
|
||||
|
||||
list_for_each_entry_safe_reverse(instr, &block->instrs, struct ir_instr, it) {
|
||||
if (instr->op == OP_LABEL) {
|
||||
if (instr->op == OP_FALLBACK) {
|
||||
lse_clear_available(lse);
|
||||
} else if (instr->op == OP_LABEL) {
|
||||
lse_clear_available(lse);
|
||||
} else if (instr->op == OP_BRANCH) {
|
||||
if (instr->arg[0]->type != VALUE_BLOCK) {
|
||||
|
|
|
@ -44,7 +44,7 @@ static void sanitize_ir(struct ir *ir) {
|
|||
list_for_each_entry(instr, &block->instrs, struct ir_instr, it) {
|
||||
if (instr->op != OP_BRANCH && instr->op != OP_BRANCH_FALSE &&
|
||||
instr->op != OP_BRANCH_TRUE && instr->op != OP_CALL &&
|
||||
instr->op != OP_CALL_FALLBACK) {
|
||||
instr->op != OP_FALLBACK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue