From a0a2a92107cb2ef43b9dab7f1f0bf4e3487436f5 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 25 Jun 2024 22:23:23 +0300 Subject: move branches to have the dest in r0 --- src/compile/compile.c | 6 +++--- src/ejit.c | 4 ++-- src/interp.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/compile/compile.c b/src/compile/compile.c index e651199..807ecc4 100644 --- a/src/compile/compile.c +++ b/src/compile/compile.c @@ -98,10 +98,10 @@ static void compile_addr(struct ejit_func *f, jit_state_t *j, struct ejit_insn i static void compile_bltr(struct ejit_func *f, jit_state_t *j, struct ejit_insn i, struct vec *relocs) { - jit_gpr_t c0 = getloc(f, j, i.r0, 0); - jit_gpr_t c1 = getloc(f, j, i.r1, 1); + jit_gpr_t c0 = getloc(f, j, i.r1, 0); + jit_gpr_t c1 = getloc(f, j, i.r2, 1); jit_reloc_t r = jit_bltr(j, c0, c1); - struct reloc_helper h = {.r = r, .to = i.o}; + struct reloc_helper h = {.r = r, .to = i.r0}; vect_append(struct reloc_helper, *relocs, &h); } diff --git a/src/ejit.c b/src/ejit.c index 69ade9a..9393dc0 100644 --- a/src/ejit.c +++ b/src/ejit.c @@ -93,7 +93,7 @@ void ejit_patch(struct ejit_func *f, struct ejit_reloc r, struct ejit_label l) { struct ejit_insn i = vect_at(struct ejit_insn, f->insns, r.insn); /** @todo some assert that checks the opcode? */ - i.o = l.addr; + i.r0 = l.addr; vect_at(struct ejit_insn, f->insns, r.insn) = i; } @@ -190,7 +190,7 @@ void ejit_movi(struct ejit_func *s, struct ejit_gpr r0, long o) struct ejit_reloc ejit_bltr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = vec_len(&s->insns); - emit_insn_i(s, BLTR, r0.r, r1.r, 0); + emit_insn_r(s, BLTR, 0, r0.r, r1.r); return (struct ejit_reloc){.insn = addr}; } diff --git a/src/interp.c b/src/interp.c index bbf461b..158606b 100644 --- a/src/interp.c +++ b/src/interp.c @@ -93,8 +93,8 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, struct ejit_arg a DISPATCH(); DO(bltr); - if (gpr[i.r0] < gpr[i.r1]) - JUMP(i.o); + if (gpr[i.r1] < gpr[i.r2]) + JUMP(i.r0); DISPATCH(); -- cgit v1.2.3