diff options
Diffstat (limited to 'src/lj_ir.h')
-rw-r--r-- | src/lj_ir.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h index 80763d88..f33f6355 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -40,6 +40,7 @@ | |||
40 | _(USE, S , ref, ___) \ | 40 | _(USE, S , ref, ___) \ |
41 | _(PHI, S , ref, ref) \ | 41 | _(PHI, S , ref, ref) \ |
42 | _(RENAME, S , ref, lit) \ | 42 | _(RENAME, S , ref, lit) \ |
43 | _(PROF, S , ___, ___) \ | ||
43 | \ | 44 | \ |
44 | /* Constants. */ \ | 45 | /* Constants. */ \ |
45 | _(KPRI, N , ___, ___) \ | 46 | _(KPRI, N , ___, ___) \ |
@@ -96,6 +97,7 @@ | |||
96 | _(UREFC, LW, ref, lit) \ | 97 | _(UREFC, LW, ref, lit) \ |
97 | _(FREF, R , ref, lit) \ | 98 | _(FREF, R , ref, lit) \ |
98 | _(STRREF, N , ref, ref) \ | 99 | _(STRREF, N , ref, ref) \ |
100 | _(LREF, L , ___, ___) \ | ||
99 | \ | 101 | \ |
100 | /* Loads and Stores. These must be in the same order. */ \ | 102 | /* Loads and Stores. These must be in the same order. */ \ |
101 | _(ALOAD, L , ref, ___) \ | 103 | _(ALOAD, L , ref, ___) \ |
@@ -120,6 +122,11 @@ | |||
120 | _(CNEW, AW, ref, ref) \ | 122 | _(CNEW, AW, ref, ref) \ |
121 | _(CNEWI, NW, ref, ref) /* CSE is ok, not marked as A. */ \ | 123 | _(CNEWI, NW, ref, ref) /* CSE is ok, not marked as A. */ \ |
122 | \ | 124 | \ |
125 | /* Buffer operations. */ \ | ||
126 | _(BUFHDR, L , ref, lit) \ | ||
127 | _(BUFPUT, L , ref, ref) \ | ||
128 | _(BUFSTR, A , ref, ref) \ | ||
129 | \ | ||
123 | /* Barriers. */ \ | 130 | /* Barriers. */ \ |
124 | _(TBAR, S , ref, ___) \ | 131 | _(TBAR, S , ref, ___) \ |
125 | _(OBAR, S , ref, ref) \ | 132 | _(OBAR, S , ref, ref) \ |
@@ -128,11 +135,12 @@ | |||
128 | /* Type conversions. */ \ | 135 | /* Type conversions. */ \ |
129 | _(CONV, NW, ref, lit) \ | 136 | _(CONV, NW, ref, lit) \ |
130 | _(TOBIT, N , ref, ref) \ | 137 | _(TOBIT, N , ref, ref) \ |
131 | _(TOSTR, N , ref, ___) \ | 138 | _(TOSTR, N , ref, lit) \ |
132 | _(STRTO, N , ref, ___) \ | 139 | _(STRTO, N , ref, ___) \ |
133 | \ | 140 | \ |
134 | /* Calls. */ \ | 141 | /* Calls. */ \ |
135 | _(CALLN, N , ref, lit) \ | 142 | _(CALLN, N , ref, lit) \ |
143 | _(CALLA, A , ref, lit) \ | ||
136 | _(CALLL, L , ref, lit) \ | 144 | _(CALLL, L , ref, lit) \ |
137 | _(CALLS, S , ref, lit) \ | 145 | _(CALLS, S , ref, lit) \ |
138 | _(CALLXS, S , ref, ref) \ | 146 | _(CALLXS, S , ref, ref) \ |
@@ -186,6 +194,7 @@ IRFPMDEF(FPMENUM) | |||
186 | _(STR_LEN, offsetof(GCstr, len)) \ | 194 | _(STR_LEN, offsetof(GCstr, len)) \ |
187 | _(FUNC_ENV, offsetof(GCfunc, l.env)) \ | 195 | _(FUNC_ENV, offsetof(GCfunc, l.env)) \ |
188 | _(FUNC_PC, offsetof(GCfunc, l.pc)) \ | 196 | _(FUNC_PC, offsetof(GCfunc, l.pc)) \ |
197 | _(THREAD_ENV, offsetof(lua_State, env)) \ | ||
189 | _(TAB_META, offsetof(GCtab, metatable)) \ | 198 | _(TAB_META, offsetof(GCtab, metatable)) \ |
190 | _(TAB_ARRAY, offsetof(GCtab, array)) \ | 199 | _(TAB_ARRAY, offsetof(GCtab, array)) \ |
191 | _(TAB_NODE, offsetof(GCtab, node)) \ | 200 | _(TAB_NODE, offsetof(GCtab, node)) \ |
@@ -221,13 +230,16 @@ IRFLDEF(FLENUM) | |||
221 | #define IRXLOAD_VOLATILE 2 /* Load from volatile data. */ | 230 | #define IRXLOAD_VOLATILE 2 /* Load from volatile data. */ |
222 | #define IRXLOAD_UNALIGNED 4 /* Unaligned load. */ | 231 | #define IRXLOAD_UNALIGNED 4 /* Unaligned load. */ |
223 | 232 | ||
233 | /* BUFHDR mode, stored in op2. */ | ||
234 | #define IRBUFHDR_RESET 0 /* Reset buffer. */ | ||
235 | #define IRBUFHDR_APPEND 1 /* Append to buffer. */ | ||
236 | |||
224 | /* CONV mode, stored in op2. */ | 237 | /* CONV mode, stored in op2. */ |
225 | #define IRCONV_SRCMASK 0x001f /* Source IRType. */ | 238 | #define IRCONV_SRCMASK 0x001f /* Source IRType. */ |
226 | #define IRCONV_DSTMASK 0x03e0 /* Dest. IRType (also in ir->t). */ | 239 | #define IRCONV_DSTMASK 0x03e0 /* Dest. IRType (also in ir->t). */ |
227 | #define IRCONV_DSH 5 | 240 | #define IRCONV_DSH 5 |
228 | #define IRCONV_NUM_INT ((IRT_NUM<<IRCONV_DSH)|IRT_INT) | 241 | #define IRCONV_NUM_INT ((IRT_NUM<<IRCONV_DSH)|IRT_INT) |
229 | #define IRCONV_INT_NUM ((IRT_INT<<IRCONV_DSH)|IRT_NUM) | 242 | #define IRCONV_INT_NUM ((IRT_INT<<IRCONV_DSH)|IRT_NUM) |
230 | #define IRCONV_TRUNC 0x0400 /* Truncate number to integer. */ | ||
231 | #define IRCONV_SEXT 0x0800 /* Sign-extend integer to integer. */ | 243 | #define IRCONV_SEXT 0x0800 /* Sign-extend integer to integer. */ |
232 | #define IRCONV_MODEMASK 0x0fff | 244 | #define IRCONV_MODEMASK 0x0fff |
233 | #define IRCONV_CONVMASK 0xf000 | 245 | #define IRCONV_CONVMASK 0xf000 |
@@ -238,6 +250,11 @@ IRFLDEF(FLENUM) | |||
238 | #define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */ | 250 | #define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */ |
239 | #define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */ | 251 | #define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */ |
240 | 252 | ||
253 | /* TOSTR mode, stored in op2. */ | ||
254 | #define IRTOSTR_INT 0 /* Convert integer to string. */ | ||
255 | #define IRTOSTR_NUM 1 /* Convert number to string. */ | ||
256 | #define IRTOSTR_CHAR 2 /* Convert char value to string. */ | ||
257 | |||
241 | /* -- IR operands --------------------------------------------------------- */ | 258 | /* -- IR operands --------------------------------------------------------- */ |
242 | 259 | ||
243 | /* IR operand mode (2 bit). */ | 260 | /* IR operand mode (2 bit). */ |
@@ -464,6 +481,7 @@ typedef uint32_t TRef; | |||
464 | #define tref_isnil(tr) (tref_istype((tr), IRT_NIL)) | 481 | #define tref_isnil(tr) (tref_istype((tr), IRT_NIL)) |
465 | #define tref_isfalse(tr) (tref_istype((tr), IRT_FALSE)) | 482 | #define tref_isfalse(tr) (tref_istype((tr), IRT_FALSE)) |
466 | #define tref_istrue(tr) (tref_istype((tr), IRT_TRUE)) | 483 | #define tref_istrue(tr) (tref_istype((tr), IRT_TRUE)) |
484 | #define tref_islightud(tr) (tref_istype((tr), IRT_LIGHTUD)) | ||
467 | #define tref_isstr(tr) (tref_istype((tr), IRT_STR)) | 485 | #define tref_isstr(tr) (tref_istype((tr), IRT_STR)) |
468 | #define tref_isfunc(tr) (tref_istype((tr), IRT_FUNC)) | 486 | #define tref_isfunc(tr) (tref_istype((tr), IRT_FUNC)) |
469 | #define tref_iscdata(tr) (tref_istype((tr), IRT_CDATA)) | 487 | #define tref_iscdata(tr) (tref_istype((tr), IRT_CDATA)) |