aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-05-22 16:19:53 +0200
committerMike Pall <mike>2011-05-22 16:28:43 +0200
commiteffdfda673adac554a99532afd757edb6414f842 (patch)
tree9058528b0b8f8bd4a620c72301909a4bed50a94e /src
parent3a942d6ceaf409874906408edc3e47de20157198 (diff)
downloadluajit-effdfda673adac554a99532afd757edb6414f842.tar.gz
luajit-effdfda673adac554a99532afd757edb6414f842.tar.bz2
luajit-effdfda673adac554a99532afd757edb6414f842.zip
Move IR_CALL* definitions to lj_ircall.h.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.dep55
-rw-r--r--src/buildvm.c1
-rw-r--r--src/lib_jit.c1
-rw-r--r--src/lj_asm.c1
-rw-r--r--src/lj_crecord.c1
-rw-r--r--src/lj_ffrecord.c1
-rw-r--r--src/lj_ir.c1
-rw-r--r--src/lj_ir.h85
-rw-r--r--src/lj_ircall.h100
-rw-r--r--src/lj_iropt.h1
-rw-r--r--src/lj_opt_split.c1
-rw-r--r--src/lj_record.c1
12 files changed, 137 insertions, 112 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep
index 5d1238f6..89ac79e8 100644
--- a/src/Makefile.dep
+++ b/src/Makefile.dep
@@ -1,6 +1,6 @@
1buildvm.o: buildvm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \ 1buildvm.o: buildvm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
2 lj_obj.h lj_gc.h lj_bc.h lj_ir.h lj_frame.h lj_dispatch.h lj_jit.h \ 2 lj_obj.h lj_gc.h lj_bc.h lj_ir.h lj_ircall.h lj_jit.h lj_frame.h \
3 lj_ccall.h luajit.h \ 3 lj_dispatch.h lj_ccall.h luajit.h \
4 lj_traceerr.h 4 lj_traceerr.h
5buildvm_asm.o: buildvm_asm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \ 5buildvm_asm.o: buildvm_asm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
6 lj_bc.h 6 lj_bc.h
@@ -31,8 +31,8 @@ lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
31 lj_libdef.h 31 lj_libdef.h
32lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \ 32lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \
33 lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ir.h \ 33 lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_bc.h lj_ir.h \
34 lj_jit.h lj_iropt.h lj_target.h lj_target_*.h lj_dispatch.h lj_vm.h \ 34 lj_jit.h lj_ircall.h lj_iropt.h lj_target.h lj_target_*.h \
35 lj_vmevent.h lj_lib.h luajit.h lj_libdef.h 35 lj_dispatch.h lj_vm.h lj_vmevent.h lj_lib.h luajit.h lj_libdef.h
36lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ 36lib_math.o: lib_math.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
37 lj_def.h lj_arch.h lj_lib.h lj_libdef.h 37 lj_def.h lj_arch.h lj_lib.h lj_libdef.h
38lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \ 38lib_os.o: lib_os.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
@@ -52,8 +52,9 @@ lj_api.o: lj_api.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
52 lj_traceerr.h lj_vm.h lj_lex.h lj_parse.h 52 lj_traceerr.h lj_vm.h lj_lex.h lj_parse.h
53lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ 53lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
54 lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h \ 54 lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h lj_ir.h lj_jit.h \
55 lj_iropt.h lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_snap.h \ 55 lj_ircall.h lj_iropt.h lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h \
56 lj_asm.h lj_vm.h lj_target.h lj_target_*.h lj_emit_*.h lj_asm_*.h 56 lj_snap.h lj_asm.h lj_vm.h lj_target.h lj_target_*.h lj_emit_*.h \
57 lj_asm_*.h
57lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \ 58lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \
58 lj_bcdef.h 59 lj_bcdef.h
59lj_carith.o: lj_carith.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 60lj_carith.o: lj_carith.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
@@ -77,9 +78,9 @@ lj_cparse.o: lj_cparse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
77 lj_bc.h lj_vm.h lj_char.h 78 lj_bc.h lj_vm.h lj_char.h
78lj_crecord.o: lj_crecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 79lj_crecord.o: lj_crecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
79 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h \ 80 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h \
80 lj_gc.h lj_cparse.h lj_cconv.h lj_clib.h lj_ir.h lj_jit.h lj_iropt.h \ 81 lj_gc.h lj_cparse.h lj_cconv.h lj_clib.h lj_ir.h lj_jit.h lj_ircall.h \
81 lj_trace.h lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h \ 82 lj_iropt.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_record.h \
82 lj_crecord.h 83 lj_ffrecord.h lj_crecord.h
83lj_ctype.o: lj_ctype.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 84lj_ctype.o: lj_ctype.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
84 lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h 85 lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h
85lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 86lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
@@ -91,8 +92,9 @@ lj_err.o: lj_err.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_err.h \
91 lj_traceerr.h lj_vm.h 92 lj_traceerr.h lj_vm.h
92lj_ffrecord.o: lj_ffrecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 93lj_ffrecord.o: lj_ffrecord.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
93 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ff.h \ 94 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ff.h \
94 lj_ffdef.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ 95 lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
95 lj_traceerr.h lj_record.h lj_ffrecord.h lj_crecord.h lj_vm.h lj_recdef.h 96 lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_crecord.h \
97 lj_vm.h lj_recdef.h
96lj_func.o: lj_func.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ 98lj_func.o: lj_func.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
97 lj_func.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h lj_bc.h \ 99 lj_func.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h lj_bc.h \
98 lj_traceerr.h lj_vm.h 100 lj_traceerr.h lj_vm.h
@@ -104,8 +106,9 @@ lj_gdbjit.o: lj_gdbjit.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
104 lj_gc.h lj_err.h lj_errmsg.h lj_frame.h lj_bc.h lj_jit.h lj_ir.h \ 106 lj_gc.h lj_err.h lj_errmsg.h lj_frame.h lj_bc.h lj_jit.h lj_ir.h \
105 lj_dispatch.h 107 lj_dispatch.h
106lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ 108lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
107 lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ 109 lj_str.h lj_tab.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
108 lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_carith.h lj_lib.h 110 lj_dispatch.h lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_carith.h \
111 lj_lib.h
109lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ 112lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
110 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \ 113 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \
111 lj_state.h lj_lex.h lj_parse.h lj_char.h 114 lj_state.h lj_lex.h lj_parse.h lj_char.h
@@ -133,15 +136,15 @@ lj_opt_narrow.o: lj_opt_narrow.c lj_obj.h lua.h luaconf.h lj_def.h \
133 lj_arch.h lj_str.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \ 136 lj_arch.h lj_str.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \
134 lj_dispatch.h lj_traceerr.h lj_vm.h 137 lj_dispatch.h lj_traceerr.h lj_vm.h
135lj_opt_split.o: lj_opt_split.c lj_obj.h lua.h luaconf.h lj_def.h \ 138lj_opt_split.o: lj_opt_split.c lj_obj.h lua.h luaconf.h lj_def.h \
136 lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_ir.h lj_jit.h lj_iropt.h \ 139 lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_ir.h lj_jit.h lj_ircall.h \
137 lj_vm.h 140 lj_iropt.h lj_vm.h
138lj_parse.o: lj_parse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 141lj_parse.o: lj_parse.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
139 lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_state.h \ 142 lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_state.h \
140 lj_bc.h lj_ctype.h lj_lex.h lj_parse.h lj_vm.h lj_vmevent.h 143 lj_bc.h lj_ctype.h lj_lex.h lj_parse.h lj_vm.h lj_vmevent.h
141lj_record.o: lj_record.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 144lj_record.o: lj_record.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
142 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \ 145 lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \
143 lj_ff.h lj_ffdef.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h lj_dispatch.h \ 146 lj_ff.h lj_ffdef.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_trace.h \
144 lj_traceerr.h lj_record.h lj_ffrecord.h lj_snap.h lj_vm.h 147 lj_dispatch.h lj_traceerr.h lj_record.h lj_ffrecord.h lj_snap.h lj_vm.h
145lj_snap.o: lj_snap.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ 148lj_snap.o: lj_snap.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
146 lj_state.h lj_frame.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \ 149 lj_state.h lj_frame.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h lj_trace.h \
147 lj_dispatch.h lj_traceerr.h lj_snap.h lj_target.h lj_target_*.h 150 lj_dispatch.h lj_traceerr.h lj_snap.h lj_target.h lj_target_*.h
@@ -172,13 +175,13 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \
172 lj_alloc.h lj_dispatch.c luajit.h lj_vmevent.c lj_vmevent.h lj_api.c \ 175 lj_alloc.h lj_dispatch.c luajit.h lj_vmevent.c lj_vmevent.h lj_api.c \
173 lj_parse.h lj_lex.c lualib.h lj_parse.c lj_ctype.c lj_cdata.c lj_cconv.h \ 176 lj_parse.h lj_lex.c lualib.h lj_parse.c lj_ctype.c lj_cdata.c lj_cconv.h \
174 lj_cconv.c lj_ccall.c lj_ccall.h lj_carith.c lj_carith.h lj_clib.c \ 177 lj_cconv.c lj_ccall.c lj_ccall.h lj_carith.c lj_carith.h lj_clib.c \
175 lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_lib.h lj_ir.c lj_iropt.h \ 178 lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_lib.h lj_ir.c lj_ircall.h \
176 lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c lj_opt_dce.c \ 179 lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c \
177 lj_opt_loop.c lj_snap.h lj_opt_split.c lj_mcode.c lj_mcode.h lj_snap.c \ 180 lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c lj_mcode.c \
178 lj_target.h lj_target_*.h lj_record.c lj_record.h lj_ffrecord.h \ 181 lj_mcode.h lj_snap.c lj_target.h lj_target_*.h lj_record.c lj_record.h \
179 lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h \ 182 lj_ffrecord.h lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h \
180 lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c \ 183 lj_asm.c lj_asm.h lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h \
181 lib_aux.c lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c \ 184 lj_gdbjit.c lj_alloc.c lib_aux.c lib_base.c lj_libdef.h lib_math.c \
182 lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \ 185 lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c \
183 lib_ffi.c lib_init.c 186 lib_bit.c lib_jit.c lib_ffi.c lib_init.c
184luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h 187luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h
diff --git a/src/buildvm.c b/src/buildvm.c
index 3a99c834..33f87a4b 100644
--- a/src/buildvm.c
+++ b/src/buildvm.c
@@ -19,6 +19,7 @@
19#include "lj_gc.h" 19#include "lj_gc.h"
20#include "lj_bc.h" 20#include "lj_bc.h"
21#include "lj_ir.h" 21#include "lj_ir.h"
22#include "lj_ircall.h"
22#include "lj_frame.h" 23#include "lj_frame.h"
23#include "lj_dispatch.h" 24#include "lj_dispatch.h"
24#if LJ_HASFFI 25#if LJ_HASFFI
diff --git a/src/lib_jit.c b/src/lib_jit.c
index 57837e1f..259a03e1 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -19,6 +19,7 @@
19#if LJ_HASJIT 19#if LJ_HASJIT
20#include "lj_ir.h" 20#include "lj_ir.h"
21#include "lj_jit.h" 21#include "lj_jit.h"
22#include "lj_ircall.h"
22#include "lj_iropt.h" 23#include "lj_iropt.h"
23#include "lj_target.h" 24#include "lj_target.h"
24#endif 25#endif
diff --git a/src/lj_asm.c b/src/lj_asm.c
index e2c14872..78f2484a 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -19,6 +19,7 @@
19#endif 19#endif
20#include "lj_ir.h" 20#include "lj_ir.h"
21#include "lj_jit.h" 21#include "lj_jit.h"
22#include "lj_ircall.h"
22#include "lj_iropt.h" 23#include "lj_iropt.h"
23#include "lj_mcode.h" 24#include "lj_mcode.h"
24#include "lj_iropt.h" 25#include "lj_iropt.h"
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 0b73f440..02e788aa 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -20,6 +20,7 @@
20#include "lj_clib.h" 20#include "lj_clib.h"
21#include "lj_ir.h" 21#include "lj_ir.h"
22#include "lj_jit.h" 22#include "lj_jit.h"
23#include "lj_ircall.h"
23#include "lj_iropt.h" 24#include "lj_iropt.h"
24#include "lj_trace.h" 25#include "lj_trace.h"
25#include "lj_record.h" 26#include "lj_record.h"
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index a3d18ff9..91d31b29 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -18,6 +18,7 @@
18#include "lj_ff.h" 18#include "lj_ff.h"
19#include "lj_ir.h" 19#include "lj_ir.h"
20#include "lj_jit.h" 20#include "lj_jit.h"
21#include "lj_ircall.h"
21#include "lj_iropt.h" 22#include "lj_iropt.h"
22#include "lj_trace.h" 23#include "lj_trace.h"
23#include "lj_record.h" 24#include "lj_record.h"
diff --git a/src/lj_ir.c b/src/lj_ir.c
index 94fe44b1..b7d1e7a7 100644
--- a/src/lj_ir.c
+++ b/src/lj_ir.c
@@ -19,6 +19,7 @@
19#include "lj_tab.h" 19#include "lj_tab.h"
20#include "lj_ir.h" 20#include "lj_ir.h"
21#include "lj_jit.h" 21#include "lj_jit.h"
22#include "lj_ircall.h"
22#include "lj_iropt.h" 23#include "lj_iropt.h"
23#include "lj_trace.h" 24#include "lj_trace.h"
24#if LJ_HASFFI 25#if LJ_HASFFI
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). */
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
new file mode 100644
index 00000000..3131b15d
--- /dev/null
+++ b/src/lj_ircall.h
@@ -0,0 +1,100 @@
1/*
2** IR CALL* instruction definitions.
3** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
4*/
5
6#ifndef _LJ_IRCALL_H
7#define _LJ_IRCALL_H
8
9#include "lj_obj.h"
10#include "lj_ir.h"
11#include "lj_jit.h"
12
13/* C call info for CALL* instructions. */
14typedef struct CCallInfo {
15 ASMFunction func; /* Function pointer. */
16 uint32_t flags; /* Number of arguments and flags. */
17} CCallInfo;
18
19#define CCI_NARGS(ci) ((ci)->flags & 0xff) /* Extract # of args. */
20#define CCI_NARGS_MAX 32 /* Max. # of args. */
21
22#define CCI_OTSHIFT 16
23#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */
24#define CCI_OPSHIFT 24
25#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */
26
27#define CCI_CALL_N (IR_CALLN << CCI_OPSHIFT)
28#define CCI_CALL_L (IR_CALLL << CCI_OPSHIFT)
29#define CCI_CALL_S (IR_CALLS << CCI_OPSHIFT)
30#define CCI_CALL_FN (CCI_CALL_N|CCI_FASTCALL)
31#define CCI_CALL_FL (CCI_CALL_L|CCI_FASTCALL)
32#define CCI_CALL_FS (CCI_CALL_S|CCI_FASTCALL)
33
34/* C call info flags. */
35#define CCI_L 0x0100 /* Implicit L arg. */
36#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
37#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
38#define CCI_FASTCALL 0x0800 /* Fastcall convention. */
39
40/* Function definitions for CALL* instructions. */
41#if LJ_HASFFI
42#if LJ_32
43#define ARG2_64 4 /* Treat as 4 32 bit arguments. */
44#define IRCALLDEF_FFI32(_) \
45 _(lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
46#else
47#define ARG2_64 2
48#define IRCALLDEF_FFI32(_)
49#endif
50#define IRCALLDEF_FFI(_) \
51 IRCALLDEF_FFI32(_) \
52 _(lj_carith_divi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
53 _(lj_carith_divu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
54 _(lj_carith_modi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
55 _(lj_carith_modu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
56 _(lj_carith_powi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
57 _(lj_carith_powu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
58 _(lj_cdata_setfin, 2, FN, P32, CCI_L) \
59 _(strlen, 1, N, INTP, 0) \
60 _(memcpy, 3, S, PTR, 0) \
61 _(memset, 3, S, PTR, 0)
62#else
63#define IRCALLDEF_FFI(_)
64#endif
65#define IRCALLDEF(_) \
66 _(lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
67 _(lj_str_new, 3, S, STR, CCI_L) \
68 _(lj_str_tonum, 2, FN, INT, 0) \
69 _(lj_str_fromint, 2, FN, STR, CCI_L) \
70 _(lj_str_fromnum, 2, FN, STR, CCI_L) \
71 _(lj_tab_new1, 2, FS, TAB, CCI_L) \
72 _(lj_tab_dup, 2, FS, TAB, CCI_L) \
73 _(lj_tab_newkey, 3, S, P32, CCI_L) \
74 _(lj_tab_len, 1, FL, INT, 0) \
75 _(lj_gc_step_jit, 2, FS, NIL, CCI_L) \
76 _(lj_gc_barrieruv, 2, FS, NIL, 0) \
77 _(lj_mem_newgco, 2, FS, P32, CCI_L) \
78 _(lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \
79 IRCALLDEF_FFI(_) \
80 _(sinh, 1, N, NUM, 0) \
81 _(cosh, 1, N, NUM, 0) \
82 _(tanh, 1, N, NUM, 0) \
83 _(fputc, 2, S, INT, 0) \
84 _(fwrite, 4, S, INT, 0) \
85 _(fflush, 1, S, INT, 0) \
86 \
87 /* End of list. */
88
89typedef enum {
90#define IRCALLENUM(name, nargs, kind, type, flags) IRCALL_##name,
91IRCALLDEF(IRCALLENUM)
92#undef IRCALLENUM
93 IRCALL__MAX
94} IRCallID;
95
96LJ_FUNC TRef lj_ir_call(jit_State *J, IRCallID id, ...);
97
98LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
99
100#endif
diff --git a/src/lj_iropt.h b/src/lj_iropt.h
index 82dc2e27..daba5296 100644
--- a/src/lj_iropt.h
+++ b/src/lj_iropt.h
@@ -15,7 +15,6 @@
15/* IR emitter. */ 15/* IR emitter. */
16LJ_FUNC void LJ_FASTCALL lj_ir_growtop(jit_State *J); 16LJ_FUNC void LJ_FASTCALL lj_ir_growtop(jit_State *J);
17LJ_FUNC TRef LJ_FASTCALL lj_ir_emit(jit_State *J); 17LJ_FUNC TRef LJ_FASTCALL lj_ir_emit(jit_State *J);
18LJ_FUNC TRef lj_ir_call(jit_State *J, IRCallID id, ...);
19 18
20/* Save current IR in J->fold.ins, but do not emit it (yet). */ 19/* Save current IR in J->fold.ins, but do not emit it (yet). */
21static LJ_AINLINE void lj_ir_set_(jit_State *J, uint16_t ot, IRRef1 a, IRRef1 b) 20static LJ_AINLINE void lj_ir_set_(jit_State *J, uint16_t ot, IRRef1 a, IRRef1 b)
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c
index e52ddfd4..2f8b1e9c 100644
--- a/src/lj_opt_split.c
+++ b/src/lj_opt_split.c
@@ -14,6 +14,7 @@
14#include "lj_str.h" 14#include "lj_str.h"
15#include "lj_ir.h" 15#include "lj_ir.h"
16#include "lj_jit.h" 16#include "lj_jit.h"
17#include "lj_ircall.h"
17#include "lj_iropt.h" 18#include "lj_iropt.h"
18#include "lj_vm.h" 19#include "lj_vm.h"
19 20
diff --git a/src/lj_record.c b/src/lj_record.c
index e51d0b5a..91555a3b 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -19,6 +19,7 @@
19#include "lj_ff.h" 19#include "lj_ff.h"
20#include "lj_ir.h" 20#include "lj_ir.h"
21#include "lj_jit.h" 21#include "lj_jit.h"
22#include "lj_ircall.h"
22#include "lj_iropt.h" 23#include "lj_iropt.h"
23#include "lj_trace.h" 24#include "lj_trace.h"
24#include "lj_record.h" 25#include "lj_record.h"