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.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 123d87c8..9d90d69f 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -315,7 +315,7 @@ typedef enum {
315 IRT_THREAD, 315 IRT_THREAD,
316 IRT_PROTO, 316 IRT_PROTO,
317 IRT_FUNC, 317 IRT_FUNC,
318 IRT_9, /* Unused (map of LJ_TTRACE). */ 318 IRT_P64, /* IRT_P64 never escapes the IR (map of LJ_TTRACE). */
319 IRT_CDATA, 319 IRT_CDATA,
320 IRT_TAB, 320 IRT_TAB,
321 IRT_UDATA, 321 IRT_UDATA,
@@ -325,12 +325,15 @@ typedef enum {
325 ** a TValue after implicit or explicit conversion (TONUM). Their types 325 ** a TValue after implicit or explicit conversion (TONUM). Their types
326 ** must be contiguous and next to IRT_NUM (see the typerange macros below). 326 ** must be contiguous and next to IRT_NUM (see the typerange macros below).
327 */ 327 */
328 IRT_INT,
329 IRT_I8, 328 IRT_I8,
330 IRT_U8, 329 IRT_U8,
331 IRT_I16, 330 IRT_I16,
332 IRT_U16, 331 IRT_U16,
333 /* There is room for 13 more types. */ 332 IRT_INT,
333 IRT_U32,
334 IRT_I64,
335 IRT_U64,
336 /* There is room for 10 more types. */
334 337
335 /* Additional flags. */ 338 /* Additional flags. */
336 IRT_MARK = 0x20, /* Marker for misc. purposes. */ 339 IRT_MARK = 0x20, /* Marker for misc. purposes. */
@@ -370,11 +373,17 @@ typedef struct IRType1 { uint8_t irt; } IRType1;
370#define irt_isu8(t) (irt_type(t) == IRT_U8) 373#define irt_isu8(t) (irt_type(t) == IRT_U8)
371#define irt_isi16(t) (irt_type(t) == IRT_I16) 374#define irt_isi16(t) (irt_type(t) == IRT_I16)
372#define irt_isu16(t) (irt_type(t) == IRT_U16) 375#define irt_isu16(t) (irt_type(t) == IRT_U16)
376#define irt_isu32(t) (irt_type(t) == IRT_U32)
373 377
374#define irt_isinteger(t) (irt_typerange((t), IRT_INT, IRT_U16)) 378#define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT))
375#define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA)) 379#define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA))
376#define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA)) 380#define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA))
377 381
382#define IRT_IS64 \
383 ((1u<<IRT_NUM) | (1u<<IRT_I64) | (1u<<IRT_U64) | (1u<<IRT_P64) | \
384 (LJ_64 ? (1u<<IRT_LIGHTUD) : 0))
385#define irt_is64(t) ((IRT_IS64 >> irt_type(t)) & 1)
386
378static LJ_AINLINE IRType itype2irt(const TValue *tv) 387static LJ_AINLINE IRType itype2irt(const TValue *tv)
379{ 388{
380 if (tvisnum(tv)) 389 if (tvisnum(tv))
@@ -469,8 +478,8 @@ typedef uint32_t TRef;
469#define tref_isbool(tr) (tref_typerange((tr), IRT_FALSE, IRT_TRUE)) 478#define tref_isbool(tr) (tref_typerange((tr), IRT_FALSE, IRT_TRUE))
470#define tref_ispri(tr) (tref_typerange((tr), IRT_NIL, IRT_TRUE)) 479#define tref_ispri(tr) (tref_typerange((tr), IRT_NIL, IRT_TRUE))
471#define tref_istruecond(tr) (!tref_typerange((tr), IRT_NIL, IRT_FALSE)) 480#define tref_istruecond(tr) (!tref_typerange((tr), IRT_NIL, IRT_FALSE))
472#define tref_isinteger(tr) (tref_typerange((tr), IRT_INT, IRT_U16)) 481#define tref_isinteger(tr) (tref_typerange((tr), IRT_I8, IRT_INT))
473#define tref_isnumber(tr) (tref_typerange((tr), IRT_NUM, IRT_U16)) 482#define tref_isnumber(tr) (tref_typerange((tr), IRT_NUM, IRT_INT))
474#define tref_isnumber_str(tr) (tref_isnumber((tr)) || tref_isstr((tr))) 483#define tref_isnumber_str(tr) (tref_isnumber((tr)) || tref_isstr((tr)))
475#define tref_isgcv(tr) (tref_typerange((tr), IRT_STR, IRT_UDATA)) 484#define tref_isgcv(tr) (tref_typerange((tr), IRT_STR, IRT_UDATA))
476 485