aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-08-27 20:27:01 +0200
committerMike Pall <mike>2012-08-27 20:27:01 +0200
commit76b18b2b465532e528af2162e79365794c8ba290 (patch)
tree3e187353b1f3392961403db64b6fb51c36d240cf /src
parent30f458fb4d8bab4096d74ed62d621110ca16e881 (diff)
downloadluajit-76b18b2b465532e528af2162e79365794c8ba290.tar.gz
luajit-76b18b2b465532e528af2162e79365794c8ba290.tar.bz2
luajit-76b18b2b465532e528af2162e79365794c8ba290.zip
Add table of IR type sizes.
Diffstat (limited to 'src')
-rw-r--r--src/host/buildvm.c2
-rw-r--r--src/lj_ir.c8
-rw-r--r--src/lj_ir.h17
3 files changed, 21 insertions, 6 deletions
diff --git a/src/host/buildvm.c b/src/host/buildvm.c
index 462fd8f7..72b74f1f 100644
--- a/src/host/buildvm.c
+++ b/src/host/buildvm.c
@@ -245,7 +245,7 @@ IRDEF(IRNAME)
245}; 245};
246 246
247const char *const irt_names[] = { 247const char *const irt_names[] = {
248#define IRTNAME(name) #name, 248#define IRTNAME(name, size) #name,
249IRTDEF(IRTNAME) 249IRTDEF(IRTNAME)
250#undef IRTNAME 250#undef IRTNAME
251 NULL 251 NULL
diff --git a/src/lj_ir.c b/src/lj_ir.c
index 92be4149..abc275d1 100644
--- a/src/lj_ir.c
+++ b/src/lj_ir.c
@@ -46,6 +46,14 @@ IRDEF(IRMODE)
46 0 46 0
47}; 47};
48 48
49/* IR type sizes. */
50LJ_DATADEF const uint8_t lj_ir_type_size[IRT__MAX+1] = {
51#define IRTSIZE(name, size) size,
52IRTDEF(IRTSIZE)
53#undef IRTSIZE
54 0
55};
56
49/* C call info for CALL* instructions. */ 57/* C call info for CALL* instructions. */
50LJ_DATADEF const CCallInfo lj_ir_callinfo[] = { 58LJ_DATADEF const CCallInfo lj_ir_callinfo[] = {
51#define IRCALLCI(cond, name, nargs, kind, type, flags) \ 59#define IRCALLCI(cond, name, nargs, kind, type, flags) \
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 6d016b93..4953425a 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -284,16 +284,19 @@ LJ_DATA const uint8_t lj_ir_mode[IR__MAX+1];
284** contiguous and next to IRT_NUM (see the typerange macros below). 284** contiguous and next to IRT_NUM (see the typerange macros below).
285*/ 285*/
286#define IRTDEF(_) \ 286#define IRTDEF(_) \
287 _(NIL) _(FALSE) _(TRUE) _(LIGHTUD) _(STR) _(P32) _(THREAD) \ 287 _(NIL, 4) _(FALSE, 4) _(TRUE, 4) _(LIGHTUD, LJ_64 ? 8 : 4) _(STR, 4) \
288 _(PROTO) _(FUNC) _(P64) _(CDATA) _(TAB) _(UDATA) \ 288 _(P32, 4) _(THREAD, 4) _(PROTO, 4) _(FUNC, 4) _(P64, 8) _(CDATA, 4) \
289 _(FLOAT) _(NUM) _(I8) _(U8) _(I16) _(U16) _(INT) _(U32) _(I64) _(U64) \ 289 _(TAB, 4) _(UDATA, 4) \
290 _(SOFTFP) /* There is room for 9 more types. */ 290 _(FLOAT, 4) _(NUM, 8) _(I8, 1) _(U8, 1) _(I16, 2) _(U16, 2) \
291 _(INT, 4) _(U32, 4) _(I64, 8) _(U64, 8) \
292 _(SOFTFP, 4) /* There is room for 9 more types. */
291 293
292/* IR result type and flags (8 bit). */ 294/* IR result type and flags (8 bit). */
293typedef enum { 295typedef enum {
294#define IRTENUM(name) IRT_##name, 296#define IRTENUM(name, size) IRT_##name,
295IRTDEF(IRTENUM) 297IRTDEF(IRTENUM)
296#undef IRTENUM 298#undef IRTENUM
299 IRT__MAX,
297 300
298 /* Native pointer type and the corresponding integer type. */ 301 /* Native pointer type and the corresponding integer type. */
299 IRT_PTR = LJ_64 ? IRT_P64 : IRT_P32, 302 IRT_PTR = LJ_64 ? IRT_P64 : IRT_P32,
@@ -361,6 +364,10 @@ typedef struct IRType1 { uint8_t irt; } IRType1;
361#define irt_is64(t) ((IRT_IS64 >> irt_type(t)) & 1) 364#define irt_is64(t) ((IRT_IS64 >> irt_type(t)) & 1)
362#define irt_is64orfp(t) (((IRT_IS64|(1u<<IRT_FLOAT))>>irt_type(t)) & 1) 365#define irt_is64orfp(t) (((IRT_IS64|(1u<<IRT_FLOAT))>>irt_type(t)) & 1)
363 366
367#define irt_size(t) (lj_ir_type_size[irt_t((t))])
368
369LJ_DATA const uint8_t lj_ir_type_size[];
370
364static LJ_AINLINE IRType itype2irt(const TValue *tv) 371static LJ_AINLINE IRType itype2irt(const TValue *tv)
365{ 372{
366 if (tvisint(tv)) 373 if (tvisint(tv))