buildvm.o: buildvm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
- lj_obj.h lj_gc.h lj_bc.h lj_ir.h lj_frame.h lj_dispatch.h lj_jit.h \
- lj_ccall.h luajit.h \
+ lj_obj.h lj_gc.h lj_bc.h lj_ir.h lj_ircall.h lj_jit.h lj_frame.h \
+ lj_dispatch.h lj_ccall.h luajit.h \
lj_traceerr.h
buildvm_asm.o: buildvm_asm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
lj_bc.h
lj_libdef.h
lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \
lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ir.h \
- lj_jit.h lj_iropt.h lj_target.h lj_target_*.h lj_dispatch.h lj_vm.h \
- lj_vmevent.h lj_lib.h luajit.h lj_libdef.h
+ lj_jit.h lj_ircall.h lj_iropt.h lj_target.h lj_target_*.h \
+ lj_dispatch.h lj_vm.h lj_vmevent.h lj_lib.h luajit.h lj_libdef.h
lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_lib.h lj_libdef.h
lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
lj_traceerr.h lj_vm.h lj_lex.h lj_parse.h
lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h \
- lj_iropt.h lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_snap.h \
- lj_asm.h lj_vm.h lj_target.h lj_target_*.h lj_emit_*.h lj_asm_*.h
+ lj_ircall.h lj_iropt.h lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h \
+ lj_snap.h lj_asm.h lj_vm.h lj_target.h lj_target_*.h lj_emit_*.h \
+ lj_asm_*.h
lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \
lj_bcdef.h
lj_carith.o: lj_carith.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_bc.h lj_vm.h lj_char.h
lj_crecord.o: lj_crecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h \
- lj_gc.h lj_cparse.h lj_cconv.h lj_clib.h lj_ir.h lj_jit.h lj_iropt.h \
- lj_trace.h lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h \
- lj_crecord.h
+ lj_gc.h lj_cparse.h lj_cconv.h lj_clib.h lj_ir.h lj_jit.h lj_ircall.h \
+ lj_iropt.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_record.h \
+ lj_ffrecord.h lj_crecord.h
lj_ctype.o: lj_ctype.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h
lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_traceerr.h lj_vm.h
lj_ffrecord.o: lj_ffrecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ff.h \
- lj_ffdef.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \
- lj_traceerr.h lj_record.h lj_ffrecord.h lj_crecord.h lj_vm.h lj_recdef.h
+ lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
+ lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_crecord.h \
+ lj_vm.h lj_recdef.h
lj_func.o: lj_func.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_func.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h lj_bc.h \
lj_traceerr.h lj_vm.h
lj_gc.h lj_err.h lj_errmsg.h lj_frame.h lj_bc.h lj_jit.h lj_ir.h \
lj_dispatch.h
lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
- lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \
- lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_carith.h lj_lib.h
+ lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
+ lj_dispatch.h lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_carith.h \
+ lj_lib.h
lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \
lj_state.h lj_lex.h lj_parse.h lj_char.h
lj_arch.h lj_str.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \
lj_dispatch.h lj_traceerr.h lj_vm.h
lj_opt_split.o: lj_opt_split.c lj_obj.h lua.h luaconf.h lj_def.h \
- lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_ir.h lj_jit.h lj_iropt.h \
- lj_vm.h
+ lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_ir.h lj_jit.h lj_ircall.h \
+ lj_iropt.h lj_vm.h
lj_parse.o: lj_parse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_state.h \
lj_bc.h lj_ctype.h lj_lex.h lj_parse.h lj_vm.h lj_vmevent.h
lj_record.o: lj_record.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \
- lj_ff.h lj_ffdef.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \
- lj_traceerr.h lj_record.h lj_ffrecord.h lj_snap.h lj_vm.h
+ lj_ff.h lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
+ lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_snap.h lj_vm.h
lj_snap.o: lj_snap.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_state.h lj_frame.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \
lj_dispatch.h lj_traceerr.h lj_snap.h lj_target.h lj_target_*.h
lj_alloc.h lj_dispatch.c luajit.h lj_vmevent.c lj_vmevent.h lj_api.c \
lj_parse.h lj_lex.c lualib.h lj_parse.c lj_ctype.c lj_cdata.c lj_cconv.h \
lj_cconv.c lj_ccall.c lj_ccall.h lj_carith.c lj_carith.h lj_clib.c \
- lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_lib.h lj_ir.c lj_iropt.h \
- lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c lj_opt_dce.c \
- lj_opt_loop.c lj_snap.h lj_opt_split.c lj_mcode.c lj_mcode.h lj_snap.c \
- lj_target.h lj_target_*.h lj_record.c lj_record.h lj_ffrecord.h \
- lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h \
- lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c \
- lib_aux.c lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c \
- lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \
- lib_ffi.c lib_init.c
+ lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_lib.h lj_ir.c lj_ircall.h \
+ lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c \
+ lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c lj_mcode.c \
+ lj_mcode.h lj_snap.c lj_target.h lj_target_*.h lj_record.c lj_record.h \
+ lj_ffrecord.h lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h \
+ lj_asm.c lj_asm.h lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h \
+ lj_gdbjit.c lj_alloc.c lib_aux.c lib_base.c lj_libdef.h lib_math.c \
+ lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c \
+ lib_bit.c lib_jit.c lib_ffi.c lib_init.c
luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h
#include "lj_gc.h"
#include "lj_bc.h"
#include "lj_ir.h"
+#include "lj_ircall.h"
#include "lj_frame.h"
#include "lj_dispatch.h"
#if LJ_HASFFI
#if LJ_HASJIT
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_target.h"
#endif
#endif
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_mcode.h"
#include "lj_iropt.h"
#include "lj_clib.h"
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_trace.h"
#include "lj_record.h"
#include "lj_ff.h"
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_trace.h"
#include "lj_record.h"
#include "lj_tab.h"
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_trace.h"
#if LJ_HASFFI
#define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */
#define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */
-/* C call info for CALL* instructions. */
-typedef struct CCallInfo {
- ASMFunction func; /* Function pointer. */
- uint32_t flags; /* Number of arguments and flags. */
-} CCallInfo;
-
-#define CCI_NARGS(ci) ((ci)->flags & 0xff) /* Extract # of args. */
-#define CCI_NARGS_MAX 32 /* Max. # of args. */
-
-#define CCI_OTSHIFT 16
-#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */
-#define CCI_OPSHIFT 24
-#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */
-
-#define CCI_CALL_N (IR_CALLN << CCI_OPSHIFT)
-#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT)
-#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT)
-#define CCI_CALL_FN (CCI_CALL_N|CCI_FASTCALL)
-#define CCI_CALL_FL (CCI_CALL_L|CCI_FASTCALL)
-#define CCI_CALL_FS (CCI_CALL_S|CCI_FASTCALL)
-
-/* C call info flags. */
-#define CCI_L 0x0100 /* Implicit L arg. */
-#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
-#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
-#define CCI_FASTCALL 0x0800 /* Fastcall convention. */
-
-/* Function definitions for CALL* instructions. */
-#if LJ_HASFFI
-#if LJ_32
-#define ARG2_64 4 /* Treat as 4 32 bit arguments. */
-#define IRCALLDEF_FFI32(_) \
- _(lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
-#else
-#define ARG2_64 2
-#define IRCALLDEF_FFI32(_)
-#endif
-#define IRCALLDEF_FFI(_) \
- IRCALLDEF_FFI32(_) \
- _(lj_carith_divi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
- _(lj_carith_divu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
- _(lj_carith_modi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
- _(lj_carith_modu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
- _(lj_carith_powi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
- _(lj_carith_powu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
- _(lj_cdata_setfin, 2, FN, P32, CCI_L) \
- _(strlen, 1, N, INTP, 0) \
- _(memcpy, 3, S, PTR, 0) \
- _(memset, 3, S, PTR, 0)
-#else
-#define IRCALLDEF_FFI(_)
-#endif
-#define IRCALLDEF(_) \
- _(lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
- _(lj_str_new, 3, S, STR, CCI_L) \
- _(lj_str_tonum, 2, FN, INT, 0) \
- _(lj_str_fromint, 2, FN, STR, CCI_L) \
- _(lj_str_fromnum, 2, FN, STR, CCI_L) \
- _(lj_tab_new1, 2, FS, TAB, CCI_L) \
- _(lj_tab_dup, 2, FS, TAB, CCI_L) \
- _(lj_tab_newkey, 3, S, P32, CCI_L) \
- _(lj_tab_len, 1, FL, INT, 0) \
- _(lj_gc_step_jit, 2, FS, NIL, CCI_L) \
- _(lj_gc_barrieruv, 2, FS, NIL, 0) \
- _(lj_mem_newgco, 2, FS, P32, CCI_L) \
- _(lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \
- IRCALLDEF_FFI(_) \
- _(sinh, 1, N, NUM, 0) \
- _(cosh, 1, N, NUM, 0) \
- _(tanh, 1, N, NUM, 0) \
- _(fputc, 2, S, INT, 0) \
- _(fwrite, 4, S, INT, 0) \
- _(fflush, 1, S, INT, 0) \
- \
- /* End of list. */
-
-typedef enum {
-#define IRCALLENUM(name, nargs, kind, type, flags) IRCALL_##name,
-IRCALLDEF(IRCALLENUM)
-#undef IRCALLENUM
- IRCALL__MAX
-} IRCallID;
-
-LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
-
/* -- IR operands --------------------------------------------------------- */
/* IR operand mode (2 bit). */
--- /dev/null
+/*
+** IR CALL* instruction definitions.
+** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
+*/
+
+#ifndef _LJ_IRCALL_H
+#define _LJ_IRCALL_H
+
+#include "lj_obj.h"
+#include "lj_ir.h"
+#include "lj_jit.h"
+
+/* C call info for CALL* instructions. */
+typedef struct CCallInfo {
+ ASMFunction func; /* Function pointer. */
+ uint32_t flags; /* Number of arguments and flags. */
+} CCallInfo;
+
+#define CCI_NARGS(ci) ((ci)->flags & 0xff) /* Extract # of args. */
+#define CCI_NARGS_MAX 32 /* Max. # of args. */
+
+#define CCI_OTSHIFT 16
+#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */
+#define CCI_OPSHIFT 24
+#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */
+
+#define CCI_CALL_N (IR_CALLN << CCI_OPSHIFT)
+#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT)
+#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT)
+#define CCI_CALL_FN (CCI_CALL_N|CCI_FASTCALL)
+#define CCI_CALL_FL (CCI_CALL_L|CCI_FASTCALL)
+#define CCI_CALL_FS (CCI_CALL_S|CCI_FASTCALL)
+
+/* C call info flags. */
+#define CCI_L 0x0100 /* Implicit L arg. */
+#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
+#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
+#define CCI_FASTCALL 0x0800 /* Fastcall convention. */
+
+/* Function definitions for CALL* instructions. */
+#if LJ_HASFFI
+#if LJ_32
+#define ARG2_64 4 /* Treat as 4 32 bit arguments. */
+#define IRCALLDEF_FFI32(_) \
+ _(lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
+#else
+#define ARG2_64 2
+#define IRCALLDEF_FFI32(_)
+#endif
+#define IRCALLDEF_FFI(_) \
+ IRCALLDEF_FFI32(_) \
+ _(lj_carith_divi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
+ _(lj_carith_divu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
+ _(lj_carith_modi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
+ _(lj_carith_modu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
+ _(lj_carith_powi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
+ _(lj_carith_powu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
+ _(lj_cdata_setfin, 2, FN, P32, CCI_L) \
+ _(strlen, 1, N, INTP, 0) \
+ _(memcpy, 3, S, PTR, 0) \
+ _(memset, 3, S, PTR, 0)
+#else
+#define IRCALLDEF_FFI(_)
+#endif
+#define IRCALLDEF(_) \
+ _(lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
+ _(lj_str_new, 3, S, STR, CCI_L) \
+ _(lj_str_tonum, 2, FN, INT, 0) \
+ _(lj_str_fromint, 2, FN, STR, CCI_L) \
+ _(lj_str_fromnum, 2, FN, STR, CCI_L) \
+ _(lj_tab_new1, 2, FS, TAB, CCI_L) \
+ _(lj_tab_dup, 2, FS, TAB, CCI_L) \
+ _(lj_tab_newkey, 3, S, P32, CCI_L) \
+ _(lj_tab_len, 1, FL, INT, 0) \
+ _(lj_gc_step_jit, 2, FS, NIL, CCI_L) \
+ _(lj_gc_barrieruv, 2, FS, NIL, 0) \
+ _(lj_mem_newgco, 2, FS, P32, CCI_L) \
+ _(lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \
+ IRCALLDEF_FFI(_) \
+ _(sinh, 1, N, NUM, 0) \
+ _(cosh, 1, N, NUM, 0) \
+ _(tanh, 1, N, NUM, 0) \
+ _(fputc, 2, S, INT, 0) \
+ _(fwrite, 4, S, INT, 0) \
+ _(fflush, 1, S, INT, 0) \
+ \
+ /* End of list. */
+
+typedef enum {
+#define IRCALLENUM(name, nargs, kind, type, flags) IRCALL_##name,
+IRCALLDEF(IRCALLENUM)
+#undef IRCALLENUM
+ IRCALL__MAX
+} IRCallID;
+
+LJ_FUNC TRef lj_ir_call(jit_State *J, IRCallID id, ...);
+
+LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
+
+#endif
/* IR emitter. */
LJ_FUNC void LJ_FASTCALL lj_ir_growtop(jit_State *J);
LJ_FUNC TRef LJ_FASTCALL lj_ir_emit(jit_State *J);
-LJ_FUNC TRef lj_ir_call(jit_State *J, IRCallID id, ...);
/* Save current IR in J->fold.ins, but do not emit it (yet). */
static LJ_AINLINE void lj_ir_set_(jit_State *J, uint16_t ot, IRRef1 a, IRRef1 b)
#include "lj_str.h"
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_vm.h"
#include "lj_ff.h"
#include "lj_ir.h"
#include "lj_jit.h"
+#include "lj_ircall.h"
#include "lj_iropt.h"
#include "lj_trace.h"
#include "lj_record.h"