diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_ir.h | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h index 33edf76c..bdedaddd 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -315,38 +315,24 @@ LJ_DATA const uint8_t lj_ir_mode[IR__MAX+1]; | |||
315 | 315 | ||
316 | /* -- IR instruction types ------------------------------------------------ */ | 316 | /* -- IR instruction types ------------------------------------------------ */ |
317 | 317 | ||
318 | /* Map of itypes to non-negative numbers. ORDER LJ_T. | ||
319 | ** LJ_TUPVAL/LJ_TTRACE never appear in a TValue. Use these itypes for | ||
320 | ** IRT_P32 and IRT_P64, which never escape the IR. | ||
321 | ** The various integers are only used in the IR and can only escape to | ||
322 | ** a TValue after implicit or explicit conversion. Their types must be | ||
323 | ** contiguous and next to IRT_NUM (see the typerange macros below). | ||
324 | */ | ||
325 | #define IRTDEF(_) \ | ||
326 | _(NIL) _(FALSE) _(TRUE) _(LIGHTUD) _(STR) _(P32) _(THREAD) \ | ||
327 | _(PROTO) _(FUNC) _(P64) _(CDATA) _(TAB) _(UDATA) \ | ||
328 | _(FLOAT) _(NUM) _(I8) _(U8) _(I16) _(U16) _(INT) _(U32) _(I64) _(U64) \ | ||
329 | /* There is room for 10 more types. */ | ||
330 | |||
318 | /* IR result type and flags (8 bit). */ | 331 | /* IR result type and flags (8 bit). */ |
319 | typedef enum { | 332 | typedef enum { |
320 | /* Map of itypes to non-negative numbers. ORDER LJ_T */ | 333 | #define IRTENUM(name) IRT_##name, |
321 | IRT_NIL, | 334 | IRTDEF(IRTENUM) |
322 | IRT_FALSE, | 335 | #undef IRTENUM |
323 | IRT_TRUE, | ||
324 | IRT_LIGHTUD, | ||
325 | /* GCobj types are from here ... */ | ||
326 | IRT_STR, | ||
327 | IRT_P32, /* IRT_P32 never escapes the IR (map of LJ_TUPVAL). */ | ||
328 | IRT_THREAD, | ||
329 | IRT_PROTO, | ||
330 | IRT_FUNC, | ||
331 | IRT_P64, /* IRT_P64 never escapes the IR (map of LJ_TTRACE). */ | ||
332 | IRT_CDATA, | ||
333 | IRT_TAB, | ||
334 | IRT_UDATA, | ||
335 | /* ... until here. */ | ||
336 | IRT_NUM, | ||
337 | /* The various integers are only used in the IR and can only escape to | ||
338 | ** a TValue after implicit or explicit conversion (TONUM). Their types | ||
339 | ** must be contiguous and next to IRT_NUM (see the typerange macros below). | ||
340 | */ | ||
341 | IRT_I8, | ||
342 | IRT_U8, | ||
343 | IRT_I16, | ||
344 | IRT_U16, | ||
345 | IRT_INT, | ||
346 | IRT_U32, | ||
347 | IRT_I64, | ||
348 | IRT_U64, | ||
349 | /* There is room for 10 more types. */ | ||
350 | 336 | ||
351 | /* Native pointer type and the corresponding integer type. */ | 337 | /* Native pointer type and the corresponding integer type. */ |
352 | IRT_PTR = LJ_64 ? IRT_P64 : IRT_P32, | 338 | IRT_PTR = LJ_64 ? IRT_P64 : IRT_P32, |
@@ -384,6 +370,7 @@ typedef struct IRType1 { uint8_t irt; } IRType1; | |||
384 | #define irt_islightud(t) (irt_type(t) == IRT_LIGHTUD) | 370 | #define irt_islightud(t) (irt_type(t) == IRT_LIGHTUD) |
385 | #define irt_isstr(t) (irt_type(t) == IRT_STR) | 371 | #define irt_isstr(t) (irt_type(t) == IRT_STR) |
386 | #define irt_istab(t) (irt_type(t) == IRT_TAB) | 372 | #define irt_istab(t) (irt_type(t) == IRT_TAB) |
373 | #define irt_isfloat(t) (irt_type(t) == IRT_FLOAT) | ||
387 | #define irt_isnum(t) (irt_type(t) == IRT_NUM) | 374 | #define irt_isnum(t) (irt_type(t) == IRT_NUM) |
388 | #define irt_isint(t) (irt_type(t) == IRT_INT) | 375 | #define irt_isint(t) (irt_type(t) == IRT_INT) |
389 | #define irt_isi8(t) (irt_type(t) == IRT_I8) | 376 | #define irt_isi8(t) (irt_type(t) == IRT_I8) |
@@ -391,6 +378,8 @@ typedef struct IRType1 { uint8_t irt; } IRType1; | |||
391 | #define irt_isi16(t) (irt_type(t) == IRT_I16) | 378 | #define irt_isi16(t) (irt_type(t) == IRT_I16) |
392 | #define irt_isu16(t) (irt_type(t) == IRT_U16) | 379 | #define irt_isu16(t) (irt_type(t) == IRT_U16) |
393 | #define irt_isu32(t) (irt_type(t) == IRT_U32) | 380 | #define irt_isu32(t) (irt_type(t) == IRT_U32) |
381 | #define irt_isi64(t) (irt_type(t) == IRT_I64) | ||
382 | #define irt_isu64(t) (irt_type(t) == IRT_U64) | ||
394 | 383 | ||
395 | #define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT)) | 384 | #define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT)) |
396 | #define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA)) | 385 | #define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA)) |