diff options
| -rw-r--r-- | include/ejit/ejit.h | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/include/ejit/ejit.h b/include/ejit/ejit.h index d3bc6c3..9343110 100644 --- a/include/ejit/ejit.h +++ b/include/ejit/ejit.h @@ -564,6 +564,16 @@ static inline void ejit_ldxi_ptr(struct ejit_func *s, struct ejit_gpr r0,  		abort();  } +static inline void ejit_ldi_ptr(struct ejit_func *s, struct ejit_gpr r0, void *p) +{ +	if (sizeof(void *) == sizeof(int64_t)) +		ejit_ldi_u64(s, r0, p); +	else if (sizeof(void *) == sizeof(int32_t)) +		ejit_ldi_u32(s, r0, p); +	else +		abort(); +} +  static inline void ejit_ldxi_label(struct ejit_func *s, struct ejit_gpr r0,                                     struct ejit_gpr r1, int64_t o)  { @@ -571,6 +581,20 @@ static inline void ejit_ldxi_label(struct ejit_func *s, struct ejit_gpr r0,  	ejit_ldxi_ptr(s, r0, r1, o);  } +#define EJIT_LDI(f, t, r0, o)        \ +	_Generic((t)(0),                  \ +		 int8_t: ejit_ldi_i8,    \ +		 uint8_t: ejit_ldi_u8,   \ +		 int16_t: ejit_ldi_i16,  \ +		 uint16_t: ejit_ldi_u16, \ +		 int32_t: ejit_ldi_i32,  \ +		 uint32_t: ejit_ldi_u32, \ +		 int64_t: ejit_ldi_i64,  \ +		 uint64_t: ejit_ldi_u64, \ +		 float: ejit_ldi_f,      \ +		 double: ejit_ldi_d,     \ +		 default: ejit_ldi_ptr)((f), (r0), (o)) +  #define EJIT_LDXI(f, t, r0, r1, o)        \  	_Generic((t)(0),                  \  		 int8_t: ejit_ldxi_i8,    \ | 
