diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-01 20:39:42 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-04-01 21:18:12 +0300 |
commit | 449c23ebc32eb45f8a6360c472bfbf5db6cd132f (patch) | |
tree | 217c5fc426b32e42647a1af2f50768885802138d | |
parent | 704baab677029882a5924a59e3fb92f2295132a4 (diff) | |
download | ejit-449c23ebc32eb45f8a6360c472bfbf5db6cd132f.tar.gz ejit-449c23ebc32eb45f8a6360c472bfbf5db6cd132f.zip |
aarch64 linux seems to work
m--------- | deps/lightening | 0 | ||||
-rwxr-xr-x | scripts/select-compile | 1 | ||||
-rw-r--r-- | src/common.h | 416 | ||||
-rw-r--r-- | src/compile/compile.c | 412 | ||||
-rw-r--r-- | src/ejit.c | 430 | ||||
-rw-r--r-- | src/interp.c | 416 |
6 files changed, 838 insertions, 837 deletions
diff --git a/deps/lightening b/deps/lightening -Subproject 1cc7a2d159d8cbfc46708d24bfe49f6c23c6e44 +Subproject 6421af4db1570a6a5fc3a15f3bcb2601d854ed0 diff --git a/scripts/select-compile b/scripts/select-compile index fca7350..9eff9fd 100755 --- a/scripts/select-compile +++ b/scripts/select-compile @@ -9,6 +9,7 @@ JIT="src/compile/compile.c" NOJIT="src/compile/nocompile.c" case "$ARCH" in + aarch64) echo "$JIT" ;; amd64) echo "$JIT" ;; x86*) echo "$JIT" ;; *) echo "$NOJIT" ;; diff --git a/src/common.h b/src/common.h index 3e56a76..6a3c754 100644 --- a/src/common.h +++ b/src/common.h @@ -21,214 +21,214 @@ #include "vec.h" enum ejit_opcode { - MOVI, - MOVI_F, - MOVI_D, - MOVR, - MOVR_F, - MOVR_D, - - LDI8, - LDI16, - LDI32, - LDI64, - LDIU8, - LDIU16, - LDIU32, - LDIU64, - LDIF, - LDID, - - LDXI8, - LDXI16, - LDXI32, - LDXI64, - LDXIU8, - LDXIU16, - LDXIU32, - LDXIU64, - LDXIF, - LDXID, - - LDXR8, - LDXR16, - LDXR32, - LDXR64, - LDXRU8, - LDXRU16, - LDXRU32, - LDXRU64, - LDXRF, - LDXRD, - - STI8, - STI16, - STI32, - STI64, - STIF, - STID, - - STXI8, - STXI16, - STXI32, - STXI64, - STXIF, - STXID, - - STXR8, - STXR16, - STXR32, - STXR64, - STXRF, - STXRD, - - EXTR8, - EXTR16, - EXTR32, - EXTRU8, - EXTRU16, - EXTRU32, - EXTRF, - EXTRD, - - ADDR, - ADDR_F, - ADDR_D, - ADDI, - - ABSR_F, - ABSR_D, - - SUBR, - SUBR_F, - SUBR_D, - SUBI, - - MULR, - MULR_F, - MULR_D, - - DIVR, - DIVR_U, - DIVR_F, - DIVR_D, - - REMR, - REMR_U, - - COMR, - NEGR, - NEGR_F, - NEGR_D, - - LSHI, - LSHR, - RSHI, - RSHI_U, - RSHR, - RSHR_U, - - ANDR, - ANDI, - - ORR, - ORI, - - XORR, - XORI, - - TRUNCR_D_32, - TRUNCR_D_64, - TRUNCR_F_32, - TRUNCR_F_64, - - EQR, - NER, - GTR, - GTR_U, - GER, - GER_U, - - EQR_F, - NER_F, - GTR_F, - GER_F, - EQR_D, - NER_D, - GTR_D, - GER_D, - - BNER, - BNEI, - BNER_F, - BNER_D, - - BEQR, - BEQI, - BEQR_F, - BEQR_D, - - BGER, - BGER_U, - BGEI, - BGEI_U, - BGER_F, - BGER_D, - - BLEI, - BLEI_U, - - BGTR, - BGTR_U, - BGTI, - BGTI_U, - BGTR_F, - BGTR_D, - - BLTI, - BLTI_U, - - JMP, - JMPR, - - BMCI, - BMCR, - BMSI, - BMSR, - - PARAM, - PARAM_F, - - ARG, - ARG_I, - ARG_F, - ARG_FI, - - ESCAPEI_I, - ESCAPEI_L, - ESCAPEI_F, - ESCAPEI_D, - - CALLI_I, - CALLI_L, - CALLI_F, - CALLI_D, - - RETR, - RETI, - RETR_F, - RETR_D, - RETI_F, - RETI_D, - - RETVAL, - RETVAL_F, - RETVAL_D, - - START, - END, - - OPCODE_COUNT, + EJIT_OP_MOVI, + EJIT_OP_MOVI_F, + EJIT_OP_MOVI_D, + EJIT_OP_MOVR, + EJIT_OP_MOVR_F, + EJIT_OP_MOVR_D, + + EJIT_OP_LDI8, + EJIT_OP_LDI16, + EJIT_OP_LDI32, + EJIT_OP_LDI64, + EJIT_OP_LDIU8, + EJIT_OP_LDIU16, + EJIT_OP_LDIU32, + EJIT_OP_LDIU64, + EJIT_OP_LDIF, + EJIT_OP_LDID, + + EJIT_OP_LDXI8, + EJIT_OP_LDXI16, + EJIT_OP_LDXI32, + EJIT_OP_LDXI64, + EJIT_OP_LDXIU8, + EJIT_OP_LDXIU16, + EJIT_OP_LDXIU32, + EJIT_OP_LDXIU64, + EJIT_OP_LDXIF, + EJIT_OP_LDXID, + + EJIT_OP_LDXR8, + EJIT_OP_LDXR16, + EJIT_OP_LDXR32, + EJIT_OP_LDXR64, + EJIT_OP_LDXRU8, + EJIT_OP_LDXRU16, + EJIT_OP_LDXRU32, + EJIT_OP_LDXRU64, + EJIT_OP_LDXRF, + EJIT_OP_LDXRD, + + EJIT_OP_STI8, + EJIT_OP_STI16, + EJIT_OP_STI32, + EJIT_OP_STI64, + EJIT_OP_STIF, + EJIT_OP_STID, + + EJIT_OP_STXI8, + EJIT_OP_STXI16, + EJIT_OP_STXI32, + EJIT_OP_STXI64, + EJIT_OP_STXIF, + EJIT_OP_STXID, + + EJIT_OP_STXR8, + EJIT_OP_STXR16, + EJIT_OP_STXR32, + EJIT_OP_STXR64, + EJIT_OP_STXRF, + EJIT_OP_STXRD, + + EJIT_OP_EXTR8, + EJIT_OP_EXTR16, + EJIT_OP_EXTR32, + EJIT_OP_EXTRU8, + EJIT_OP_EXTRU16, + EJIT_OP_EXTRU32, + EJIT_OP_EXTRF, + EJIT_OP_EXTRD, + + EJIT_OP_ADDR, + EJIT_OP_ADDR_F, + EJIT_OP_ADDR_D, + EJIT_OP_ADDI, + + EJIT_OP_ABSR_F, + EJIT_OP_ABSR_D, + + EJIT_OP_SUBR, + EJIT_OP_SUBR_F, + EJIT_OP_SUBR_D, + EJIT_OP_SUBI, + + EJIT_OP_MULR, + EJIT_OP_MULR_F, + EJIT_OP_MULR_D, + + EJIT_OP_DIVR, + EJIT_OP_DIVR_U, + EJIT_OP_DIVR_F, + EJIT_OP_DIVR_D, + + EJIT_OP_REMR, + EJIT_OP_REMR_U, + + EJIT_OP_COMR, + EJIT_OP_NEGR, + EJIT_OP_NEGR_F, + EJIT_OP_NEGR_D, + + EJIT_OP_LSHI, + EJIT_OP_LSHR, + EJIT_OP_RSHI, + EJIT_OP_RSHI_U, + EJIT_OP_RSHR, + EJIT_OP_RSHR_U, + + EJIT_OP_ANDR, + EJIT_OP_ANDI, + + EJIT_OP_ORR, + EJIT_OP_ORI, + + EJIT_OP_XORR, + EJIT_OP_XORI, + + EJIT_OP_TRUNCR_D_32, + EJIT_OP_TRUNCR_D_64, + EJIT_OP_TRUNCR_F_32, + EJIT_OP_TRUNCR_F_64, + + EJIT_OP_EQR, + EJIT_OP_NER, + EJIT_OP_GTR, + EJIT_OP_GTR_U, + EJIT_OP_GER, + EJIT_OP_GER_U, + + EJIT_OP_EQR_F, + EJIT_OP_NER_F, + EJIT_OP_GTR_F, + EJIT_OP_GER_F, + EJIT_OP_EQR_D, + EJIT_OP_NER_D, + EJIT_OP_GTR_D, + EJIT_OP_GER_D, + + EJIT_OP_BNER, + EJIT_OP_BNEI, + EJIT_OP_BNER_F, + EJIT_OP_BNER_D, + + EJIT_OP_BEQR, + EJIT_OP_BEQI, + EJIT_OP_BEQR_F, + EJIT_OP_BEQR_D, + + EJIT_OP_BGER, + EJIT_OP_BGER_U, + EJIT_OP_BGEI, + EJIT_OP_BGEI_U, + EJIT_OP_BGER_F, + EJIT_OP_BGER_D, + + EJIT_OP_BLEI, + EJIT_OP_BLEI_U, + + EJIT_OP_BGTR, + EJIT_OP_BGTR_U, + EJIT_OP_BGTI, + EJIT_OP_BGTI_U, + EJIT_OP_BGTR_F, + EJIT_OP_BGTR_D, + + EJIT_OP_BLTI, + EJIT_OP_BLTI_U, + + EJIT_OP_JMP, + EJIT_OP_JMPR, + + EJIT_OP_BMCI, + EJIT_OP_BMCR, + EJIT_OP_BMSI, + EJIT_OP_BMSR, + + EJIT_OP_PARAM, + EJIT_OP_PARAM_F, + + EJIT_OP_ARG, + EJIT_OP_ARG_I, + EJIT_OP_ARG_F, + EJIT_OP_ARG_FI, + + EJIT_OP_ESCAPEI_I, + EJIT_OP_ESCAPEI_L, + EJIT_OP_ESCAPEI_F, + EJIT_OP_ESCAPEI_D, + + EJIT_OP_CALLI_I, + EJIT_OP_CALLI_L, + EJIT_OP_CALLI_F, + EJIT_OP_CALLI_D, + + EJIT_OP_RETR, + EJIT_OP_RETI, + EJIT_OP_RETR_F, + EJIT_OP_RETR_D, + EJIT_OP_RETI_F, + EJIT_OP_RETI_D, + + EJIT_OP_RETVAL, + EJIT_OP_RETVAL_F, + EJIT_OP_RETVAL_D, + + EJIT_OP_START, + EJIT_OP_END, + + EJIT_OPCODE_COUNT, }; struct ejit_insn { diff --git a/src/compile/compile.c b/src/compile/compile.c index aba44a0..b90ee54 100644 --- a/src/compile/compile.c +++ b/src/compile/compile.c @@ -566,7 +566,7 @@ static void compile_absr_d(struct ejit_func *f, jit_state_t *j, { jit_fpr_t r0 = getfpr(f, i.r0, 0); jit_fpr_t r1 = getloc_d(f, j, i.r1, 1); - jit_absr_f(j, r0, r1); + jit_absr_d(j, r0, r1); putloc_d(f, j, i.r0, r0); } @@ -1890,19 +1890,19 @@ static void compile_trampoline(struct ejit_func *f, jit_state_t *j) foreach_vec(ii, f->insns) { struct ejit_insn i = *insns_at(&f->insns, ii); switch (i.op) { - case PARAM: { + case EJIT_OP_PARAM: { jit_operand_t p = jit_operand_mem(jit_abi_from(i.r1), JIT_R1, arg_offset(i)); operands_append(&args, p); break; } - case PARAM_F: { + case EJIT_OP_PARAM_F: { jit_operand_t p = jit_operand_mem(jit_abi_from(i.r1), JIT_R1, arg_offset(i)); operands_append(&args, p); break; } - case START: { + case EJIT_OP_START: { /* callr should be smart enough to avoid JIT_R0 if some * other register wants to write to it */ jit_reloc_t r = jit_mov_addr(j, JIT_R0); @@ -1961,186 +1961,186 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, struct ejit_insn i = *insns_at(&f->insns, ii); switch (i.op) { - case MOVR: compile_movr(f, j, i); break; - case MOVR_F: compile_movr_f(f, j, i); break; - case MOVR_D: compile_movr_d(f, j, i); break; - - case MOVI: compile_movi(f, j, i); break; - case MOVI_F: compile_movi_f(f, j, i); break; - case MOVI_D: compile_movi_d(f, j, i); break; - - case ADDR: compile_addr(f, j, i); break; - case ADDI: compile_addi(f, j, i); break; - case ADDR_F: compile_addr_f(f, j, i); break; - case ADDR_D: compile_addr_d(f, j, i); break; - - case SUBR: compile_subr(f, j, i); break; - case SUBI: compile_subi(f, j, i); break; - case SUBR_F: compile_subr_f(f, j, i); break; - case SUBR_D: compile_subr_d(f, j, i); break; - - case MULR: compile_mulr(f, j, i); break; - case MULR_F: compile_mulr_f(f, j, i); break; - case MULR_D: compile_mulr_d(f, j, i); break; - - case ANDI: compile_andi(f, j, i); break; - case ANDR: compile_andr(f, j, i); break; - - case ORI: compile_ori(f, j, i); break; - case ORR: compile_orr(f, j, i); break; - - case XORI: compile_xori(f, j, i); break; - case XORR: compile_xorr(f, j, i); break; - - case DIVR: compile_divr(f, j, i); break; - case DIVR_U: compile_divr_u(f, j, i); break; - case DIVR_F: compile_divr_f(f, j, i); break; - case DIVR_D: compile_divr_d(f, j, i); break; - - case REMR: compile_remr(f, j, i); break; - case REMR_U: compile_remr_u(f, j, i); break; - - case ABSR_F: compile_absr_f(f, j, i); break; - case ABSR_D: compile_absr_d(f, j, i); break; - - case LSHI: compile_lshi(f, j, i); break; - case LSHR: compile_lshr(f, j, i); break; - case RSHI: compile_rshi(f, j, i); break; - case RSHI_U: compile_rshi_u(f, j, i); break; - case RSHR: compile_rshr(f, j, i); break; - case RSHR_U: compile_rshr_u(f, j, i); break; - - case STI8: compile_sti8(f, j, i); break; - case STI16: compile_sti16(f, j, i); break; - case STI32: compile_sti32(f, j, i); break; - case STI64: compile_sti64(f, j, i); break; - case STIF: compile_stif(f, j, i); break; - case STID: compile_stid(f, j, i); break; - - case STXI8: compile_stxi8(f, j, i); break; - case STXI16: compile_stxi16(f, j, i); break; - case STXI32: compile_stxi32(f, j, i); break; - case STXI64: compile_stxi64(f, j, i); break; - case STXIF: compile_stxif(f, j, i); break; - case STXID: compile_stxid(f, j, i); break; - - case STXR8: compile_stxr8(f, j, i); break; - case STXR16: compile_stxr16(f, j, i); break; - case STXR32: compile_stxr32(f, j, i); break; - case STXR64: compile_stxr64(f, j, i); break; - case STXRF: compile_stxrf(f, j, i); break; - case STXRD: compile_stxrd(f, j, i); break; - - case LDI8: compile_ldi8(f, j, i); break; - case LDI16: compile_ldi16(f, j, i); break; - case LDI32: compile_ldi32(f, j, i); break; - case LDI64: compile_ldi64(f, j, i); break; - case LDIU8: compile_ldiu8(f, j, i); break; - case LDIU16: compile_ldiu16(f, j, i); break; - case LDIU32: compile_ldiu32(f, j, i); break; - case LDIU64: compile_ldiu64(f, j, i); break; - case LDIF: compile_ldif(f, j, i); break; - case LDID: compile_ldid(f, j, i); break; - - case LDXI8: compile_ldxi8(f, j, i); break; - case LDXI16: compile_ldxi16(f, j, i); break; - case LDXI32: compile_ldxi32(f, j, i); break; - case LDXI64: compile_ldxi64(f, j, i); break; - case LDXIU8: compile_ldxiu8(f, j, i); break; - case LDXIU16: compile_ldxiu16(f, j, i); break; - case LDXIU32: compile_ldxiu32(f, j, i); break; - case LDXIU64: compile_ldxiu64(f, j, i); break; - case LDXIF: compile_ldxif(f, j, i); break; - case LDXID: compile_ldxid(f, j, i); break; - - case LDXR8: compile_ldxr8(f, j, i); break; - case LDXR16: compile_ldxr16(f, j, i); break; - case LDXR32: compile_ldxr32(f, j, i); break; - case LDXR64: compile_ldxr64(f, j, i); break; - case LDXRU8: compile_ldxru8(f, j, i); break; - case LDXRU16: compile_ldxru16(f, j, i); break; - case LDXRU32: compile_ldxru32(f, j, i); break; - case LDXRU64: compile_ldxru64(f, j, i); break; - case LDXRF: compile_ldxrf(f, j, i); break; - case LDXRD: compile_ldxrd(f, j, i); break; - - case COMR: compile_comr(f, j, i); break; - - case NEGR: compile_negr(f, j, i); break; - case NEGR_F: compile_negr_f(f, j, i); break; - case NEGR_D: compile_negr_d(f, j, i); break; - - case EXTR8: compile_extr8(f, j, i); break; - case EXTR16: compile_extr16(f, j, i); break; - case EXTR32: compile_extr32(f, j, i); break; - case EXTRU8: compile_extru8(f, j, i); break; - case EXTRU16: compile_extru16(f, j, i); break; - case EXTRU32: compile_extru32(f, j, i); break; - case EXTRF: compile_extrf(f, j, i); break; - case EXTRD: compile_extrd(f, j, i); break; - - case TRUNCR_D_32: compile_truncr_d_32(f, j, i); break; - case TRUNCR_D_64: compile_truncr_d_64(f, j, i); break; - case TRUNCR_F_32: compile_truncr_f_32(f, j, i); break; - case TRUNCR_F_64: compile_truncr_f_64(f, j, i); break; - - case EQR: compile_eqr(f, j, i); break; - case EQR_F: compile_eqr_f(f, j, i); break; - case EQR_D: compile_eqr_d(f, j, i); break; - - case NER: compile_ner(f, j, i); break; - case NER_F: compile_ner_f(f, j, i); break; - case NER_D: compile_ner_d(f, j, i); break; - - case GER: compile_ger(f, j, i); break; - case GER_U: compile_ger_u(f, j, i); break; - case GER_F: compile_ger_f(f, j, i); break; - case GER_D: compile_ger_d(f, j, i); break; - - case GTR: compile_gtr(f, j, i); break; - case GTR_U: compile_gtr_u(f, j, i); break; - case GTR_F: compile_gtr_f(f, j, i); break; - case GTR_D: compile_gtr_d(f, j, i); break; - - case BMCI: compile_bmci(f, j, i, &relocs); break; - case BMCR: compile_bmcr(f, j, i, &relocs); break; - - case BMSI: compile_bmsi(f, j, i, &relocs); break; - case BMSR: compile_bmsr(f, j, i, &relocs); break; - - case BEQR: compile_beqr(f, j, i, &relocs); break; - case BEQI: compile_beqi(f, j, i, &relocs); break; - case BEQR_F: compile_beqr_f(f, j, i, &relocs); break; - case BEQR_D: compile_beqr_d(f, j, i, &relocs); break; - - case BNER: compile_bner(f, j, i, &relocs); break; - case BNEI: compile_bnei(f, j, i, &relocs); break; - case BNER_F: compile_bner_f(f, j, i, &relocs); break; - case BNER_D: compile_bner_d(f, j, i, &relocs); break; - - case BGER: compile_bger(f, j, i, &relocs); break; - case BGER_U: compile_bger_u(f, j, i, &relocs); break; - case BGEI: compile_bgei(f, j, i, &relocs); break; - case BGEI_U: compile_bgei_u(f, j, i, &relocs); break; - case BGER_F: compile_bger_f(f, j, i, &relocs); break; - case BGER_D: compile_bger_d(f, j, i, &relocs); break; - - case BGTR: compile_bgtr(f, j, i, &relocs); break; - case BGTR_U: compile_bgtr_u(f, j, i, &relocs); break; - case BGTI: compile_bgti(f, j, i, &relocs); break; - case BGTI_U: compile_bgti_u(f, j, i, &relocs); break; - case BGTR_F: compile_bgtr_f(f, j, i, &relocs); break; - case BGTR_D: compile_bgtr_d(f, j, i, &relocs); break; - - case BLEI: compile_blei(f, j, i, &relocs); break; - case BLEI_U: compile_blei_u(f, j, i, &relocs); break; - - case BLTI: compile_blti(f, j, i, &relocs); break; - case BLTI_U: compile_blti_u(f, j, i, &relocs); break; - - case JMP: compile_jmp(f, j, i, &relocs); break; - - case ARG_I: { + case EJIT_OP_MOVR: compile_movr(f, j, i); break; + case EJIT_OP_MOVR_F: compile_movr_f(f, j, i); break; + case EJIT_OP_MOVR_D: compile_movr_d(f, j, i); break; + + case EJIT_OP_MOVI: compile_movi(f, j, i); break; + case EJIT_OP_MOVI_F: compile_movi_f(f, j, i); break; + case EJIT_OP_MOVI_D: compile_movi_d(f, j, i); break; + + case EJIT_OP_ADDR: compile_addr(f, j, i); break; + case EJIT_OP_ADDI: compile_addi(f, j, i); break; + case EJIT_OP_ADDR_F: compile_addr_f(f, j, i); break; + case EJIT_OP_ADDR_D: compile_addr_d(f, j, i); break; + + case EJIT_OP_SUBR: compile_subr(f, j, i); break; + case EJIT_OP_SUBI: compile_subi(f, j, i); break; + case EJIT_OP_SUBR_F: compile_subr_f(f, j, i); break; + case EJIT_OP_SUBR_D: compile_subr_d(f, j, i); break; + + case EJIT_OP_MULR: compile_mulr(f, j, i); break; + case EJIT_OP_MULR_F: compile_mulr_f(f, j, i); break; + case EJIT_OP_MULR_D: compile_mulr_d(f, j, i); break; + + case EJIT_OP_ANDI: compile_andi(f, j, i); break; + case EJIT_OP_ANDR: compile_andr(f, j, i); break; + + case EJIT_OP_ORI: compile_ori(f, j, i); break; + case EJIT_OP_ORR: compile_orr(f, j, i); break; + + case EJIT_OP_XORI: compile_xori(f, j, i); break; + case EJIT_OP_XORR: compile_xorr(f, j, i); break; + + case EJIT_OP_DIVR: compile_divr(f, j, i); break; + case EJIT_OP_DIVR_U: compile_divr_u(f, j, i); break; + case EJIT_OP_DIVR_F: compile_divr_f(f, j, i); break; + case EJIT_OP_DIVR_D: compile_divr_d(f, j, i); break; + + case EJIT_OP_REMR: compile_remr(f, j, i); break; + case EJIT_OP_REMR_U: compile_remr_u(f, j, i); break; + + case EJIT_OP_ABSR_F: compile_absr_f(f, j, i); break; + case EJIT_OP_ABSR_D: compile_absr_d(f, j, i); break; + + case EJIT_OP_LSHI: compile_lshi(f, j, i); break; + case EJIT_OP_LSHR: compile_lshr(f, j, i); break; + case EJIT_OP_RSHI: compile_rshi(f, j, i); break; + case EJIT_OP_RSHI_U: compile_rshi_u(f, j, i); break; + case EJIT_OP_RSHR: compile_rshr(f, j, i); break; + case EJIT_OP_RSHR_U: compile_rshr_u(f, j, i); break; + + case EJIT_OP_STI8: compile_sti8(f, j, i); break; + case EJIT_OP_STI16: compile_sti16(f, j, i); break; + case EJIT_OP_STI32: compile_sti32(f, j, i); break; + case EJIT_OP_STI64: compile_sti64(f, j, i); break; + case EJIT_OP_STIF: compile_stif(f, j, i); break; + case EJIT_OP_STID: compile_stid(f, j, i); break; + + case EJIT_OP_STXI8: compile_stxi8(f, j, i); break; + case EJIT_OP_STXI16: compile_stxi16(f, j, i); break; + case EJIT_OP_STXI32: compile_stxi32(f, j, i); break; + case EJIT_OP_STXI64: compile_stxi64(f, j, i); break; + case EJIT_OP_STXIF: compile_stxif(f, j, i); break; + case EJIT_OP_STXID: compile_stxid(f, j, i); break; + + case EJIT_OP_STXR8: compile_stxr8(f, j, i); break; + case EJIT_OP_STXR16: compile_stxr16(f, j, i); break; + case EJIT_OP_STXR32: compile_stxr32(f, j, i); break; + case EJIT_OP_STXR64: compile_stxr64(f, j, i); break; + case EJIT_OP_STXRF: compile_stxrf(f, j, i); break; + case EJIT_OP_STXRD: compile_stxrd(f, j, i); break; + + case EJIT_OP_LDI8: compile_ldi8(f, j, i); break; + case EJIT_OP_LDI16: compile_ldi16(f, j, i); break; + case EJIT_OP_LDI32: compile_ldi32(f, j, i); break; + case EJIT_OP_LDI64: compile_ldi64(f, j, i); break; + case EJIT_OP_LDIU8: compile_ldiu8(f, j, i); break; + case EJIT_OP_LDIU16: compile_ldiu16(f, j, i); break; + case EJIT_OP_LDIU32: compile_ldiu32(f, j, i); break; + case EJIT_OP_LDIU64: compile_ldiu64(f, j, i); break; + case EJIT_OP_LDIF: compile_ldif(f, j, i); break; + case EJIT_OP_LDID: compile_ldid(f, j, i); break; + + case EJIT_OP_LDXI8: compile_ldxi8(f, j, i); break; + case EJIT_OP_LDXI16: compile_ldxi16(f, j, i); break; + case EJIT_OP_LDXI32: compile_ldxi32(f, j, i); break; + case EJIT_OP_LDXI64: compile_ldxi64(f, j, i); break; + case EJIT_OP_LDXIU8: compile_ldxiu8(f, j, i); break; + case EJIT_OP_LDXIU16: compile_ldxiu16(f, j, i); break; + case EJIT_OP_LDXIU32: compile_ldxiu32(f, j, i); break; + case EJIT_OP_LDXIU64: compile_ldxiu64(f, j, i); break; + case EJIT_OP_LDXIF: compile_ldxif(f, j, i); break; + case EJIT_OP_LDXID: compile_ldxid(f, j, i); break; + + case EJIT_OP_LDXR8: compile_ldxr8(f, j, i); break; + case EJIT_OP_LDXR16: compile_ldxr16(f, j, i); break; + case EJIT_OP_LDXR32: compile_ldxr32(f, j, i); break; + case EJIT_OP_LDXR64: compile_ldxr64(f, j, i); break; + case EJIT_OP_LDXRU8: compile_ldxru8(f, j, i); break; + case EJIT_OP_LDXRU16: compile_ldxru16(f, j, i); break; + case EJIT_OP_LDXRU32: compile_ldxru32(f, j, i); break; + case EJIT_OP_LDXRU64: compile_ldxru64(f, j, i); break; + case EJIT_OP_LDXRF: compile_ldxrf(f, j, i); break; + case EJIT_OP_LDXRD: compile_ldxrd(f, j, i); break; + + case EJIT_OP_COMR: compile_comr(f, j, i); break; + + case EJIT_OP_NEGR: compile_negr(f, j, i); break; + case EJIT_OP_NEGR_F: compile_negr_f(f, j, i); break; + case EJIT_OP_NEGR_D: compile_negr_d(f, j, i); break; + + case EJIT_OP_EXTR8: compile_extr8(f, j, i); break; + case EJIT_OP_EXTR16: compile_extr16(f, j, i); break; + case EJIT_OP_EXTR32: compile_extr32(f, j, i); break; + case EJIT_OP_EXTRU8: compile_extru8(f, j, i); break; + case EJIT_OP_EXTRU16: compile_extru16(f, j, i); break; + case EJIT_OP_EXTRU32: compile_extru32(f, j, i); break; + case EJIT_OP_EXTRF: compile_extrf(f, j, i); break; + case EJIT_OP_EXTRD: compile_extrd(f, j, i); break; + + case EJIT_OP_TRUNCR_D_32: compile_truncr_d_32(f, j, i); break; + case EJIT_OP_TRUNCR_D_64: compile_truncr_d_64(f, j, i); break; + case EJIT_OP_TRUNCR_F_32: compile_truncr_f_32(f, j, i); break; + case EJIT_OP_TRUNCR_F_64: compile_truncr_f_64(f, j, i); break; + + case EJIT_OP_EQR: compile_eqr(f, j, i); break; + case EJIT_OP_EQR_F: compile_eqr_f(f, j, i); break; + case EJIT_OP_EQR_D: compile_eqr_d(f, j, i); break; + + case EJIT_OP_NER: compile_ner(f, j, i); break; + case EJIT_OP_NER_F: compile_ner_f(f, j, i); break; + case EJIT_OP_NER_D: compile_ner_d(f, j, i); break; + + case EJIT_OP_GER: compile_ger(f, j, i); break; + case EJIT_OP_GER_U: compile_ger_u(f, j, i); break; + case EJIT_OP_GER_F: compile_ger_f(f, j, i); break; + case EJIT_OP_GER_D: compile_ger_d(f, j, i); break; + + case EJIT_OP_GTR: compile_gtr(f, j, i); break; + case EJIT_OP_GTR_U: compile_gtr_u(f, j, i); break; + case EJIT_OP_GTR_F: compile_gtr_f(f, j, i); break; + case EJIT_OP_GTR_D: compile_gtr_d(f, j, i); break; + + case EJIT_OP_BMCI: compile_bmci(f, j, i, &relocs); break; + case EJIT_OP_BMCR: compile_bmcr(f, j, i, &relocs); break; + + case EJIT_OP_BMSI: compile_bmsi(f, j, i, &relocs); break; + case EJIT_OP_BMSR: compile_bmsr(f, j, i, &relocs); break; + + case EJIT_OP_BEQR: compile_beqr(f, j, i, &relocs); break; + case EJIT_OP_BEQI: compile_beqi(f, j, i, &relocs); break; + case EJIT_OP_BEQR_F: compile_beqr_f(f, j, i, &relocs); break; + case EJIT_OP_BEQR_D: compile_beqr_d(f, j, i, &relocs); break; + + case EJIT_OP_BNER: compile_bner(f, j, i, &relocs); break; + case EJIT_OP_BNEI: compile_bnei(f, j, i, &relocs); break; + case EJIT_OP_BNER_F: compile_bner_f(f, j, i, &relocs); break; + case EJIT_OP_BNER_D: compile_bner_d(f, j, i, &relocs); break; + + case EJIT_OP_BGER: compile_bger(f, j, i, &relocs); break; + case EJIT_OP_BGER_U: compile_bger_u(f, j, i, &relocs); break; + case EJIT_OP_BGEI: compile_bgei(f, j, i, &relocs); break; + case EJIT_OP_BGEI_U: compile_bgei_u(f, j, i, &relocs); break; + case EJIT_OP_BGER_F: compile_bger_f(f, j, i, &relocs); break; + case EJIT_OP_BGER_D: compile_bger_d(f, j, i, &relocs); break; + + case EJIT_OP_BGTR: compile_bgtr(f, j, i, &relocs); break; + case EJIT_OP_BGTR_U: compile_bgtr_u(f, j, i, &relocs); break; + case EJIT_OP_BGTI: compile_bgti(f, j, i, &relocs); break; + case EJIT_OP_BGTI_U: compile_bgti_u(f, j, i, &relocs); break; + case EJIT_OP_BGTR_F: compile_bgtr_f(f, j, i, &relocs); break; + case EJIT_OP_BGTR_D: compile_bgtr_d(f, j, i, &relocs); break; + + case EJIT_OP_BLEI: compile_blei(f, j, i, &relocs); break; + case EJIT_OP_BLEI_U: compile_blei_u(f, j, i, &relocs); break; + + case EJIT_OP_BLTI: compile_blti(f, j, i, &relocs); break; + case EJIT_OP_BLTI_U: compile_blti_u(f, j, i, &relocs); break; + + case EJIT_OP_JMP: compile_jmp(f, j, i, &relocs); break; + + case EJIT_OP_ARG_I: { jit_operand_t type = jit_operand_imm(JIT_OPERAND_ABI_WORD, i.r1); jit_operand_t arg = jit_operand_imm(jit_abi_from(i.r1), i.o); operands_append(&src, type); @@ -2159,13 +2159,13 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; } - case ARG_FI: { + case EJIT_OP_ARG_FI: { assert(false && "immediate floats (currently?) not supported"); abort(); break; } - case ARG: { + case EJIT_OP_ARG: { size_t r2 = gpr_stats_at(&f->gpr, i.r2)->rno; jit_operand_t type = jit_operand_imm(JIT_OPERAND_ABI_WORD, i.r1); @@ -2198,7 +2198,7 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; } - case ARG_F: { + case EJIT_OP_ARG_F: { size_t f2 = fpr_stats_at(&f->fpr, i.r2)->fno; jit_operand_t type = jit_operand_imm(JIT_OPERAND_ABI_WORD, i.r1); @@ -2232,7 +2232,7 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; } - case ESCAPEI_L: + case EJIT_OP_ESCAPEI_L: #if __WORDSIZE == 64 /* fallthrough */ #else @@ -2240,9 +2240,9 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; #endif - case ESCAPEI_D: - case ESCAPEI_F: - case ESCAPEI_I: { + case EJIT_OP_ESCAPEI_D: + case EJIT_OP_ESCAPEI_F: + case EJIT_OP_ESCAPEI_I: { save_caller_save_regs(f, j); jit_operand_t args[2] = { @@ -2261,7 +2261,7 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; } - case CALLI_L: + case EJIT_OP_CALLI_L: #if __WORDSIZE == 64 call = checked_run_l; goto calli; #else @@ -2269,9 +2269,9 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, break; #endif - case CALLI_F: { call = checked_run_f; goto calli; } - case CALLI_D: { call = checked_run_d; goto calli; } - case CALLI_I: { call = checked_run_i; goto calli; + case EJIT_OP_CALLI_F: { call = checked_run_f; goto calli; } + case EJIT_OP_CALLI_D: { call = checked_run_d; goto calli; } + case EJIT_OP_CALLI_I: { call = checked_run_i; goto calli; calli: save_caller_save_regs(f, j); @@ -2303,11 +2303,11 @@ calli: break; } - case RETVAL: compile_retval(f, j, i); break; - case RETVAL_F: compile_retval_f(f, j, i); break; - case RETVAL_D: compile_retval_d(f, j, i); break; + case EJIT_OP_RETVAL: compile_retval(f, j, i); break; + case EJIT_OP_RETVAL_F: compile_retval_f(f, j, i); break; + case EJIT_OP_RETVAL_D: compile_retval_d(f, j, i); break; - case RETR: { + case EJIT_OP_RETR: { jit_gpr_t r = getloc(f, j, i.r1, 0); /* R0 won't get overwritten by jit_leave_jit_abi */ jit_movr(j, JIT_R0, r); @@ -2317,7 +2317,7 @@ calli: break; } - case RETR_F: { + case EJIT_OP_RETR_F: { jit_fpr_t r = getloc_f(f, j, i.r1, 0); jit_movr_f(j, JIT_F0, r); jit_shrink_stack(j, stack); @@ -2326,7 +2326,7 @@ calli: break; } - case RETR_D: { + case EJIT_OP_RETR_D: { jit_fpr_t r = getloc_d(f, j, i.r1, 0); jit_movr_d(j, JIT_F0, r); jit_shrink_stack(j, stack); @@ -2335,14 +2335,14 @@ calli: break; } - case RETI: { + case EJIT_OP_RETI: { jit_shrink_stack(j, stack); jit_leave_jit_abi(j, gprs, fprs, frame); jit_reti(j, i.o); break; } - case END: { + case EJIT_OP_END: { /* 'void' return */ jit_shrink_stack(j, stack); jit_leave_jit_abi(j, gprs, fprs, frame); @@ -2350,7 +2350,7 @@ calli: break; } - case PARAM_F: { + case EJIT_OP_PARAM_F: { size_t f2 = fpr_stats_at(&f->fpr, i.r2)->fno; jit_operand_t to; @@ -2369,7 +2369,7 @@ calli: break; } - case PARAM: { + case EJIT_OP_PARAM: { size_t r2 = gpr_stats_at(&f->gpr, i.r2)->rno; jit_operand_t to; @@ -2388,7 +2388,7 @@ calli: break; } - case START: { + case EJIT_OP_START: { /* parameters should be done by now */ jit_load_args(j, operands_len(&dst), dst.buf); /* reuse for arguments */ @@ -356,20 +356,20 @@ struct ejit_func *ejit_create_func(enum ejit_type rtype, size_t argc, switch (args[i].kind) { case EJIT_OPERAND_GPR: { assert(ejit_int_type(args[i].type)); - emit_insn_ar(f, PARAM, i, args[i].type, EJIT_GPR(args[i].r)); + emit_insn_ar(f, EJIT_OP_PARAM, i, args[i].type, EJIT_GPR(args[i].r)); break; } case EJIT_OPERAND_FPR: { assert(ejit_float_type(args[i].type)); - emit_insn_af(f, PARAM_F, i, args[i].type, EJIT_FPR(args[i].r)); + emit_insn_af(f, EJIT_OP_PARAM_F, i, args[i].type, EJIT_FPR(args[i].r)); break; } default: abort(); } } - emit_insn_o(f, START); + emit_insn_o(f, EJIT_OP_START); return f; } @@ -398,7 +398,7 @@ void ejit_select_compile_func(struct ejit_func *f, size_t gpr, size_t fpr, bool use_64, bool try_jit, bool im_scawed) { /* emit a final end instruction in case user didn't do a return */ - emit_insn_o(f, END); + emit_insn_o(f, EJIT_OP_END); /* user can get some sanity checking done by passing these explicitly */ assert(gpr >= gpr_stats_len(&f->gpr)); @@ -463,15 +463,15 @@ void ejit_calli_i(struct ejit_func *s, struct ejit_func *f, size_t argc, for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, CALLI_I, f); + emit_insn_op(s, EJIT_OP_CALLI_I, f); } void ejit_calli_l(struct ejit_func *s, struct ejit_func *f, size_t argc, @@ -483,15 +483,15 @@ void ejit_calli_l(struct ejit_func *s, struct ejit_func *f, size_t argc, for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, CALLI_L, f); + emit_insn_op(s, EJIT_OP_CALLI_L, f); } void ejit_calli_f(struct ejit_func *s, struct ejit_func *f, size_t argc, @@ -502,15 +502,15 @@ void ejit_calli_f(struct ejit_func *s, struct ejit_func *f, size_t argc, for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, CALLI_F, f); + emit_insn_op(s, EJIT_OP_CALLI_F, f); } void ejit_calli_d(struct ejit_func *s, struct ejit_func *f, size_t argc, @@ -521,15 +521,15 @@ void ejit_calli_d(struct ejit_func *s, struct ejit_func *f, size_t argc, for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, CALLI_D, f); + emit_insn_op(s, EJIT_OP_CALLI_D, f); } void ejit_escapei_i(struct ejit_func *s, ejit_escape_i_t f, size_t argc, @@ -538,15 +538,15 @@ void ejit_escapei_i(struct ejit_func *s, ejit_escape_i_t f, size_t argc, s->max_args = argc > s->max_args ? argc : s->max_args; for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, ESCAPEI_I, f); + emit_insn_op(s, EJIT_OP_ESCAPEI_I, f); } void ejit_escapei_l(struct ejit_func *s, ejit_escape_l_t f, size_t argc, @@ -556,15 +556,15 @@ void ejit_escapei_l(struct ejit_func *s, ejit_escape_l_t f, size_t argc, s->max_args = argc > s->max_args ? argc : s->max_args; for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, ESCAPEI_L, f); + emit_insn_op(s, EJIT_OP_ESCAPEI_L, f); } void ejit_escapei_f(struct ejit_func *s, ejit_escape_f_t f, size_t argc, @@ -573,15 +573,15 @@ void ejit_escapei_f(struct ejit_func *s, ejit_escape_f_t f, size_t argc, s->max_args = argc > s->max_args ? argc : s->max_args; for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, ESCAPEI_F, f); + emit_insn_op(s, EJIT_OP_ESCAPEI_F, f); } void ejit_escapei_d(struct ejit_func *s, ejit_escape_d_t f, size_t argc, @@ -590,603 +590,603 @@ void ejit_escapei_d(struct ejit_func *s, ejit_escape_d_t f, size_t argc, s->max_args = argc > s->max_args ? argc : s->max_args; for (size_t i = 0; i < argc; ++i) { switch (args[i].kind) { - case EJIT_OPERAND_GPR: emit_insn_ar(s, ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; - case EJIT_OPERAND_FPR: emit_insn_af(s, ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; - case EJIT_OPERAND_IMM: emit_insn_ai(s, ARG_I, i, args[i].type, args[i].r); break; - case EJIT_OPERAND_FLT: emit_insn_ad(s, ARG_FI, i, args[i].type, args[i].d); break; + case EJIT_OPERAND_GPR: emit_insn_ar(s, EJIT_OP_ARG, i, args[i].type, EJIT_GPR(args[i].r)); break; + case EJIT_OPERAND_FPR: emit_insn_af(s, EJIT_OP_ARG_F, i, args[i].type, EJIT_FPR(args[i].r)); break; + case EJIT_OPERAND_IMM: emit_insn_ai(s, EJIT_OP_ARG_I, i, args[i].type, args[i].r); break; + case EJIT_OPERAND_FLT: emit_insn_ad(s, EJIT_OP_ARG_FI, i, args[i].type, args[i].d); break; default: abort(); } } - emit_insn_op(s, ESCAPEI_D, f); + emit_insn_op(s, EJIT_OP_ESCAPEI_D, f); } void ejit_retval(struct ejit_func *s, struct ejit_gpr r0) { - emit_insn_or(s, RETVAL, r0); + emit_insn_or(s, EJIT_OP_RETVAL, r0); } void ejit_retval_f(struct ejit_func *s, struct ejit_fpr f0) { - emit_insn_of(s, RETVAL_F, f0); + emit_insn_of(s, EJIT_OP_RETVAL_F, f0); } void ejit_retval_d(struct ejit_func *s, struct ejit_fpr f0) { - emit_insn_of(s, RETVAL_D, f0); + emit_insn_of(s, EJIT_OP_RETVAL_D, f0); } void ejit_sti_8(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, STI8, r0, p); + emit_insn_orp(s, EJIT_OP_STI8, r0, p); } void ejit_sti_16(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, STI16, r0, p); + emit_insn_orp(s, EJIT_OP_STI16, r0, p); } void ejit_sti_32(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, STI32, r0, p); + emit_insn_orp(s, EJIT_OP_STI32, r0, p); } void ejit_sti_64(struct ejit_func *s, struct ejit_gpr r0, void *p) { s->use_64 = true; - emit_insn_orp(s, STI64, r0, p); + emit_insn_orp(s, EJIT_OP_STI64, r0, p); } void ejit_sti_f(struct ejit_func *s, struct ejit_fpr f0, void *p) { - emit_insn_ofp(s, STIF, f0, p); + emit_insn_ofp(s, EJIT_OP_STIF, f0, p); } void ejit_sti_d(struct ejit_func *s, struct ejit_fpr f0, void *p) { - emit_insn_ofp(s, STID, f0, p); + emit_insn_ofp(s, EJIT_OP_STID, f0, p); } void ejit_stxi_8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, STXI8, r0, r1, o); + emit_insn_orri(s, EJIT_OP_STXI8, r0, r1, o); } void ejit_stxi_16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, STXI16, r0, r1, o); + emit_insn_orri(s, EJIT_OP_STXI16, r0, r1, o); } void ejit_stxi_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, STXI32, r0, r1, o); + emit_insn_orri(s, EJIT_OP_STXI32, r0, r1, o); } void ejit_stxi_64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { s->use_64 = true; - emit_insn_orri(s, STXI64, r0, r1, o); + emit_insn_orri(s, EJIT_OP_STXI64, r0, r1, o); } void ejit_stxi_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, int64_t o) { - emit_insn_ofri(s, STXIF, f0, r1, o); + emit_insn_ofri(s, EJIT_OP_STXIF, f0, r1, o); } void ejit_stxi_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, int64_t o) { - emit_insn_ofri(s, STXID, f0, r1, o); + emit_insn_ofri(s, EJIT_OP_STXID, f0, r1, o); } void ejit_stxr_8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, STXR8, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_STXR8, r0, r1, r2); } void ejit_stxr_16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, STXR16, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_STXR16, r0, r1, r2); } void ejit_stxr_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, STXR32, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_STXR32, r0, r1, r2); } void ejit_stxr_64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { s->use_64 = true; - emit_insn_orrr(s, STXR64, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_STXR64, r0, r1, r2); } void ejit_stxr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_ofrr(s, STXRF, f0, r1, r2); + emit_insn_ofrr(s, EJIT_OP_STXRF, f0, r1, r2); } void ejit_stxr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_ofrr(s, STXRD, f0, r1, r2); + emit_insn_ofrr(s, EJIT_OP_STXRD, f0, r1, r2); } void ejit_ldi_i8(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDI8, r0, p); + emit_insn_orp(s, EJIT_OP_LDI8, r0, p); } void ejit_ldi_i16(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDI16, r0, p); + emit_insn_orp(s, EJIT_OP_LDI16, r0, p); } void ejit_ldi_i32(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDI32, r0, p); + emit_insn_orp(s, EJIT_OP_LDI32, r0, p); } void ejit_ldi_i64(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDI64, r0, p); + emit_insn_orp(s, EJIT_OP_LDI64, r0, p); } void ejit_ldi_u8(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDIU8, r0, p); + emit_insn_orp(s, EJIT_OP_LDIU8, r0, p); } void ejit_ldi_u16(struct ejit_func *s, struct ejit_gpr r0, void *p) { - emit_insn_orp(s, LDIU16, r0, p); + emit_insn_orp(s, EJIT_OP_LDIU16, r0, p); } void ejit_ldi_u32(struct ejit_func *s, struct ejit_gpr r0, void *p) { s->use_64 = true; - emit_insn_orp(s, LDIU32, r0, p); + emit_insn_orp(s, EJIT_OP_LDIU32, r0, p); } void ejit_ldi_u64(struct ejit_func *s, struct ejit_gpr r0, void *p) { s->use_64 = true; - emit_insn_orp(s, LDIU64, r0, p); + emit_insn_orp(s, EJIT_OP_LDIU64, r0, p); } void ejit_ldi_f(struct ejit_func *s, struct ejit_fpr f0, void *p) { - emit_insn_ofp(s, LDIF, f0, p); + emit_insn_ofp(s, EJIT_OP_LDIF, f0, p); } void ejit_ldi_d(struct ejit_func *s, struct ejit_fpr f0, void *p) { - emit_insn_ofp(s, LDID, f0, p); + emit_insn_ofp(s, EJIT_OP_LDID, f0, p); } void ejit_ldxi_i8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXI8, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXI8, r0, r1, o); } void ejit_ldxi_i16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXI16, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXI16, r0, r1, o); } void ejit_ldxi_i32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXI32, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXI32, r0, r1, o); } void ejit_ldxi_i64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXI64, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXI64, r0, r1, o); } void ejit_ldxi_u8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXIU8, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXIU8, r0, r1, o); } void ejit_ldxi_u16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXIU16, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXIU16, r0, r1, o); } void ejit_ldxi_u32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXIU32, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXIU32, r0, r1, o); } void ejit_ldxi_u64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LDXIU64, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LDXIU64, r0, r1, o); } void ejit_ldxi_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, int64_t o) { - emit_insn_ofri(s, LDXIF, f0, r1, o); + emit_insn_ofri(s, EJIT_OP_LDXIF, f0, r1, o); } void ejit_ldxi_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, int64_t o) { - emit_insn_ofri(s, LDXID, f0, r1, o); + emit_insn_ofri(s, EJIT_OP_LDXID, f0, r1, o); } void ejit_ldxr_i8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXR8, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXR8, r0, r1, r2); } void ejit_ldxr_i16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXR16, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXR16, r0, r1, r2); } void ejit_ldxr_i32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXR32, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXR32, r0, r1, r2); } void ejit_ldxr_i64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXR64, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXR64, r0, r1, r2); } void ejit_ldxr_u8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXRU8, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXRU8, r0, r1, r2); } void ejit_ldxr_u16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXRU16, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXRU16, r0, r1, r2); } void ejit_ldxr_u32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXRU32, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXRU32, r0, r1, r2); } void ejit_ldxr_u64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LDXIU64, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LDXIU64, r0, r1, r2); } void ejit_ldxr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_ofrr(s, LDXRF, f0, r1, r2); + emit_insn_ofrr(s, EJIT_OP_LDXRF, f0, r1, r2); } void ejit_ldxr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_ofrr(s, LDXRD, f0, r1, r2); + emit_insn_ofrr(s, EJIT_OP_LDXRD, f0, r1, r2); } void ejit_ret(struct ejit_func *s) { - emit_insn_o(s, END); + emit_insn_o(s, EJIT_OP_END); } void ejit_retr(struct ejit_func *s, struct ejit_gpr r0) { - emit_insn_oxr(s, RETR, r0); + emit_insn_oxr(s, EJIT_OP_RETR, r0); } void ejit_retr_f(struct ejit_func *s, struct ejit_fpr f0) { - emit_insn_oxf(s, RETR_F, f0); + emit_insn_oxf(s, EJIT_OP_RETR_F, f0); } void ejit_retr_d(struct ejit_func *s, struct ejit_fpr f0) { - emit_insn_oxf(s, RETR_D, f0); + emit_insn_oxf(s, EJIT_OP_RETR_D, f0); } void ejit_reti(struct ejit_func *s, int64_t i) { - emit_insn_oi(s, RETI, i); + emit_insn_oi(s, EJIT_OP_RETI, i); } void ejit_reti_f(struct ejit_func *s, float f) { - emit_insn_oF(s, RETI_F, f); + emit_insn_oF(s, EJIT_OP_RETI_F, f); } void ejit_reti_d(struct ejit_func *s, double f) { - emit_insn_oD(s, RETI_D, f); + emit_insn_oD(s, EJIT_OP_RETI_D, f); } void ejit_extr_8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, EXTR8, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTR8, r0, r1); } void ejit_extr_16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, EXTR16, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTR16, r0, r1); } void ejit_extr_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { s->use_64 = true; - emit_insn_orr(s, EXTR32, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTR32, r0, r1); } void ejit_extr_u8(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, EXTRU8, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTRU8, r0, r1); } void ejit_extr_u16(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, EXTRU16, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTRU16, r0, r1); } void ejit_extr_u32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { s->use_64 = true; - emit_insn_orr(s, EXTRU32, r0, r1); + emit_insn_orr(s, EJIT_OP_EXTRU32, r0, r1); } void ejit_extr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1) { - emit_insn_ofr(s, EXTRF, f0, r1); + emit_insn_ofr(s, EJIT_OP_EXTRF, f0, r1); } void ejit_extr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_gpr r1) { - emit_insn_ofr(s, EXTRD, f0, r1); + emit_insn_ofr(s, EJIT_OP_EXTRD, f0, r1); } void ejit_addr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, ADDR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_ADDR, r0, r1, r2); } void ejit_addr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, ADDR_F, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_ADDR_F, f0, f1, f2); } void ejit_addr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, ADDR_D, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_ADDR_D, f0, f1, f2); } void ejit_addi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, ADDI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_ADDI, r0, r1, o); } void ejit_absr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { - emit_insn_off(s, ABSR_F, f0, f1); + emit_insn_off(s, EJIT_OP_ABSR_F, f0, f1); } void ejit_absr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { - emit_insn_off(s, ABSR_D, f0, f1); + emit_insn_off(s, EJIT_OP_ABSR_D, f0, f1); } void ejit_subr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, SUBR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_SUBR, r0, r1, r2); } void ejit_subr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, SUBR_F, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_SUBR_F, f0, f1, f2); } void ejit_subr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, SUBR_D, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_SUBR_D, f0, f1, f2); } void ejit_subi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, SUBI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_SUBI, r0, r1, o); } void ejit_mulr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, MULR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_MULR, r0, r1, r2); } void ejit_mulr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, MULR_F, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_MULR_F, f0, f1, f2); } void ejit_mulr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, MULR_D, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_MULR_D, f0, f1, f2); } void ejit_divr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, DIVR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_DIVR, r0, r1, r2); } void ejit_divr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, DIVR_U, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_DIVR_U, r0, r1, r2); } void ejit_divr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, DIVR_F, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_DIVR_F, f0, f1, f2); } void ejit_divr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_offf(s, DIVR_D, f0, f1, f2); + emit_insn_offf(s, EJIT_OP_DIVR_D, f0, f1, f2); } void ejit_remr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, REMR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_REMR, r0, r1, r2); } void ejit_remr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, REMR_U, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_REMR_U, r0, r1, r2); } void ejit_lshi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, LSHI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_LSHI, r0, r1, o); } void ejit_lshr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, LSHR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_LSHR, r0, r1, r2); } void ejit_rshi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, RSHI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_RSHI, r0, r1, o); } void ejit_rshi_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, RSHI_U, r0, r1, o); + emit_insn_orri(s, EJIT_OP_RSHI_U, r0, r1, o); } void ejit_rshr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, RSHR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_RSHR, r0, r1, r2); } void ejit_rshr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, RSHR_U, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_RSHR_U, r0, r1, r2); } void ejit_andr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, ANDR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_ANDR, r0, r1, r2); } void ejit_andi(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, ANDI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_ANDI, r0, r1, o); } void ejit_orr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, ORR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_ORR, r0, r1, r2); } void ejit_ori(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, ORI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_ORI, r0, r1, o); } void ejit_xorr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, XORR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_XORR, r0, r1, r2); } void ejit_xori(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, int64_t o) { - emit_insn_orri(s, XORI, r0, r1, o); + emit_insn_orri(s, EJIT_OP_XORI, r0, r1, o); } void ejit_comr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, COMR, r0, r1); + emit_insn_orr(s, EJIT_OP_COMR, r0, r1); } void ejit_negr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { - emit_insn_orr(s, NEGR, r0, r1); + emit_insn_orr(s, EJIT_OP_NEGR, r0, r1); } void ejit_negr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { - emit_insn_off(s, NEGR_F, f0, f1); + emit_insn_off(s, EJIT_OP_NEGR_F, f0, f1); } void ejit_negr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { - emit_insn_off(s, NEGR_D, f0, f1); + emit_insn_off(s, EJIT_OP_NEGR_D, f0, f1); } void ejit_movi(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { - emit_insn_ori(s, MOVI, r0, o); + emit_insn_ori(s, EJIT_OP_MOVI, r0, o); } void ejit_movi_f(struct ejit_func *s, struct ejit_fpr f0, float o) { - emit_insn_ofF(s, MOVI_F, f0, o); + emit_insn_ofF(s, EJIT_OP_MOVI_F, f0, o); } void ejit_movi_d(struct ejit_func *s, struct ejit_fpr f0, double o) { - emit_insn_ofD(s, MOVI_D, f0, o); + emit_insn_ofD(s, EJIT_OP_MOVI_D, f0, o); } void ejit_movr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) @@ -1194,7 +1194,7 @@ void ejit_movr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) if (r0.r == r1.r) return; - emit_insn_orr(s, MOVR, r0, r1); + emit_insn_orr(s, EJIT_OP_MOVR, r0, r1); } void ejit_movr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) @@ -1202,7 +1202,7 @@ void ejit_movr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) if (f0.f == f1.f) return; - emit_insn_off(s, MOVR_F, f0, f1); + emit_insn_off(s, EJIT_OP_MOVR_F, f0, f1); } void ejit_movr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) @@ -1210,179 +1210,179 @@ void ejit_movr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) if (f0.f == f1.f) return; - emit_insn_off(s, MOVR_D, f0, f1); + emit_insn_off(s, EJIT_OP_MOVR_D, f0, f1); } void ejit_eqr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, EQR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_EQR, r0, r1, r2); } void ejit_eqr_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, EQR_F, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_EQR_F, r0, f1, f2); } void ejit_eqr_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, EQR_D, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_EQR_D, r0, f1, f2); } void ejit_ner(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, NER, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_NER, r0, r1, r2); } void ejit_ner_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, NER_F, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_NER_F, r0, f1, f2); } void ejit_ner_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, NER_D, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_NER_D, r0, f1, f2); } void ejit_gtr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GTR, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_GTR, r0, r1, r2); } void ejit_gtr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GTR_U, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_GTR_U, r0, r1, r2); } void ejit_gtr_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GTR_F, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_GTR_F, r0, f1, f2); } void ejit_gtr_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GTR_D, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_GTR_D, r0, f1, f2); } void ejit_ltr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GTR, r0, r2, r1); + emit_insn_orrr(s, EJIT_OP_GTR, r0, r2, r1); } void ejit_ltr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GTR_U, r0, r2, r1); + emit_insn_orrr(s, EJIT_OP_GTR_U, r0, r2, r1); } void ejit_ltr_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GTR_F, r0, f2, f1); + emit_insn_orff(s, EJIT_OP_GTR_F, r0, f2, f1); } void ejit_ltr_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GTR_D, r0, f2, f1); + emit_insn_orff(s, EJIT_OP_GTR_D, r0, f2, f1); } void ejit_ger(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GER, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_GER, r0, r1, r2); } void ejit_ger_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GER_U, r0, r1, r2); + emit_insn_orrr(s, EJIT_OP_GER_U, r0, r1, r2); } void ejit_ger_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GER_F, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_GER_F, r0, f1, f2); } void ejit_ger_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GER_D, r0, f1, f2); + emit_insn_orff(s, EJIT_OP_GER_D, r0, f1, f2); } void ejit_ler(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GER, r0, r2, r1); + emit_insn_orrr(s, EJIT_OP_GER, r0, r2, r1); } void ejit_ler_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1, struct ejit_gpr r2) { - emit_insn_orrr(s, GER_U, r0, r2, r1); + emit_insn_orrr(s, EJIT_OP_GER_U, r0, r2, r1); } void ejit_ler_f(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GER_F, r0, f2, f1); + emit_insn_orff(s, EJIT_OP_GER_F, r0, f2, f1); } void ejit_ler_d(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1, struct ejit_fpr f2) { - emit_insn_orff(s, GER_D, r0, f2, f1); + emit_insn_orff(s, EJIT_OP_GER_D, r0, f2, f1); } void ejit_truncr_d_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1) { - emit_insn_orf(s, TRUNCR_D_32, r0, f1); + emit_insn_orf(s, EJIT_OP_TRUNCR_D_32, r0, f1); } void ejit_truncr_d_64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1) { s->use_64 = true; - emit_insn_orf(s, TRUNCR_D_64, r0, f1); + emit_insn_orf(s, EJIT_OP_TRUNCR_D_64, r0, f1); } void ejit_truncr_f_32(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1) { - emit_insn_orf(s, TRUNCR_F_32, r0, f1); + emit_insn_orf(s, EJIT_OP_TRUNCR_F_32, r0, f1); } void ejit_truncr_f_64(struct ejit_func *s, struct ejit_gpr r0, struct ejit_fpr f1) { s->use_64 = true; - emit_insn_orf(s, TRUNCR_F_64, r0, f1); + emit_insn_orf(s, EJIT_OP_TRUNCR_F_64, r0, f1); } struct ejit_reloc ejit_bner(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BNER, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BNER, r0, r1); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_bnei(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BNEI, r0, o); + emit_insn_oxri(s, EJIT_OP_BNEI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1390,7 +1390,7 @@ struct ejit_reloc ejit_bner_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BNER_F, f0, f1); + emit_insn_oxff(s, EJIT_OP_BNER_F, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1398,7 +1398,7 @@ struct ejit_reloc ejit_bner_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BNER_D, f0, f1); + emit_insn_oxff(s, EJIT_OP_BNER_D, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1406,14 +1406,14 @@ struct ejit_reloc ejit_beqr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BEQR, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BEQR, r0, r1); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_beqi(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BEQI, r0, o); + emit_insn_oxri(s, EJIT_OP_BEQI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1421,7 +1421,7 @@ struct ejit_reloc ejit_beqr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BEQR_F, f0, f1); + emit_insn_oxff(s, EJIT_OP_BEQR_F, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1429,7 +1429,7 @@ struct ejit_reloc ejit_beqr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BEQR_D, f0, f1); + emit_insn_oxff(s, EJIT_OP_BEQR_D, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1437,7 +1437,7 @@ struct ejit_reloc ejit_bger(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGER, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BGER, r0, r1); return (struct ejit_reloc){.insn = addr}; } @@ -1445,7 +1445,7 @@ struct ejit_reloc ejit_bger_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGER_U, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BGER_U, r0, r1); return (struct ejit_reloc){.insn = addr}; } @@ -1453,7 +1453,7 @@ struct ejit_reloc ejit_bger_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGER_F, f0, f1); + emit_insn_oxff(s, EJIT_OP_BGER_F, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1461,14 +1461,14 @@ struct ejit_reloc ejit_bger_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGER_D, f0, f1); + emit_insn_oxff(s, EJIT_OP_BGER_D, f0, f1); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_bgei(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BGEI, r0, o); + emit_insn_oxri(s, EJIT_OP_BGEI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1476,7 +1476,7 @@ struct ejit_reloc ejit_bgei_u(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BGEI_U, r0, o); + emit_insn_oxri(s, EJIT_OP_BGEI_U, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1484,7 +1484,7 @@ struct ejit_reloc ejit_bler(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGER, r1, r0); + emit_insn_oxrr(s, EJIT_OP_BGER, r1, r0); return (struct ejit_reloc){.insn = addr}; } @@ -1492,7 +1492,7 @@ struct ejit_reloc ejit_bler_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGER_U, r1, r0); + emit_insn_oxrr(s, EJIT_OP_BGER_U, r1, r0); return (struct ejit_reloc){.insn = addr}; } @@ -1500,7 +1500,7 @@ struct ejit_reloc ejit_bler_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGER_F, f1, f0); + emit_insn_oxff(s, EJIT_OP_BGER_F, f1, f0); return (struct ejit_reloc){.insn = addr}; } @@ -1508,14 +1508,14 @@ struct ejit_reloc ejit_bler_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGER_D, f1, f0); + emit_insn_oxff(s, EJIT_OP_BGER_D, f1, f0); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_blei(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BLEI, r0, o); + emit_insn_oxri(s, EJIT_OP_BLEI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1523,14 +1523,14 @@ struct ejit_reloc ejit_blei_u(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BLEI_U, r0, o); + emit_insn_oxri(s, EJIT_OP_BLEI_U, r0, o); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_bgti(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BGTI, r0, o); + emit_insn_oxri(s, EJIT_OP_BGTI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1538,7 +1538,7 @@ struct ejit_reloc ejit_bgti_u(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BGTI_U, r0, o); + emit_insn_oxri(s, EJIT_OP_BGTI_U, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1546,7 +1546,7 @@ struct ejit_reloc ejit_bgtr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGTR, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BGTR, r0, r1); return (struct ejit_reloc){.insn = addr}; } @@ -1554,7 +1554,7 @@ struct ejit_reloc ejit_bgtr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGTR_U, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BGTR_U, r0, r1); return (struct ejit_reloc){.insn = addr}; } @@ -1562,7 +1562,7 @@ struct ejit_reloc ejit_bgtr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGTR_F, f0, f1); + emit_insn_oxff(s, EJIT_OP_BGTR_F, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1570,7 +1570,7 @@ struct ejit_reloc ejit_bgtr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGTR_D, f0, f1); + emit_insn_oxff(s, EJIT_OP_BGTR_D, f0, f1); return (struct ejit_reloc){.insn = addr}; } @@ -1578,7 +1578,7 @@ struct ejit_reloc ejit_bltr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGTR, r1, r0); + emit_insn_oxrr(s, EJIT_OP_BGTR, r1, r0); return (struct ejit_reloc){.insn = addr}; } @@ -1586,7 +1586,7 @@ struct ejit_reloc ejit_bltr_u(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BGTR_U, r1, r0); + emit_insn_oxrr(s, EJIT_OP_BGTR_U, r1, r0); return (struct ejit_reloc){.insn = addr}; } @@ -1594,7 +1594,7 @@ struct ejit_reloc ejit_bltr_f(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGTR_F, f1, f0); + emit_insn_oxff(s, EJIT_OP_BGTR_F, f1, f0); return (struct ejit_reloc){.insn = addr}; } @@ -1602,14 +1602,14 @@ struct ejit_reloc ejit_bltr_d(struct ejit_func *s, struct ejit_fpr f0, struct ejit_fpr f1) { size_t addr = insns_len(&s->insns); - emit_insn_oxff(s, BGTR_D, f1, f0); + emit_insn_oxff(s, EJIT_OP_BGTR_D, f1, f0); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_blti(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BLTI, r0, o); + emit_insn_oxri(s, EJIT_OP_BLTI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1617,28 +1617,28 @@ struct ejit_reloc ejit_blti_u(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BLTI_U, r0, o); + emit_insn_oxri(s, EJIT_OP_BLTI_U, r0, o); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_jmp(struct ejit_func *s) { size_t addr = insns_len(&s->insns); - emit_insn_o(s, JMP); + emit_insn_o(s, EJIT_OP_JMP); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_jmpr(struct ejit_func *s, struct ejit_gpr r0) { size_t addr = insns_len(&s->insns); - emit_insn_oxr(s, JMPR, r0); + emit_insn_oxr(s, EJIT_OP_JMPR, r0); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_bmci(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BMCI, r0, o); + emit_insn_oxri(s, EJIT_OP_BMCI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1646,14 +1646,14 @@ struct ejit_reloc ejit_bmcr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BMCR, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BMCR, r0, r1); return (struct ejit_reloc){.insn = addr}; } struct ejit_reloc ejit_bmsi(struct ejit_func *s, struct ejit_gpr r0, int64_t o) { size_t addr = insns_len(&s->insns); - emit_insn_oxri(s, BMSI, r0, o); + emit_insn_oxri(s, EJIT_OP_BMSI, r0, o); return (struct ejit_reloc){.insn = addr}; } @@ -1661,7 +1661,7 @@ struct ejit_reloc ejit_bmsr(struct ejit_func *s, struct ejit_gpr r0, struct ejit_gpr r1) { size_t addr = insns_len(&s->insns); - emit_insn_oxrr(s, BMSR, r0, r1); + emit_insn_oxrr(s, EJIT_OP_BMSR, r0, r1); return (struct ejit_reloc){.insn = addr}; } diff --git a/src/interp.c b/src/interp.c index aa40c53..b858f26 100644 --- a/src/interp.c +++ b/src/interp.c @@ -7,214 +7,214 @@ * be returned. Included from src/interp.c */ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg params[paramc], bool run, void ***labels_wb) { - static void *labels[OPCODE_COUNT] = { - [MOVI] = &&MOVI, - [MOVI_F] = &&MOVI_F, - [MOVI_D] = &&MOVI_D, - [MOVR] = &&MOVR, - [MOVR_F] = &&MOVR_F, - [MOVR_D] = &&MOVR_D, - - [EXTR8] = &&EXTR8, - [EXTR16] = &&EXTR16, - [EXTR32] = &&EXTR32, - [EXTRU8] = &&EXTRU8, - [EXTRU16] = &&EXTRU16, - [EXTRU32] = &&EXTRU32, - [EXTRF] = &&EXTRF, - [EXTRD] = &&EXTRD, - - [ADDR] = &&ADDR, - [ADDR_F] = &&ADDR_F, - [ADDR_D] = &&ADDR_D, - [ADDI] = &&ADDI, - - [ABSR_F] = &&ABSR_F, - [ABSR_D] = &&ABSR_D, - - [SUBR] = &&SUBR, - [SUBR_F] = &&SUBR_F, - [SUBR_D] = &&SUBR_D, - [SUBI] = &&SUBI, - - [MULR] = &&MULR, - [MULR_F] = &&MULR_F, - [MULR_D] = &&MULR_D, - - [DIVR] = &&DIVR, - [DIVR_U] = &&DIVR_U, - [DIVR_F] = &&DIVR_F, - [DIVR_D] = &&DIVR_D, - - [REMR] = &&REMR, - [REMR_U] = &&REMR_U, - - [LSHI] = &&LSHI, - [LSHR] = &&LSHR, - [RSHI] = &&RSHI, - [RSHR] = &&RSHR, - [RSHI_U] = &&RSHI_U, - [RSHR_U] = &&RSHR_U, - - [ANDR] = &&ANDR, - [ANDI] = &&ANDI, - - [ORR] = &&ORR, - [ORI] = &&ORI, - - [XORR] = &&XORR, - [XORI] = &&XORI, - - [COMR] = &&COMR, - [NEGR] = &&NEGR, - [NEGR_F] = &&NEGR_F, - [NEGR_D] = &&NEGR_D, - - [EQR] = &&EQR, - [EQR_F] = &&EQR_F, - [EQR_D] = &&EQR_D, - - [NER] = &&NER, - [NER_F] = &&NER_F, - [NER_D] = &&NER_D, - - [GTR] = &>R, - [GTR_U] = &>R_U, - [GTR_F] = &>R_F, - [GTR_D] = &>R_D, - - [GER] = &&GER, - [GER_U] = &&GER_U, - [GER_F] = &&GER_F, - [GER_D] = &&GER_D, - - [STI8] = &&STI8, - [STI16] = &&STI16, - [STI32] = &&STI32, - [STI64] = &&STI64, - [STIF] = &&STIF, - [STID] = &&STID, - - [STXI8] = &&STXI8, - [STXI16] = &&STXI16, - [STXI32] = &&STXI32, - [STXI64] = &&STXI64, - [STXIF] = &&STXIF, - [STXID] = &&STXID, - - [STXR8] = &&STXR8, - [STXR16] = &&STXR16, - [STXR32] = &&STXR32, - [STXR64] = &&STXR64, - [STXRF] = &&STXRF, - [STXRD] = &&STXRD, - - [LDI8] = &&LDI8, - [LDI16] = &&LDI16, - [LDI32] = &&LDI32, - [LDI64] = &&LDI64, - [LDIU8] = &&LDIU8, - [LDIU16] = &&LDIU16, - [LDIU32] = &&LDIU32, - [LDIU64] = &&LDIU64, - [LDIF] = &&LDIF, - [LDID] = &&LDID, - - [LDXI8] = &&LDXI8, - [LDXI16] = &&LDXI16, - [LDXI32] = &&LDXI32, - [LDXI64] = &&LDXI64, - [LDXIU8] = &&LDXIU8, - [LDXIU16] = &&LDXIU16, - [LDXIU32] = &&LDXIU32, - [LDXIU64] = &&LDXIU64, - [LDXIF] = &&LDXIF, - [LDXID] = &&LDXID, - - [LDXR8] = &&LDXR8, - [LDXR16] = &&LDXR16, - [LDXR32] = &&LDXR32, - [LDXR64] = &&LDXR64, - [LDXRU8] = &&LDXRU8, - [LDXRU16] = &&LDXRU16, - [LDXRU32] = &&LDXRU32, - [LDXRU64] = &&LDXRU64, - [LDXRF] = &&LDXRF, - [LDXRD] = &&LDXRD, - - [TRUNCR_D_32] = &&TRUNCR_D_32, - [TRUNCR_D_64] = &&TRUNCR_D_64, - [TRUNCR_F_32] = &&TRUNCR_F_32, - [TRUNCR_F_64] = &&TRUNCR_F_64, - - [BNER] = &&BNER, - [BNEI] = &&BNEI, - [BNER_F] = &&BNER_F, - [BNER_D] = &&BNER_D, - - [BEQR] = &&BEQR, - [BEQI] = &&BEQI, - [BEQR_F] = &&BEQR_F, - [BEQR_D] = &&BEQR_D, - - [BGER] = &&BGER, - [BGER_U] = &&BGER_U, - [BGEI] = &&BGEI, - [BGEI_U] = &&BGEI_U, - [BGER_F] = &&BGER_F, - [BGER_D] = &&BGER_D, - - [BLEI] = &&BLEI, - [BLEI_U] = &&BLEI_U, - - [BGTR] = &&BGTR, - [BGTR_U] = &&BGTR_U, - [BGTI] = &&BGTI, - [BGTI_U] = &&BGTI_U, - [BGTR_F] = &&BGTR_F, - [BGTR_D] = &&BGTR_D, - - [BLTI] = &&BLTI, - [BLTI_U] = &&BLTI_U, - - [JMP] = &&JMP, - [JMPR] = &&JMPR, - - [BMCI] = &&BMCI, - [BMCR] = &&BMCR, - [BMSI] = &&BMSI, - [BMSR] = &&BMSR, - - [RETR] = &&RETR, - [RETI] = &&RETI, - [RETR_F] = &&RETR_F, - [RETI_F] = &&RETI_F, - [RETR_D] = &&RETR_D, - [RETI_D] = &&RETI_D, - - [RETVAL] = &&RETVAL, - [RETVAL_F] = &&RETVAL_F, - [RETVAL_D] = &&RETVAL_D, - - [ARG] = &&ARG, - [ARG_I] = &&ARG_I, - [ARG_F] = &&ARG_F, - [ARG_FI] = &&ARG_FI, - - [PARAM] = &&PARAM, - [PARAM_F] = &&PARAM_F, - - [CALLI_I] = &&CALLI_I, - [CALLI_L] = &&CALLI_L, - [CALLI_F] = &&CALLI_F, - [CALLI_D] = &&CALLI_D, - [ESCAPEI_I] = &&ESCAPEI_I, - [ESCAPEI_F] = &&ESCAPEI_F, - [ESCAPEI_L] = &&ESCAPEI_L, - [ESCAPEI_D] = &&ESCAPEI_D, - - [START] = &&START, - [END] = &&END, + static void *labels[EJIT_OPCODE_COUNT] = { + [EJIT_OP_MOVI] = &&MOVI, + [EJIT_OP_MOVI_F] = &&MOVI_F, + [EJIT_OP_MOVI_D] = &&MOVI_D, + [EJIT_OP_MOVR] = &&MOVR, + [EJIT_OP_MOVR_F] = &&MOVR_F, + [EJIT_OP_MOVR_D] = &&MOVR_D, + + [EJIT_OP_EXTR8] = &&EXTR8, + [EJIT_OP_EXTR16] = &&EXTR16, + [EJIT_OP_EXTR32] = &&EXTR32, + [EJIT_OP_EXTRU8] = &&EXTRU8, + [EJIT_OP_EXTRU16] = &&EXTRU16, + [EJIT_OP_EXTRU32] = &&EXTRU32, + [EJIT_OP_EXTRF] = &&EXTRF, + [EJIT_OP_EXTRD] = &&EXTRD, + + [EJIT_OP_ADDR] = &&ADDR, + [EJIT_OP_ADDR_F] = &&ADDR_F, + [EJIT_OP_ADDR_D] = &&ADDR_D, + [EJIT_OP_ADDI] = &&ADDI, + + [EJIT_OP_ABSR_F] = &&ABSR_F, + [EJIT_OP_ABSR_D] = &&ABSR_D, + + [EJIT_OP_SUBR] = &&SUBR, + [EJIT_OP_SUBR_F] = &&SUBR_F, + [EJIT_OP_SUBR_D] = &&SUBR_D, + [EJIT_OP_SUBI] = &&SUBI, + + [EJIT_OP_MULR] = &&MULR, + [EJIT_OP_MULR_F] = &&MULR_F, + [EJIT_OP_MULR_D] = &&MULR_D, + + [EJIT_OP_DIVR] = &&DIVR, + [EJIT_OP_DIVR_U] = &&DIVR_U, + [EJIT_OP_DIVR_F] = &&DIVR_F, + [EJIT_OP_DIVR_D] = &&DIVR_D, + + [EJIT_OP_REMR] = &&REMR, + [EJIT_OP_REMR_U] = &&REMR_U, + + [EJIT_OP_LSHI] = &&LSHI, + [EJIT_OP_LSHR] = &&LSHR, + [EJIT_OP_RSHI] = &&RSHI, + [EJIT_OP_RSHR] = &&RSHR, + [EJIT_OP_RSHI_U] = &&RSHI_U, + [EJIT_OP_RSHR_U] = &&RSHR_U, + + [EJIT_OP_ANDR] = &&ANDR, + [EJIT_OP_ANDI] = &&ANDI, + + [EJIT_OP_ORR] = &&ORR, + [EJIT_OP_ORI] = &&ORI, + + [EJIT_OP_XORR] = &&XORR, + [EJIT_OP_XORI] = &&XORI, + + [EJIT_OP_COMR] = &&COMR, + [EJIT_OP_NEGR] = &&NEGR, + [EJIT_OP_NEGR_F] = &&NEGR_F, + [EJIT_OP_NEGR_D] = &&NEGR_D, + + [EJIT_OP_EQR] = &&EQR, + [EJIT_OP_EQR_F] = &&EQR_F, + [EJIT_OP_EQR_D] = &&EQR_D, + + [EJIT_OP_NER] = &&NER, + [EJIT_OP_NER_F] = &&NER_F, + [EJIT_OP_NER_D] = &&NER_D, + + [EJIT_OP_GTR] = &>R, + [EJIT_OP_GTR_U] = &>R_U, + [EJIT_OP_GTR_F] = &>R_F, + [EJIT_OP_GTR_D] = &>R_D, + + [EJIT_OP_GER] = &&GER, + [EJIT_OP_GER_U] = &&GER_U, + [EJIT_OP_GER_F] = &&GER_F, + [EJIT_OP_GER_D] = &&GER_D, + + [EJIT_OP_STI8] = &&STI8, + [EJIT_OP_STI16] = &&STI16, + [EJIT_OP_STI32] = &&STI32, + [EJIT_OP_STI64] = &&STI64, + [EJIT_OP_STIF] = &&STIF, + [EJIT_OP_STID] = &&STID, + + [EJIT_OP_STXI8] = &&STXI8, + [EJIT_OP_STXI16] = &&STXI16, + [EJIT_OP_STXI32] = &&STXI32, + [EJIT_OP_STXI64] = &&STXI64, + [EJIT_OP_STXIF] = &&STXIF, + [EJIT_OP_STXID] = &&STXID, + + [EJIT_OP_STXR8] = &&STXR8, + [EJIT_OP_STXR16] = &&STXR16, + [EJIT_OP_STXR32] = &&STXR32, + [EJIT_OP_STXR64] = &&STXR64, + [EJIT_OP_STXRF] = &&STXRF, + [EJIT_OP_STXRD] = &&STXRD, + + [EJIT_OP_LDI8] = &&LDI8, + [EJIT_OP_LDI16] = &&LDI16, + [EJIT_OP_LDI32] = &&LDI32, + [EJIT_OP_LDI64] = &&LDI64, + [EJIT_OP_LDIU8] = &&LDIU8, + [EJIT_OP_LDIU16] = &&LDIU16, + [EJIT_OP_LDIU32] = &&LDIU32, + [EJIT_OP_LDIU64] = &&LDIU64, + [EJIT_OP_LDIF] = &&LDIF, + [EJIT_OP_LDID] = &&LDID, + + [EJIT_OP_LDXI8] = &&LDXI8, + [EJIT_OP_LDXI16] = &&LDXI16, + [EJIT_OP_LDXI32] = &&LDXI32, + [EJIT_OP_LDXI64] = &&LDXI64, + [EJIT_OP_LDXIU8] = &&LDXIU8, + [EJIT_OP_LDXIU16] = &&LDXIU16, + [EJIT_OP_LDXIU32] = &&LDXIU32, + [EJIT_OP_LDXIU64] = &&LDXIU64, + [EJIT_OP_LDXIF] = &&LDXIF, + [EJIT_OP_LDXID] = &&LDXID, + + [EJIT_OP_LDXR8] = &&LDXR8, + [EJIT_OP_LDXR16] = &&LDXR16, + [EJIT_OP_LDXR32] = &&LDXR32, + [EJIT_OP_LDXR64] = &&LDXR64, + [EJIT_OP_LDXRU8] = &&LDXRU8, + [EJIT_OP_LDXRU16] = &&LDXRU16, + [EJIT_OP_LDXRU32] = &&LDXRU32, + [EJIT_OP_LDXRU64] = &&LDXRU64, + [EJIT_OP_LDXRF] = &&LDXRF, + [EJIT_OP_LDXRD] = &&LDXRD, + + [EJIT_OP_TRUNCR_D_32] = &&TRUNCR_D_32, + [EJIT_OP_TRUNCR_D_64] = &&TRUNCR_D_64, + [EJIT_OP_TRUNCR_F_32] = &&TRUNCR_F_32, + [EJIT_OP_TRUNCR_F_64] = &&TRUNCR_F_64, + + [EJIT_OP_BNER] = &&BNER, + [EJIT_OP_BNEI] = &&BNEI, + [EJIT_OP_BNER_F] = &&BNER_F, + [EJIT_OP_BNER_D] = &&BNER_D, + + [EJIT_OP_BEQR] = &&BEQR, + [EJIT_OP_BEQI] = &&BEQI, + [EJIT_OP_BEQR_F] = &&BEQR_F, + [EJIT_OP_BEQR_D] = &&BEQR_D, + + [EJIT_OP_BGER] = &&BGER, + [EJIT_OP_BGER_U] = &&BGER_U, + [EJIT_OP_BGEI] = &&BGEI, + [EJIT_OP_BGEI_U] = &&BGEI_U, + [EJIT_OP_BGER_F] = &&BGER_F, + [EJIT_OP_BGER_D] = &&BGER_D, + + [EJIT_OP_BLEI] = &&BLEI, + [EJIT_OP_BLEI_U] = &&BLEI_U, + + [EJIT_OP_BGTR] = &&BGTR, + [EJIT_OP_BGTR_U] = &&BGTR_U, + [EJIT_OP_BGTI] = &&BGTI, + [EJIT_OP_BGTI_U] = &&BGTI_U, + [EJIT_OP_BGTR_F] = &&BGTR_F, + [EJIT_OP_BGTR_D] = &&BGTR_D, + + [EJIT_OP_BLTI] = &&BLTI, + [EJIT_OP_BLTI_U] = &&BLTI_U, + + [EJIT_OP_JMP] = &&JMP, + [EJIT_OP_JMPR] = &&JMPR, + + [EJIT_OP_BMCI] = &&BMCI, + [EJIT_OP_BMCR] = &&BMCR, + [EJIT_OP_BMSI] = &&BMSI, + [EJIT_OP_BMSR] = &&BMSR, + + [EJIT_OP_RETR] = &&RETR, + [EJIT_OP_RETI] = &&RETI, + [EJIT_OP_RETR_F] = &&RETR_F, + [EJIT_OP_RETI_F] = &&RETI_F, + [EJIT_OP_RETR_D] = &&RETR_D, + [EJIT_OP_RETI_D] = &&RETI_D, + + [EJIT_OP_RETVAL] = &&RETVAL, + [EJIT_OP_RETVAL_F] = &&RETVAL_F, + [EJIT_OP_RETVAL_D] = &&RETVAL_D, + + [EJIT_OP_ARG] = &&ARG, + [EJIT_OP_ARG_I] = &&ARG_I, + [EJIT_OP_ARG_F] = &&ARG_F, + [EJIT_OP_ARG_FI] = &&ARG_FI, + + [EJIT_OP_PARAM] = &&PARAM, + [EJIT_OP_PARAM_F] = &&PARAM_F, + + [EJIT_OP_CALLI_I] = &&CALLI_I, + [EJIT_OP_CALLI_L] = &&CALLI_L, + [EJIT_OP_CALLI_F] = &&CALLI_F, + [EJIT_OP_CALLI_D] = &&CALLI_D, + [EJIT_OP_ESCAPEI_I] = &&ESCAPEI_I, + [EJIT_OP_ESCAPEI_F] = &&ESCAPEI_F, + [EJIT_OP_ESCAPEI_L] = &&ESCAPEI_L, + [EJIT_OP_ESCAPEI_D] = &&ESCAPEI_D, + + [EJIT_OP_START] = &&START, + [EJIT_OP_END] = &&END, }; if (!run) { |