aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ir.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_ir.h')
-rw-r--r--src/lj_ir.h85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 5659ba73..1bc6c332 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -234,91 +234,6 @@ IRFLDEF(FLENUM)
234#define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */ 234#define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */
235#define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */ 235#define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */
236 236
237/* C call info for CALL* instructions. */
238typedef struct CCallInfo {
239 ASMFunction func; /* Function pointer. */
240 uint32_t flags; /* Number of arguments and flags. */
241} CCallInfo;
242
243#define CCI_NARGS(ci) ((ci)->flags & 0xff) /* Extract # of args. */
244#define CCI_NARGS_MAX 32 /* Max. # of args. */
245
246#define CCI_OTSHIFT 16
247#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */
248#define CCI_OPSHIFT 24
249#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */
250
251#define CCI_CALL_N (IR_CALLN << CCI_OPSHIFT)
252#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT)
253#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT)
254#define CCI_CALL_FN (CCI_CALL_N|CCI_FASTCALL)
255#define CCI_CALL_FL (CCI_CALL_L|CCI_FASTCALL)
256#define CCI_CALL_FS (CCI_CALL_S|CCI_FASTCALL)
257
258/* C call info flags. */
259#define CCI_L 0x0100 /* Implicit L arg. */
260#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
261#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
262#define CCI_FASTCALL 0x0800 /* Fastcall convention. */
263
264/* Function definitions for CALL* instructions. */
265#if LJ_HASFFI
266#if LJ_32
267#define ARG2_64 4 /* Treat as 4 32 bit arguments. */
268#define IRCALLDEF_FFI32(_) \
269 _(lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
270#else
271#define ARG2_64 2
272#define IRCALLDEF_FFI32(_)
273#endif
274#define IRCALLDEF_FFI(_) \
275 IRCALLDEF_FFI32(_) \
276 _(lj_carith_divi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
277 _(lj_carith_divu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
278 _(lj_carith_modi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
279 _(lj_carith_modu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
280 _(lj_carith_powi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
281 _(lj_carith_powu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
282 _(lj_cdata_setfin, 2, FN, P32, CCI_L) \
283 _(strlen, 1, N, INTP, 0) \
284 _(memcpy, 3, S, PTR, 0) \
285 _(memset, 3, S, PTR, 0)
286#else
287#define IRCALLDEF_FFI(_)
288#endif
289#define IRCALLDEF(_) \
290 _(lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
291 _(lj_str_new, 3, S, STR, CCI_L) \
292 _(lj_str_tonum, 2, FN, INT, 0) \
293 _(lj_str_fromint, 2, FN, STR, CCI_L) \
294 _(lj_str_fromnum, 2, FN, STR, CCI_L) \
295 _(lj_tab_new1, 2, FS, TAB, CCI_L) \
296 _(lj_tab_dup, 2, FS, TAB, CCI_L) \
297 _(lj_tab_newkey, 3, S, P32, CCI_L) \
298 _(lj_tab_len, 1, FL, INT, 0) \
299 _(lj_gc_step_jit, 2, FS, NIL, CCI_L) \
300 _(lj_gc_barrieruv, 2, FS, NIL, 0) \
301 _(lj_mem_newgco, 2, FS, P32, CCI_L) \
302 _(lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \
303 IRCALLDEF_FFI(_) \
304 _(sinh, 1, N, NUM, 0) \
305 _(cosh, 1, N, NUM, 0) \
306 _(tanh, 1, N, NUM, 0) \
307 _(fputc, 2, S, INT, 0) \
308 _(fwrite, 4, S, INT, 0) \
309 _(fflush, 1, S, INT, 0) \
310 \
311 /* End of list. */
312
313typedef enum {
314#define IRCALLENUM(name, nargs, kind, type, flags) IRCALL_##name,
315IRCALLDEF(IRCALLENUM)
316#undef IRCALLENUM
317 IRCALL__MAX
318} IRCallID;
319
320LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
321
322/* -- IR operands --------------------------------------------------------- */ 237/* -- IR operands --------------------------------------------------------- */
323 238
324/* IR operand mode (2 bit). */ 239/* IR operand mode (2 bit). */