Refactoring of conversion ops, part 1: add IR_CONV.

This commit is contained in:
Mike Pall
2010-12-28 22:05:40 +01:00
parent 06c61d9cea
commit 2ca2de7f0e
5 changed files with 142 additions and 1 deletions

View File

@@ -118,6 +118,7 @@
_(OBAR, S , ref, ref) \
\
/* Type conversions. */ \
_(CONV, N , ref, lit) \
_(TONUM, N , ref, ___) \
_(TOINT, N , ref, lit) \
_(TOBIT, N , ref, ref) \
@@ -218,6 +219,16 @@ IRFLDEF(FLENUM)
#define IRTOINT_TRUNCI64 5 /* Truncate number to int64_t. */
#define IRTOINT_TOBIT 6 /* Cache only: TOBIT conversion. */
/* CONV mode, stored in op2. Lowest 8 bits is the IRType of the source. */
#define IRCONV_TRUNC 0x100 /* Truncate number to integer. */
#define IRCONV_SEXT 0x200 /* Sign-extend integer to integer. */
#define IRCONV_CSH 10
/* Number to integer conversion mode. Ordered by strength of the checks. */
#define IRCONV_TOBIT (0<<IRCONV_CSH) /* None. Cache only: TOBIT conv. */
#define IRCONV_ANY (1<<IRCONV_CSH) /* Any FP number is ok. */
#define IRCONV_INDEX (2<<IRCONV_CSH) /* Check + special backprop rules. */
#define IRCONV_CHECK (3<<IRCONV_CSH) /* Number checked for integerness. */
/* C call info for CALL* instructions. */
typedef struct CCallInfo {
ASMFunction func; /* Function pointer. */