summaryrefslogtreecommitdiff
path: root/src/lj_ir.h
diff options
context:
space:
mode:
authorMike Pall <mike>2011-02-02 02:29:37 +0100
committerMike Pall <mike>2011-02-02 02:29:37 +0100
commitb613216efc7447dae645d8834e4d6f3185cd1bcc (patch)
tree0859fed377f00ebeada70ba45d02496b7fb4a249 /src/lj_ir.h
parentc539c0cac8f668e66a5ce9e5fd645cb45e3c5063 (diff)
downloadluajit-b613216efc7447dae645d8834e4d6f3185cd1bcc.tar.gz
luajit-b613216efc7447dae645d8834e4d6f3185cd1bcc.tar.bz2
luajit-b613216efc7447dae645d8834e4d6f3185cd1bcc.zip
Add SPLIT pass to split 64 bit IR instructions for 32 bit CPUs.
Add generic HIOP instruction for extra backend functionality. Add support for HIOP to x86 backend. Use POWI for 64 bit integer x^k, too. POWI is lowered to a call by SPLIT or the x64 backend.
Diffstat (limited to 'src/lj_ir.h')
-rw-r--r--src/lj_ir.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 1cb3566e..286eb219 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -33,6 +33,7 @@
33 /* Miscellaneous ops. */ \ 33 /* Miscellaneous ops. */ \
34 _(NOP, N , ___, ___) \ 34 _(NOP, N , ___, ___) \
35 _(BASE, N , lit, lit) \ 35 _(BASE, N , lit, lit) \
36 _(HIOP, S , ref, ref) \
36 _(LOOP, S , ___, ___) \ 37 _(LOOP, S , ___, ___) \
37 _(PHI, S , ref, ref) \ 38 _(PHI, S , ref, ref) \
38 _(RENAME, S , ref, lit) \ 39 _(RENAME, S , ref, lit) \
@@ -212,8 +213,9 @@ IRFLDEF(FLENUM)
212/* CONV mode, stored in op2. */ 213/* CONV mode, stored in op2. */
213#define IRCONV_SRCMASK 0x001f /* Source IRType. */ 214#define IRCONV_SRCMASK 0x001f /* Source IRType. */
214#define IRCONV_DSTMASK 0x03e0 /* Dest. IRType (also in ir->t). */ 215#define IRCONV_DSTMASK 0x03e0 /* Dest. IRType (also in ir->t). */
215#define IRCONV_NUM_INT ((IRT_NUM<<5)|IRT_INT) 216#define IRCONV_DSH 5
216#define IRCONV_INT_NUM ((IRT_INT<<5)|IRT_NUM) 217#define IRCONV_NUM_INT ((IRT_NUM<<IRCONV_DSH)|IRT_INT)
218#define IRCONV_INT_NUM ((IRT_INT<<IRCONV_DSH)|IRT_NUM)
217#define IRCONV_TRUNC 0x0400 /* Truncate number to integer. */ 219#define IRCONV_TRUNC 0x0400 /* Truncate number to integer. */
218#define IRCONV_SEXT 0x0800 /* Sign-extend integer to integer. */ 220#define IRCONV_SEXT 0x0800 /* Sign-extend integer to integer. */
219#define IRCONV_MODEMASK 0x0fff 221#define IRCONV_MODEMASK 0x0fff
@@ -251,13 +253,21 @@ typedef struct CCallInfo {
251#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */ 253#define CCI_CASTU64 0x0200 /* Cast u64 result to number. */
252#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */ 254#define CCI_NOFPRCLOBBER 0x0400 /* Does not clobber any FPRs. */
253#define CCI_FASTCALL 0x0800 /* Fastcall convention. */ 255#define CCI_FASTCALL 0x0800 /* Fastcall convention. */
254#define CCI_STACK64 0x1000 /* Needs 64 bits per argument. */
255 256
256/* Function definitions for CALL* instructions. */ 257/* Function definitions for CALL* instructions. */
257#if LJ_HASFFI 258#if LJ_HASFFI
259#if LJ_32
260#define ARG2_64 4 /* Treat as 4 32 bit arguments. */
261#define IRCALLDEF_FFI32(_) \
262 _(lj_carith_mul64, ARG2_64, N, I64, CCI_NOFPRCLOBBER)
263#else
264#define ARG2_64 2
265#define IRCALLDEF_FFI32(_)
266#endif
258#define IRCALLDEF_FFI(_) \ 267#define IRCALLDEF_FFI(_) \
259 _(lj_carith_powi64, 2, N, I64, CCI_STACK64|CCI_NOFPRCLOBBER) \ 268 IRCALLDEF_FFI32(_) \
260 _(lj_carith_powu64, 2, N, U64, CCI_STACK64|CCI_NOFPRCLOBBER) 269 _(lj_carith_powi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
270 _(lj_carith_powu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER)
261#else 271#else
262#define IRCALLDEF_FFI(_) 272#define IRCALLDEF_FFI(_)
263#endif 273#endif
@@ -402,6 +412,7 @@ typedef struct IRType1 { uint8_t irt; } IRType1;
402#define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT)) 412#define irt_isinteger(t) (irt_typerange((t), IRT_I8, IRT_INT))
403#define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA)) 413#define irt_isgcv(t) (irt_typerange((t), IRT_STR, IRT_UDATA))
404#define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA)) 414#define irt_isaddr(t) (irt_typerange((t), IRT_LIGHTUD, IRT_UDATA))
415#define irt_isint64(t) (irt_typerange((t), IRT_I64, IRT_U64))
405 416
406#if LJ_64 417#if LJ_64
407#define IRT_IS64 \ 418#define IRT_IS64 \