/[pcre]/code/trunk/sljit/sljitLir.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitLir.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1182 by zherczeg, Sun Oct 28 05:22:32 2012 UTC revision 1499 by zherczeg, Mon Aug 11 06:42:28 2014 UTC
# Line 83  Line 83 
83  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
84    
85  #define GET_OPCODE(op) \  #define GET_OPCODE(op) \
86          ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))          ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
87    
88  #define GET_FLAGS(op) \  #define GET_FLAGS(op) \
89          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))          ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))
90    
91  #define GET_ALL_FLAGS(op) \  #define GET_ALL_FLAGS(op) \
92          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))          ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
93    
94    #define TYPE_CAST_NEEDED(op) \
95            (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))
96    
97  #define BUF_SIZE        4096  #define BUF_SIZE        4096
98    
# Line 99  Line 102 
102  #define ABUF_SIZE       4096  #define ABUF_SIZE       4096
103  #endif  #endif
104    
105    /* Parameter parsing. */
106    #define REG_MASK                0x3f
107    #define OFFS_REG(reg)           (((reg) >> 8) & REG_MASK)
108    #define OFFS_REG_MASK           (REG_MASK << 8)
109    #define TO_OFFS_REG(reg)        ((reg) << 8)
110    /* When reg cannot be unused. */
111    #define FAST_IS_REG(reg)        ((reg) <= REG_MASK)
112    /* When reg can be unused. */
113    #define SLOW_IS_REG(reg)        ((reg) > 0 && (reg) <= REG_MASK)
114    
115  /* Jump flags. */  /* Jump flags. */
116  #define JUMP_LABEL      0x1  #define JUMP_LABEL      0x1
117  #define JUMP_ADDR       0x2  #define JUMP_ADDR       0x2
118  /* SLJIT_REWRITABLE_JUMP is 0x1000. */  /* SLJIT_REWRITABLE_JUMP is 0x1000. */
119    
120  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
121          #define PATCH_MB        0x4  #       define PATCH_MB 0x4
122          #define PATCH_MW        0x8  #       define PATCH_MW 0x8
123  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
124          #define PATCH_MD        0x10  #       define PATCH_MD 0x10
125  #endif  #endif
126  #endif  #endif
127    
128  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
129          #define IS_BL           0x4  #       define IS_BL            0x4
130          #define PATCH_B         0x8  #       define PATCH_B          0x8
131  #endif  #endif
132    
133  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
134          #define CPOOL_SIZE      512  #       define CPOOL_SIZE       512
135  #endif  #endif
136    
137  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
138          #define IS_COND         0x04  #       define IS_COND          0x04
139          #define IS_BL           0x08  #       define IS_BL            0x08
         /* cannot be encoded as branch */  
         #define B_TYPE0         0x00  
140          /* conditional + imm8 */          /* conditional + imm8 */
141          #define B_TYPE1         0x10  #       define PATCH_TYPE1      0x10
142          /* conditional + imm20 */          /* conditional + imm20 */
143          #define B_TYPE2         0x20  #       define PATCH_TYPE2      0x20
144          /* IT + imm24 */          /* IT + imm24 */
145          #define B_TYPE3         0x30  #       define PATCH_TYPE3      0x30
146          /* imm11 */          /* imm11 */
147          #define B_TYPE4         0x40  #       define PATCH_TYPE4      0x40
148          /* imm24 */          /* imm24 */
149          #define B_TYPE5         0x50  #       define PATCH_TYPE5      0x50
150          /* BL + imm24 */          /* BL + imm24 */
151          #define BL_TYPE6        0x60  #       define PATCH_BL         0x60
152          /* 0xf00 cc code for branches */          /* 0xf00 cc code for branches */
153  #endif  #endif
154    
155  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
156          #define UNCOND_B        0x04  #       define IS_COND          0x004
157          #define PATCH_B         0x08  #       define IS_CBZ           0x008
158          #define ABSOLUTE_B      0x10  #       define IS_BL            0x010
159    #       define PATCH_B          0x020
160    #       define PATCH_COND       0x040
161    #       define PATCH_ABS48      0x080
162    #       define PATCH_ABS64      0x100
163  #endif  #endif
164    
165  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
166          #define IS_MOVABLE      0x04  #       define IS_COND          0x004
167          #define IS_JAL          0x08  #       define IS_CALL          0x008
168          #define IS_BIT26_COND   0x10  #       define PATCH_B          0x010
169          #define IS_BIT16_COND   0x20  #       define PATCH_ABS_B      0x020
170    #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
171    #       define PATCH_ABS32      0x040
172    #       define PATCH_ABS48      0x080
173    #endif
174    #       define REMOVE_COND      0x100
175    #endif
176    
177          #define IS_COND         (IS_BIT26_COND | IS_BIT16_COND)  #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
178    #       define IS_MOVABLE       0x004
179    #       define IS_JAL           0x008
180    #       define IS_CALL          0x010
181    #       define IS_BIT26_COND    0x020
182    #       define IS_BIT16_COND    0x040
183    
184          #define PATCH_B         0x40  #       define IS_COND          (IS_BIT26_COND | IS_BIT16_COND)
185          #define PATCH_J         0x80  
186    #       define PATCH_B          0x080
187    #       define PATCH_J          0x100
188    
189    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
190    #       define PATCH_ABS32      0x200
191    #       define PATCH_ABS48      0x400
192    #endif
193    
194          /* instruction types */          /* instruction types */
195          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
196          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
197          /* no destination (i.e: store) */          /* no destination (i.e: store) */
198          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
199          /* FPU status register */          /* FPU status register */
200          #define FCSR_FCC        33  #       define FCSR_FCC         33
201    #endif
202    
203    #if (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
204    #       define IS_JAL           0x04
205    #       define IS_COND          0x08
206    
207    #       define PATCH_B          0x10
208    #       define PATCH_J          0x20
209  #endif  #endif
210    
211  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
212          #define IS_MOVABLE      0x04  #       define IS_MOVABLE       0x04
213          #define IS_COND         0x08  #       define IS_COND          0x08
214          #define IS_CALL         0x10  #       define IS_CALL          0x10
215    
216          #define PATCH_B         0x20  #       define PATCH_B          0x20
217          #define PATCH_CALL      0x40  #       define PATCH_CALL       0x40
218    
219          /* instruction types */          /* instruction types */
220          #define MOVABLE_INS     0  #       define MOVABLE_INS      0
221          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
222          /* no destination (i.e: store) */          /* no destination (i.e: store) */
223          #define UNMOVABLE_INS   32  #       define UNMOVABLE_INS    32
224    
225          #define DST_INS_MASK    0xff  #       define DST_INS_MASK     0xff
226    
227          /* ICC_SET is the same as SET_FLAGS. */          /* ICC_SET is the same as SET_FLAGS. */
228          #define ICC_IS_SET      (1 << 23)  #       define ICC_IS_SET       (1 << 23)
229          #define FCC_IS_SET      (1 << 24)  #       define FCC_IS_SET       (1 << 24)
230  #endif  #endif
231    
232    /* Stack management. */
233    
234    #define GET_SAVED_REGISTERS_SIZE(scratches, saveds, extra) \
235            (((scratches < SLJIT_NUMBER_OF_SCRATCH_REGISTERS ? 0 : (scratches - SLJIT_NUMBER_OF_SCRATCH_REGISTERS)) + \
236                    (saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? saveds : SLJIT_NUMBER_OF_SAVED_REGISTERS) + \
237                    extra) * sizeof(sljit_sw))
238    
239  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
240  #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
241    
242    #if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
243    #define FIXED_LOCALS_OFFSET ((2 + 4) * sizeof(sljit_sw))
244    #else
245    /* Maximum 3 arguments are passed on the stack. */
246    #define FIXED_LOCALS_OFFSET ((3 + 4) * sizeof(sljit_sw))
247  #endif  #endif
248    
249    #endif /* SLJIT_CONFIG_X86_32 */
250    
251  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
252  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
253  #ifdef _WIN64  #ifdef _WIN64
254  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((4 + 2) * sizeof(sljit_sw))
255  #else  #else
256  #define FIXED_LOCALS_OFFSET (sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (sizeof(sljit_sw))
257    #endif
258  #endif  #endif
259    
260    #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
261    #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1
262  #endif  #endif
263    
264  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
265  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
266  #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)  #ifdef _AIX
267  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
268  #else  #else
269  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (3 * sizeof(sljit_sw))
270  #endif  #endif
271  #endif  #endif
272    
273  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
274  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
275  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_sw))
276  #endif  #endif
277    
278  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
279  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
280  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))
281    #endif
282    
283    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
284    #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
285    #define FIXED_LOCALS_OFFSET 0
286  #endif  #endif
287    
288  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
289  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
290  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))
291  #endif  #endif
292    
293  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)
294    
295  #define ADJUST_LOCAL_OFFSET(p, i) \  #define ADJUST_LOCAL_OFFSET(p, i) \
296          if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
297                  (i) += compiler->locals_offset;                  (i) += compiler->locals_offset;
298    
299  #elif (defined SLJIT_HAS_FIXED_LOCALS_OFFSET && SLJIT_HAS_FIXED_LOCALS_OFFSET)  #elif (defined SLJIT_HAS_FIXED_LOCALS_OFFSET && SLJIT_HAS_FIXED_LOCALS_OFFSET)
300    
301  #define ADJUST_LOCAL_OFFSET(p, i) \  #define ADJUST_LOCAL_OFFSET(p, i) \
302          if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
303                  (i) += FIXED_LOCALS_OFFSET;                  (i) += FIXED_LOCALS_OFFSET;
304    
305  #else  #else
# Line 254  Line 319 
319  #include "sljitExecAllocator.c"  #include "sljitExecAllocator.c"
320  #endif  #endif
321    
 #if (defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO) && !(defined SLJIT_SSE2 && SLJIT_SSE2)  
 #error SLJIT_SSE2_AUTO cannot be enabled without SLJIT_SSE2  
 #endif  
   
322  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
323  /*  Public functions                                                     */  /*  Public functions                                                     */
324  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
325    
326  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || ((defined SLJIT_SSE2 && SLJIT_SSE2) && ((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)))  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
327  #define SLJIT_NEEDS_COMPILER_INIT 1  #define SLJIT_NEEDS_COMPILER_INIT 1
328  static int compiler_initialized = 0;  static sljit_si compiler_initialized = 0;
329  /* A thread safe initialization. */  /* A thread safe initialization. */
330  static void init_compiler(void);  static void init_compiler(void);
331  #endif  #endif
# Line 277  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 338  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
338          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));          SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
339    
340          SLJIT_COMPILE_ASSERT(          SLJIT_COMPILE_ASSERT(
341                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1                  sizeof(sljit_sb) == 1 && sizeof(sljit_ub) == 1
342                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2                  && sizeof(sljit_sh) == 2 && sizeof(sljit_uh) == 2
343                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4                  && sizeof(sljit_si) == 4 && sizeof(sljit_ui) == 4
344                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
345                  && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)                  && sizeof(sljit_p) <= sizeof(sljit_sw)
346                    && (sizeof(sljit_sw) == 4 || sizeof(sljit_sw) == 8)
347                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),                  && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
348                  invalid_integer_types);                  invalid_integer_types);
349            SLJIT_COMPILE_ASSERT(SLJIT_INT_OP == SLJIT_SINGLE_OP,
350                    int_op_and_single_op_must_be_the_same);
351            SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP != SLJIT_SINGLE_OP,
352                    rewritable_jump_and_single_op_must_not_be_the_same);
353    
354          /* Only the non-zero members must be set. */          /* Only the non-zero members must be set. */
355          compiler->error = SLJIT_SUCCESS;          compiler->error = SLJIT_SUCCESS;
# Line 305  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 371  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
371          compiler->abuf->next = NULL;          compiler->abuf->next = NULL;
372          compiler->abuf->used_size = 0;          compiler->abuf->used_size = 0;
373    
374          compiler->temporaries = -1;          compiler->scratches = -1;
375          compiler->saveds = -1;          compiler->saveds = -1;
376            compiler->fscratches = -1;
377            compiler->fsaveds = -1;
378    
379  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
380          compiler->args = -1;          compiler->args = -1;
# Line 324  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 392  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
392          compiler->cpool_diff = 0xffffffff;          compiler->cpool_diff = 0xffffffff;
393  #endif  #endif
394    
395  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
396          compiler->delay_slot = UNMOVABLE_INS;          compiler->delay_slot = UNMOVABLE_INS;
397  #endif  #endif
398    
# Line 399  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 467  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
467  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
468  {  {
469          if (SLJIT_LIKELY(!!jump)) {          if (SLJIT_LIKELY(!!jump)) {
                 SLJIT_ASSERT(jump->flags & SLJIT_REWRITABLE_JUMP);  
   
470                  jump->flags &= ~JUMP_LABEL;                  jump->flags &= ~JUMP_LABEL;
471                  jump->flags |= JUMP_ADDR;                  jump->flags |= JUMP_ADDR;
472                  jump->u.target = target;                  jump->u.target = target;
# Line 411  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 477  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
477  /*  Private functions                                                    */  /*  Private functions                                                    */
478  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
479    
480  static void* ensure_buf(struct sljit_compiler *compiler, int size)  static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
481  {  {
482          sljit_ub *ret;          sljit_ub *ret;
483          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
484    
485          if (compiler->buf->used_size + size <= (int)(BUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
486            if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
487                  ret = compiler->buf->memory + compiler->buf->used_size;                  ret = compiler->buf->memory + compiler->buf->used_size;
488                  compiler->buf->used_size += size;                  compiler->buf->used_size += size;
489                  return ret;                  return ret;
# Line 429  static void* ensure_buf(struct sljit_com Line 496  static void* ensure_buf(struct sljit_com
496          return new_frag->memory;          return new_frag->memory;
497  }  }
498    
499  static void* ensure_abuf(struct sljit_compiler *compiler, int size)  static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
500  {  {
501          sljit_ub *ret;          sljit_ub *ret;
502          struct sljit_memory_fragment *new_frag;          struct sljit_memory_fragment *new_frag;
503    
504          if (compiler->abuf->used_size + size <= (int)(ABUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {          SLJIT_ASSERT(size <= 256);
505            if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
506                  ret = compiler->abuf->memory + compiler->abuf->used_size;                  ret = compiler->abuf->memory + compiler->abuf->used_size;
507                  compiler->abuf->used_size += size;                  compiler->abuf->used_size += size;
508                  return ret;                  return ret;
# Line 447  static void* ensure_abuf(struct sljit_co Line 515  static void* ensure_abuf(struct sljit_co
515          return new_frag->memory;          return new_frag->memory;
516  }  }
517    
518  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
519  {  {
520          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
521    
# Line 490  static SLJIT_INLINE void set_label(struc Line 558  static SLJIT_INLINE void set_label(struc
558          compiler->last_label = label;          compiler->last_label = label;
559  }  }
560    
561  static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, int flags)  static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_si flags)
562  {  {
563          jump->next = NULL;          jump->next = NULL;
564          jump->flags = flags;          jump->flags = flags;
# Line 513  static SLJIT_INLINE void set_const(struc Line 581  static SLJIT_INLINE void set_const(struc
581  }  }
582    
583  #define ADDRESSING_DEPENDS_ON(exp, reg) \  #define ADDRESSING_DEPENDS_ON(exp, reg) \
584          (((exp) & SLJIT_MEM) && (((exp) & 0xf) == reg || (((exp) >> 4) & 0xf) == reg))          (((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
585    
586  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
587  #define FUNCTION_CHECK_OP() \  #define FUNCTION_CHECK_OP() \
# Line 527  static SLJIT_INLINE void set_const(struc Line 595  static SLJIT_INLINE void set_const(struc
595          case SLJIT_SHL: \          case SLJIT_SHL: \
596          case SLJIT_LSHR: \          case SLJIT_LSHR: \
597          case SLJIT_ASHR: \          case SLJIT_ASHR: \
598                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))); \
599                  break; \                  break; \
600          case SLJIT_NEG: \          case SLJIT_NEG: \
601                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
602                  break; \                  break; \
603          case SLJIT_MUL: \          case SLJIT_MUL: \
604                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
                 break; \  
         case SLJIT_FCMP: \  
                 SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \  
                 SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \  
605                  break; \                  break; \
606          case SLJIT_ADD: \          case SLJIT_ADD: \
607                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S))); \
608                  break; \                  break; \
609          case SLJIT_SUB: \          case SLJIT_SUB: \
610                  break; \                  break; \
611          case SLJIT_ADDC: \          case SLJIT_ADDC: \
612          case SLJIT_SUBC: \          case SLJIT_SUBC: \
613                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))); \
614                  break; \                  break; \
615          default: \          case SLJIT_BREAKPOINT: \
616            case SLJIT_NOP: \
617            case SLJIT_UMUL: \
618            case SLJIT_SMUL: \
619            case SLJIT_MOV: \
620            case SLJIT_MOV_UI: \
621            case SLJIT_MOV_P: \
622            case SLJIT_MOVU: \
623            case SLJIT_MOVU_UI: \
624            case SLJIT_MOVU_P: \
625                  /* Nothing allowed */ \                  /* Nothing allowed */ \
626                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
627                    break; \
628            default: \
629                    /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
630                    SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
631                    break; \
632            }
633    
634    #define FUNCTION_CHECK_FOP() \
635            SLJIT_ASSERT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
636            switch (GET_OPCODE(op)) { \
637            case SLJIT_CMPD: \
638                    SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
639                    SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
640                    break; \
641            default: \
642                    /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
643                    SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
644                  break; \                  break; \
645          }          }
646    
647  #define FUNCTION_CHECK_IS_REG(r) \  #define FUNCTION_CHECK_IS_REG(r) \
648          ((r) == SLJIT_UNUSED || \          ((r) == SLJIT_UNUSED || \
649          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          ((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
650          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))          ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
651    
652    #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
653    #define FUNCTION_ASSERT_IF_VIRTUAL(p) \
654            SLJIT_ASSERT((p) < SLJIT_R3 || (p) > SLJIT_R6);
655    #else
656    #define FUNCTION_ASSERT_IF_VIRTUAL(p)
657    #endif
658    
659  #define FUNCTION_CHECK_SRC(p, i) \  #define FUNCTION_CHECK_SRC(p, i) \
660          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
661          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
662                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \                  SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \
663          else if ((p) == SLJIT_IMM) \          else if ((p) == SLJIT_IMM) \
664                  ; \                  ; \
665          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
666                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
667          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
668                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
669                  if ((p) & 0xf0) { \                  FUNCTION_ASSERT_IF_VIRTUAL((p) & REG_MASK); \
670                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                  if ((p) & OFFS_REG_MASK) { \
671                            SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
672                            FUNCTION_ASSERT_IF_VIRTUAL(OFFS_REG(p)); \
673                          SLJIT_ASSERT(!((i) & ~0x3)); \                          SLJIT_ASSERT(!((i) & ~0x3)); \
674                  } \                  } \
675                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
676          } \          } \
677          else \          else \
678                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
679    
680  #define FUNCTION_CHECK_DST(p, i) \  #define FUNCTION_CHECK_DST(p, i) \
681          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \          SLJIT_ASSERT(compiler->scratches != -1 && compiler->saveds != -1); \
682          if (FUNCTION_CHECK_IS_REG(p)) \          if (FUNCTION_CHECK_IS_REG(p)) \
683                  SLJIT_ASSERT((i) == 0); \                  SLJIT_ASSERT((i) == 0); \
684          else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \          else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
685                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \                  SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
686          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
687                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
688                  if ((p) & 0xf0) { \                  FUNCTION_ASSERT_IF_VIRTUAL((p) & REG_MASK); \
689                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                  if ((p) & OFFS_REG_MASK) { \
690                            SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
691                            FUNCTION_ASSERT_IF_VIRTUAL(OFFS_REG(p)); \
692                          SLJIT_ASSERT(!((i) & ~0x3)); \                          SLJIT_ASSERT(!((i) & ~0x3)); \
693                  } \                  } \
694                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
695          } \          } \
696          else \          else \
697                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
698    
699  #define FUNCTION_FCHECK(p, i) \  #define FUNCTION_FCHECK(p, i) \
700          if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG4) \          SLJIT_ASSERT(compiler->fscratches != -1 && compiler->fsaveds != -1); \
701            if (((p) >= SLJIT_FR0 && (p) < (SLJIT_FR0 + compiler->fscratches)) || \
702                            ((p) > (SLJIT_FS0 - compiler->fsaveds) && (p) <= SLJIT_FS0)) \
703                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
704            else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
705                    SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
706          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
707                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \                  SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & REG_MASK)); \
708                  if ((p) & 0xf0) { \                  FUNCTION_ASSERT_IF_VIRTUAL((p) & REG_MASK); \
709                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \                  if ((p) & OFFS_REG_MASK) { \
710                          SLJIT_ASSERT(((p) & 0xf0) != (SLJIT_LOCALS_REG << 4) && !(i & ~0x3)); \                          SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
711                            FUNCTION_ASSERT_IF_VIRTUAL(OFFS_REG(p)); \
712                            SLJIT_ASSERT(((p) & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_SP) && !(i & ~0x3)); \
713                  } else \                  } else \
714                          SLJIT_ASSERT((((p) >> 4) & 0xf) == 0); \                          SLJIT_ASSERT(OFFS_REG(p) == 0); \
715                  SLJIT_ASSERT(((p) >> 9) == 0); \                  SLJIT_ASSERT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
716          } \          } \
717          else \          else \
718                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
719    
720  #define FUNCTION_CHECK_OP1() \  #define FUNCTION_CHECK_OP1() \
721          if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) { \          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
722                  SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & REG_MASK) != SLJIT_SP); \
723          } \                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & REG_MASK) != SLJIT_SP); \
724          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \                  if ((src & SLJIT_MEM) && (src & REG_MASK)) \
725                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \                          SLJIT_ASSERT((dst & REG_MASK) != (src & REG_MASK) && OFFS_REG(dst) != (src & REG_MASK)); \
                 SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \  
                 if ((src & SLJIT_MEM) && (src & 0xf)) \  
                         SLJIT_ASSERT((dst & 0xf) != (src & 0xf) && ((dst >> 4) & 0xf) != (src & 0xf)); \  
726          }          }
727    
728  #endif  #endif
# Line 630  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp Line 734  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp
734          compiler->verbose = verbose;          compiler->verbose = verbose;
735  }  }
736    
737  static char* reg_names[] = {  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
         (char*)"<noreg>", (char*)"t1", (char*)"t2", (char*)"t3",  
         (char*)"te1", (char*)"te2", (char*)"s1", (char*)"s2",  
         (char*)"s3", (char*)"se1", (char*)"se2", (char*)"lcr"  
 };  
   
 static char* freg_names[] = {  
         (char*)"<noreg>", (char*)"float_r1", (char*)"float_r2", (char*)"float_r3", (char*)"float_r4"  
 };  
   
 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  
738  #ifdef _WIN64  #ifdef _WIN64
739          #define SLJIT_PRINT_D   "I64"  #       define SLJIT_PRINT_D    "I64"
740  #else  #else
741          #define SLJIT_PRINT_D   "l"  #       define SLJIT_PRINT_D    "l"
742  #endif  #endif
743  #else  #else
744          #define SLJIT_PRINT_D   ""  #       define SLJIT_PRINT_D    ""
745  #endif  #endif
746    
747  #define sljit_verbose_param(p, i) \  #define sljit_verbose_reg(compiler, r) \
748            do { \
749                    if ((r) < (SLJIT_R0 + compiler->scratches)) \
750                            fprintf(compiler->verbose, "r%d", (r) - SLJIT_R0); \
751                    else \
752                            fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - (r)); \
753            } while (0)
754    
755    #define sljit_verbose_param(compiler, p, i) \
756          if ((p) & SLJIT_IMM) \          if ((p) & SLJIT_IMM) \
757                  fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \                  fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
758          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
759                  if ((p) & 0xf) { \                  if ((p) & REG_MASK) { \
760                          if (i) { \                          fputc('[', compiler->verbose); \
761                                  if (((p) >> 4) & 0xf) \                          sljit_verbose_reg(compiler, (p) & REG_MASK); \
762                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \                          if ((p) & OFFS_REG_MASK) { \
763                                  else \                                  fprintf(compiler->verbose, " + "); \
764                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \                                  sljit_verbose_reg(compiler, OFFS_REG(p)); \
765                          } \                                  if (i) \
766                          else { \                                          fprintf(compiler->verbose, " * %d", 1 << (i)); \
                                 if (((p) >> 4) & 0xf) \  
                                         fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \  
                                 else \  
                                         fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \  
767                          } \                          } \
768                            else if (i) \
769                                    fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i)); \
770                            fputc(']', compiler->verbose); \
771                  } \                  } \
772                  else \                  else \
773                          fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \                          fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
774          } else \          } else if (p) \
775                  fprintf(compiler->verbose, "%s", reg_names[p]);                  sljit_verbose_reg(compiler, p); \
776  #define sljit_verbose_fparam(p, i) \          else \
777                    fprintf(compiler->verbose, "unused");
778    
779    #define sljit_verbose_fparam(compiler, p, i) \
780          if ((p) & SLJIT_MEM) { \          if ((p) & SLJIT_MEM) { \
781                  if ((p) & 0xf) { \                  if ((p) & REG_MASK) { \
782                          if (i) { \                          fputc('[', compiler->verbose); \
783                                  if (((p) >> 4) & 0xf) \                          sljit_verbose_reg(compiler, (p) & REG_MASK); \
784                                          fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \                          if ((p) & OFFS_REG_MASK) { \
785                                  else \                                  fprintf(compiler->verbose, " + "); \
786                                          fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \                                  sljit_verbose_reg(compiler, OFFS_REG(p)); \
787                          } \                                  if (i) \
788                          else { \                                          fprintf(compiler->verbose, "%d", 1 << (i)); \
                                 if (((p) >> 4) & 0xF) \  
                                         fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \  
                                 else \  
                                         fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \  
789                          } \                          } \
790                            else if (i) \
791                                    fprintf(compiler->verbose, "%" SLJIT_PRINT_D "d", (i)); \
792                            fputc(']', compiler->verbose); \
793                  } \                  } \
794                  else \                  else \
795                          fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \                          fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
796          } else \          } \
797                  fprintf(compiler->verbose, "%s", freg_names[p]);          else { \
798                    if ((p) < (SLJIT_FR0 + compiler->fscratches)) \
799                            fprintf(compiler->verbose, "fr%d", (p) - SLJIT_FR0); \
800                    else \
801                            fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \
802            }
803    
804  static SLJIT_CONST char* op_names[] = {  static SLJIT_CONST char* op0_names[] = {
         /* op0 */  
805          (char*)"breakpoint", (char*)"nop",          (char*)"breakpoint", (char*)"nop",
806          (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",          (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",
807          /* op1 */  };
808    
809    static SLJIT_CONST char* op1_names[] = {
810          (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",          (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",
811          (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"mov.p",          (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"mov.p",
812          (char*)"movu", (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh",          (char*)"movu", (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh",
813          (char*)"movu.sh", (char*)"movu.ui", (char*)"movu.si", (char*)"movu.p",          (char*)"movu.sh", (char*)"movu.ui", (char*)"movu.si", (char*)"movu.p",
814          (char*)"not", (char*)"neg", (char*)"clz",          (char*)"not", (char*)"neg", (char*)"clz",
815          /* op2 */  };
816    
817    static SLJIT_CONST char* op2_names[] = {
818          (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",          (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
819          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
820          (char*)"shl", (char*)"lshr", (char*)"ashr",          (char*)"shl", (char*)"lshr", (char*)"ashr",
821          /* fop1 */  };
822          (char*)"fcmp", (char*)"fmov", (char*)"fneg", (char*)"fabs",  
823          /* fop2 */  static SLJIT_CONST char* fop1_names[] = {
824          (char*)"fadd", (char*)"fsub", (char*)"fmul", (char*)"fdiv"          (char*)"mov", (char*)"conv", (char*)"conv", (char*)"conv",
825            (char*)"conv", (char*)"conv", (char*)"cmp", (char*)"neg",
826            (char*)"abs",
827    };
828    
829    static SLJIT_CONST char* fop2_names[] = {
830            (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
831  };  };
832    
833  static char* jump_names[] = {  static char* jump_names[] = {
834          (char*)"c_equal", (char*)"c_not_equal",          (char*)"equal", (char*)"not_equal",
835          (char*)"c_less", (char*)"c_greater_equal",          (char*)"less", (char*)"greater_equal",
836          (char*)"c_greater", (char*)"c_less_equal",          (char*)"greater", (char*)"less_equal",
837          (char*)"c_sig_less", (char*)"c_sig_greater_equal",          (char*)"sig_less", (char*)"sig_greater_equal",
838          (char*)"c_sig_greater", (char*)"c_sig_less_equal",          (char*)"sig_greater", (char*)"sig_less_equal",
839          (char*)"c_overflow", (char*)"c_not_overflow",          (char*)"overflow", (char*)"not_overflow",
840          (char*)"c_mul_overflow", (char*)"c_mul_not_overflow",          (char*)"mul_overflow", (char*)"mul_not_overflow",
841          (char*)"c_float_equal", (char*)"c_float_not_equal",          (char*)"float_equal", (char*)"float_not_equal",
842          (char*)"c_float_less", (char*)"c_float_greater_equal",          (char*)"float_less", (char*)"float_greater_equal",
843          (char*)"c_float_greater", (char*)"c_float_less_equal",          (char*)"float_greater", (char*)"float_less_equal",
844          (char*)"c_float_nan", (char*)"c_float_not_nan",          (char*)"float_unordered", (char*)"float_ordered",
845          (char*)"jump", (char*)"fast_call",          (char*)"jump", (char*)"fast_call",
846          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"          (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
847  };  };
# Line 754  static SLJIT_INLINE void check_sljit_gen Line 871  static SLJIT_INLINE void check_sljit_gen
871  #endif  #endif
872  }  }
873    
874  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler,
875            sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
876            sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
877  {  {
878          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
879          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
880            SLJIT_UNUSED_ARG(options);
881          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
882          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
883          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
884            SLJIT_UNUSED_ARG(fscratches);
885            SLJIT_UNUSED_ARG(fsaveds);
886          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
887    
888            SLJIT_ASSERT(options == 0);
889          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
890          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
891          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
892            SLJIT_ASSERT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
893          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
894            SLJIT_ASSERT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
895            SLJIT_ASSERT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
896            SLJIT_ASSERT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
897          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
898  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
899          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
900                  fprintf(compiler->verbose, "  enter args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);                  fprintf(compiler->verbose, "  enter options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
901                            args, scratches, saveds, fscratches, fsaveds, local_size);
902  #endif  #endif
903  }  }
904    
905  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler,
906            sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
907            sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
908  {  {
909          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
910          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
911            SLJIT_UNUSED_ARG(options);
912          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
913          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
914          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
915            SLJIT_UNUSED_ARG(fscratches);
916            SLJIT_UNUSED_ARG(fsaveds);
917          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
918    
919  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
# Line 790  static SLJIT_INLINE void check_sljit_set Line 923  static SLJIT_INLINE void check_sljit_set
923          }          }
924  #endif  #endif
925    
926            SLJIT_ASSERT(options == 0);
927          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
928          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS);
929          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS);
930            SLJIT_ASSERT(scratches + saveds <= SLJIT_NUMBER_OF_REGISTERS);
931          SLJIT_ASSERT(args <= saveds);          SLJIT_ASSERT(args <= saveds);
932            SLJIT_ASSERT(fscratches >= 0 && fscratches <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
933            SLJIT_ASSERT(fsaveds >= 0 && fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
934            SLJIT_ASSERT(fscratches + fsaveds <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
935          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
936  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
937          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
938                  fprintf(compiler->verbose, "  set_context args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);                  fprintf(compiler->verbose, "  set_context options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
939                            args, scratches, saveds, fscratches, fsaveds, local_size);
940  #endif  #endif
941  }  }
942    
943  static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
944  {  {
945          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
946          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 822  static SLJIT_INLINE void check_sljit_emi Line 961  static SLJIT_INLINE void check_sljit_emi
961                  if (op == SLJIT_UNUSED)                  if (op == SLJIT_UNUSED)
962                          fprintf(compiler->verbose, "  return\n");                          fprintf(compiler->verbose, "  return\n");
963                  else {                  else {
964                          fprintf(compiler->verbose, "  return %s ", op_names[op]);                          fprintf(compiler->verbose, "  return.%s ", op1_names[op - SLJIT_OP1_BASE]);
965                          sljit_verbose_param(src, srcw);                          sljit_verbose_param(compiler, src, srcw);
966                          fprintf(compiler->verbose, "\n");                          fprintf(compiler->verbose, "\n");
967                  }                  }
968          }          }
969  #endif  #endif
970  }  }
971    
972  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw)  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
973  {  {
974          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
975          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 843  static SLJIT_INLINE void check_sljit_emi Line 982  static SLJIT_INLINE void check_sljit_emi
982  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
983          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
984                  fprintf(compiler->verbose, "  fast_enter ");                  fprintf(compiler->verbose, "  fast_enter ");
985                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(compiler, dst, dstw);
986                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
987          }          }
988  #endif  #endif
989  }  }
990    
991  static SLJIT_INLINE void check_sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
992  {  {
993          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
994          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 862  static SLJIT_INLINE void check_sljit_emi Line 1001  static SLJIT_INLINE void check_sljit_emi
1001  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1002          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1003                  fprintf(compiler->verbose, "  fast_return ");                  fprintf(compiler->verbose, "  fast_return ");
1004                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(compiler, src, srcw);
1005                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1006          }          }
1007  #endif  #endif
1008  }  }
1009    
1010  static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, int op)  static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
1011  {  {
1012          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1013          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 876  static SLJIT_INLINE void check_sljit_emi Line 1015  static SLJIT_INLINE void check_sljit_emi
1015    
1016          SLJIT_ASSERT((op >= SLJIT_BREAKPOINT && op <= SLJIT_SMUL)          SLJIT_ASSERT((op >= SLJIT_BREAKPOINT && op <= SLJIT_SMUL)
1017                  || ((op & ~SLJIT_INT_OP) >= SLJIT_UDIV && (op & ~SLJIT_INT_OP) <= SLJIT_SDIV));                  || ((op & ~SLJIT_INT_OP) >= SLJIT_UDIV && (op & ~SLJIT_INT_OP) <= SLJIT_SDIV));
1018            SLJIT_ASSERT(op < SLJIT_UMUL || compiler->scratches >= 2);
1019  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1020          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
1021                  fprintf(compiler->verbose, "  %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)]);                  fprintf(compiler->verbose, "  %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]);
1022  #endif  #endif
1023  }  }
1024    
1025  static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
1026          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1027          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1028  {  {
1029          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1030          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 910  static SLJIT_INLINE void check_sljit_emi Line 1050  static SLJIT_INLINE void check_sljit_emi
1050  #endif  #endif
1051  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1052          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1053                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE],
1054                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
1055                  sljit_verbose_param(dst, dstw);                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1056                    sljit_verbose_param(compiler, dst, dstw);
1057                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1058                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(compiler, src, srcw);
1059                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1060          }          }
1061  #endif  #endif
1062  }  }
1063    
1064  static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
1065          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1066          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1067          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1068  {  {
1069          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1070          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 951  static SLJIT_INLINE void check_sljit_emi Line 1092  static SLJIT_INLINE void check_sljit_emi
1092  #endif  #endif
1093  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1094          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1095                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE],
1096                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
1097                  sljit_verbose_param(dst, dstw);                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1098                    sljit_verbose_param(compiler, dst, dstw);
1099                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1100                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(compiler, src1, src1w);
1101                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1102                  sljit_verbose_param(src2, src2w);                  sljit_verbose_param(compiler, src2, src2w);
1103                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1104          }          }
1105  #endif  #endif
1106  }  }
1107    
1108  static SLJIT_INLINE void check_sljit_get_register_index(int reg)  static SLJIT_INLINE void check_sljit_get_register_index(sljit_si reg)
1109  {  {
1110          SLJIT_UNUSED_ARG(reg);          SLJIT_UNUSED_ARG(reg);
1111          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);          SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NUMBER_OF_REGISTERS);
1112    }
1113    
1114    static SLJIT_INLINE void check_sljit_get_float_register_index(sljit_si reg)
1115    {
1116            SLJIT_UNUSED_ARG(reg);
1117            SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NUMBER_OF_FLOAT_REGISTERS);
1118  }  }
1119    
1120  static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compiler,  static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compiler,
1121          void *instruction, int size)          void *instruction, sljit_si size)
1122  {  {
1123          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1124          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 978  static SLJIT_INLINE void check_sljit_emi Line 1126  static SLJIT_INLINE void check_sljit_emi
1126          SLJIT_ASSERT(instruction);          SLJIT_ASSERT(instruction);
1127  }  }
1128    
1129  static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, int op,  #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
1130          int dst, sljit_w dstw,          SLJIT_ASSERT(sljit_is_fpu_available()); \
1131          int src, sljit_w srcw)          SLJIT_COMPILE_ASSERT(!(SLJIT_CONVW_FROMD & 0x1) && !(SLJIT_CONVD_FROMW & 0x1), \
1132                    invalid_float_opcodes); \
1133            if (GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_CMPD) { \
1134                    if (GET_OPCODE(op) == SLJIT_CMPD) { \
1135                            check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
1136                            ADJUST_LOCAL_OFFSET(dst, dstw); \
1137                            ADJUST_LOCAL_OFFSET(src, srcw); \
1138                            return sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
1139                    } \
1140                    if ((GET_OPCODE(op) | 0x1) == SLJIT_CONVI_FROMD) { \
1141                            check_sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw); \
1142                            ADJUST_LOCAL_OFFSET(dst, dstw); \
1143                            ADJUST_LOCAL_OFFSET(src, srcw); \
1144                            return sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw); \
1145                    } \
1146                    check_sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw); \
1147                    ADJUST_LOCAL_OFFSET(dst, dstw); \
1148                    ADJUST_LOCAL_OFFSET(src, srcw); \
1149                    return sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw); \
1150            } \
1151            check_sljit_emit_fop1(compiler, op, dst, dstw, src, srcw); \
1152            ADJUST_LOCAL_OFFSET(dst, dstw); \
1153            ADJUST_LOCAL_OFFSET(src, srcw);
1154    
1155    static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
1156            sljit_si dst, sljit_sw dstw,
1157            sljit_si src, sljit_sw srcw)
1158  {  {
1159          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1160          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 997  static SLJIT_INLINE void check_sljit_emi Line 1171  static SLJIT_INLINE void check_sljit_emi
1171          }          }
1172  #endif  #endif
1173    
1174          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_MOVD && GET_OPCODE(op) <= SLJIT_ABSD);
         SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FCMP && GET_OPCODE(op) <= SLJIT_FABS);  
1175  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1176          FUNCTION_CHECK_OP();          FUNCTION_CHECK_FOP();
1177          FUNCTION_FCHECK(src, srcw);          FUNCTION_FCHECK(src, srcw);
1178          FUNCTION_FCHECK(dst, dstw);          FUNCTION_FCHECK(dst, dstw);
1179  #endif  #endif
1180  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1181          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1182                  fprintf(compiler->verbose, "  %s%s%s ", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1183                          !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S");                          (GET_OPCODE(op) == SLJIT_CONVD_FROMS)
1184                  sljit_verbose_fparam(dst, dstw);                          ? ((op & SLJIT_SINGLE_OP) ? "s.fromd" : "d.froms")
1185                            : ((op & SLJIT_SINGLE_OP) ? "s" : "d"));
1186                    sljit_verbose_fparam(compiler, dst, dstw);
1187                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1188                  sljit_verbose_fparam(src, srcw);                  sljit_verbose_fparam(compiler, src, srcw);
1189                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1190          }          }
1191  #endif  #endif
1192  }  }
1193    
1194  static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, int op,  static SLJIT_INLINE void check_sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_si op,
1195          int dst, sljit_w dstw,          sljit_si src1, sljit_sw src1w,
1196          int src1, sljit_w src1w,          sljit_si src2, sljit_sw src2w)
1197          int src2, sljit_w src2w)  {
1198            /* If debug and verbose are disabled, all arguments are unused. */
1199            SLJIT_UNUSED_ARG(compiler);
1200            SLJIT_UNUSED_ARG(op);
1201            SLJIT_UNUSED_ARG(src1);
1202            SLJIT_UNUSED_ARG(src1w);
1203            SLJIT_UNUSED_ARG(src2);
1204            SLJIT_UNUSED_ARG(src2w);
1205    
1206    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1207            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1208                    compiler->skip_checks = 0;
1209                    return;
1210            }
1211    #endif
1212    
1213            SLJIT_ASSERT(GET_OPCODE(op) == SLJIT_CMPD);
1214    #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1215            FUNCTION_CHECK_FOP();
1216            FUNCTION_FCHECK(src1, src1w);
1217            FUNCTION_FCHECK(src2, src2w);
1218    #endif
1219    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1220            if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1221                    fprintf(compiler->verbose, "  %s%s%s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE], (op & SLJIT_SINGLE_OP) ? "s" : "d",
1222                            !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s");
1223                    sljit_verbose_fparam(compiler, src1, src1w);
1224                    fprintf(compiler->verbose, ", ");
1225                    sljit_verbose_fparam(compiler, src2, src2w);
1226                    fprintf(compiler->verbose, "\n");
1227            }
1228    #endif
1229    }
1230    
1231    static SLJIT_INLINE void check_sljit_emit_fop1_convw_fromd(struct sljit_compiler *compiler, sljit_si op,
1232            sljit_si dst, sljit_sw dstw,
1233            sljit_si src, sljit_sw srcw)
1234    {
1235            /* If debug and verbose are disabled, all arguments are unused. */
1236            SLJIT_UNUSED_ARG(compiler);
1237            SLJIT_UNUSED_ARG(op);
1238            SLJIT_UNUSED_ARG(dst);
1239            SLJIT_UNUSED_ARG(dstw);
1240            SLJIT_UNUSED_ARG(src);
1241            SLJIT_UNUSED_ARG(srcw);
1242    
1243    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1244            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1245                    compiler->skip_checks = 0;
1246                    return;
1247            }
1248    #endif
1249    
1250            SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_CONVI_FROMD);
1251    #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1252            FUNCTION_CHECK_FOP();
1253            FUNCTION_FCHECK(src, srcw);
1254            FUNCTION_CHECK_DST(dst, dstw);
1255    #endif
1256    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1257            if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1258                    fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1259                            (GET_OPCODE(op) == SLJIT_CONVI_FROMD) ? "i" : "w",
1260                            (op & SLJIT_SINGLE_OP) ? "s" : "d");
1261                    sljit_verbose_param(compiler, dst, dstw);
1262                    fprintf(compiler->verbose, ", ");
1263                    sljit_verbose_fparam(compiler, src, srcw);
1264                    fprintf(compiler->verbose, "\n");
1265            }
1266    #endif
1267    }
1268    
1269    static SLJIT_INLINE void check_sljit_emit_fop1_convd_fromw(struct sljit_compiler *compiler, sljit_si op,
1270            sljit_si dst, sljit_sw dstw,
1271            sljit_si src, sljit_sw srcw)
1272    {
1273            /* If debug and verbose are disabled, all arguments are unused. */
1274            SLJIT_UNUSED_ARG(compiler);
1275            SLJIT_UNUSED_ARG(op);
1276            SLJIT_UNUSED_ARG(dst);
1277            SLJIT_UNUSED_ARG(dstw);
1278            SLJIT_UNUSED_ARG(src);
1279            SLJIT_UNUSED_ARG(srcw);
1280    
1281    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1282            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1283                    compiler->skip_checks = 0;
1284                    return;
1285            }
1286    #endif
1287    
1288            SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_CONVD_FROMW && GET_OPCODE(op) <= SLJIT_CONVD_FROMI);
1289    #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1290            FUNCTION_CHECK_FOP();
1291            FUNCTION_CHECK_SRC(src, srcw);
1292            FUNCTION_FCHECK(dst, dstw);
1293    #endif
1294    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1295            if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1296                    fprintf(compiler->verbose, "  %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1297                            (op & SLJIT_SINGLE_OP) ? "s" : "d",
1298                            (GET_OPCODE(op) == SLJIT_CONVD_FROMI) ? "i" : "w");
1299                    sljit_verbose_fparam(compiler, dst, dstw);
1300                    fprintf(compiler->verbose, ", ");
1301                    sljit_verbose_param(compiler, src, srcw);
1302                    fprintf(compiler->verbose, "\n");
1303            }
1304    #endif
1305    }
1306    
1307    static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
1308            sljit_si dst, sljit_sw dstw,
1309            sljit_si src1, sljit_sw src1w,
1310            sljit_si src2, sljit_sw src2w)
1311  {  {
1312          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1313          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1032  static SLJIT_INLINE void check_sljit_emi Line 1320  static SLJIT_INLINE void check_sljit_emi
1320          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1321    
1322          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1323          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FADD && GET_OPCODE(op) <= SLJIT_FDIV);          SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_ADDD && GET_OPCODE(op) <= SLJIT_DIVD);
1324  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1325          FUNCTION_CHECK_OP();          FUNCTION_CHECK_FOP();
1326          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
1327          FUNCTION_FCHECK(src2, src2w);          FUNCTION_FCHECK(src2, src2w);
1328          FUNCTION_FCHECK(dst, dstw);          FUNCTION_FCHECK(dst, dstw);
1329  #endif  #endif
1330  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1331          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1332                  fprintf(compiler->verbose, "  %s ", op_names[GET_OPCODE(op)]);                  fprintf(compiler->verbose, "  %s%s ", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE], (op & SLJIT_SINGLE_OP) ? "s" : "d");
1333                  sljit_verbose_fparam(dst, dstw);                  sljit_verbose_fparam(compiler, dst, dstw);
1334                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1335                  sljit_verbose_fparam(src1, src1w);                  sljit_verbose_fparam(compiler, src1, src1w);
1336                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1337                  sljit_verbose_fparam(src2, src2w);                  sljit_verbose_fparam(compiler, src2, src2w);
1338                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1339          }          }
1340  #endif  #endif
# Line 1063  static SLJIT_INLINE void check_sljit_emi Line 1351  static SLJIT_INLINE void check_sljit_emi
1351  #endif  #endif
1352  }  }
1353    
1354  static SLJIT_INLINE void check_sljit_emit_jump(struct sljit_compiler *compiler, int type)  static SLJIT_INLINE void check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
1355  {  {
1356          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1357          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1080  static SLJIT_INLINE void check_sljit_emi Line 1368  static SLJIT_INLINE void check_sljit_emi
1368          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);
1369  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1370          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
1371                  fprintf(compiler->verbose, "  jump%s <%s>\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  jump%s.%s\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1372  #endif  #endif
1373  }  }
1374    
1375  static SLJIT_INLINE void check_sljit_emit_cmp(struct sljit_compiler *compiler, int type,  static SLJIT_INLINE void check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1376          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1377          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1378  {  {
1379          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1380          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1095  static SLJIT_INLINE void check_sljit_emi Line 1383  static SLJIT_INLINE void check_sljit_emi
1383          SLJIT_UNUSED_ARG(src2);          SLJIT_UNUSED_ARG(src2);
1384          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1385    
1386          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_INT_OP)));
1387          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_C_SIG_LESS_EQUAL);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_C_SIG_LESS_EQUAL);
1388  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1389          FUNCTION_CHECK_SRC(src1, src1w);          FUNCTION_CHECK_SRC(src1, src1w);
# Line 1103  static SLJIT_INLINE void check_sljit_emi Line 1391  static SLJIT_INLINE void check_sljit_emi
1391  #endif  #endif
1392  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1393          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1394                  fprintf(compiler->verbose, "  %scmp%s <%s> ", !(type & SLJIT_INT_OP) ? "" : "i", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  %scmp%s.%s ", !(type & SLJIT_INT_OP) ? "" : "i", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1395                  sljit_verbose_param(src1, src1w);                  sljit_verbose_param(compiler, src1, src1w);
1396                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1397                  sljit_verbose_param(src2, src2w);                  sljit_verbose_param(compiler, src2, src2w);
1398                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1399          }          }
1400  #endif  #endif
1401  }  }
1402    
1403  static SLJIT_INLINE void check_sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  static SLJIT_INLINE void check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1404          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1405          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1406  {  {
1407          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1408          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1124  static SLJIT_INLINE void check_sljit_emi Line 1412  static SLJIT_INLINE void check_sljit_emi
1412          SLJIT_UNUSED_ARG(src2w);          SLJIT_UNUSED_ARG(src2w);
1413    
1414          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1415          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP | SLJIT_SINGLE_OP)));
1416          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);
1417  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1418          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
# Line 1132  static SLJIT_INLINE void check_sljit_emi Line 1420  static SLJIT_INLINE void check_sljit_emi
1420  #endif  #endif
1421  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1422          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1423                  fprintf(compiler->verbose, "  fcmp%s <%s> ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);                  fprintf(compiler->verbose, "  %scmp%s.%s ", (type & SLJIT_SINGLE_OP) ? "s" : "d",
1424                  sljit_verbose_fparam(src1, src1w);                          !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r", jump_names[type & 0xff]);
1425                    sljit_verbose_fparam(compiler, src1, src1w);
1426                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
1427                  sljit_verbose_fparam(src2, src2w);                  sljit_verbose_fparam(compiler, src2, src2w);
1428                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1429          }          }
1430  #endif  #endif
1431  }  }
1432    
1433  static SLJIT_INLINE void check_sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)  static SLJIT_INLINE void check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
1434  {  {
1435          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1436          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1149  static SLJIT_INLINE void check_sljit_emi Line 1438  static SLJIT_INLINE void check_sljit_emi
1438          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
1439          SLJIT_UNUSED_ARG(srcw);          SLJIT_UNUSED_ARG(srcw);
1440    
1441    #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1442            if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1443                    compiler->skip_checks = 0;
1444                    return;
1445            }
1446    #endif
1447    
1448          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);          SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
1449  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1450          FUNCTION_CHECK_SRC(src, srcw);          FUNCTION_CHECK_SRC(src, srcw);
1451  #endif  #endif
1452  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1453          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1454                  fprintf(compiler->verbose, "  ijump <%s> ", jump_names[type]);                  fprintf(compiler->verbose, "  ijump.%s ", jump_names[type]);
1455                  sljit_verbose_param(src, srcw);                  sljit_verbose_param(compiler, src, srcw);
1456                  fprintf(compiler->verbose, "\n");                  fprintf(compiler->verbose, "\n");
1457          }          }
1458  #endif  #endif
1459  }  }
1460    
1461  static SLJIT_INLINE void check_sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)  static SLJIT_INLINE void check_sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
1462            sljit_si dst, sljit_sw dstw,
1463            sljit_si src, sljit_sw srcw,
1464            sljit_si type)
1465  {  {
1466          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1467          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1468          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
1469          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1470          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1471            SLJIT_UNUSED_ARG(src);
1472            SLJIT_UNUSED_ARG(srcw);
1473          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
1474    
1475          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1476          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_OR);          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_UI || GET_OPCODE(op) == SLJIT_MOV_SI
1477          SLJIT_ASSERT(GET_ALL_FLAGS(op) == 0 || GET_ALL_FLAGS(op) == SLJIT_SET_E || GET_ALL_FLAGS(op) == SLJIT_KEEP_FLAGS);                  || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
1478            SLJIT_ASSERT((op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C)) == 0);
1479            SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
1480  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1481            if (GET_OPCODE(op) < SLJIT_ADD) {
1482                    SLJIT_ASSERT(src == SLJIT_UNUSED && srcw == 0);
1483            } else {
1484                    SLJIT_ASSERT(src == dst && srcw == dstw);
1485            }
1486          FUNCTION_CHECK_DST(dst, dstw);          FUNCTION_CHECK_DST(dst, dstw);
1487  #endif  #endif
1488  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1489          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1490                  fprintf(compiler->verbose, "  cond_set%s%s <%s> ", !(op & SLJIT_SET_E) ? "" : "E",                  fprintf(compiler->verbose, "  %sflags.%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i",
1491                          !(op & SLJIT_KEEP_FLAGS) ? "" : "K", op_names[GET_OPCODE(op)]);                          GET_OPCODE(op) >= SLJIT_OP2_BASE ? op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE] : op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE],
1492                  sljit_verbose_param(dst, dstw);                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1493                  fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);                  sljit_verbose_param(compiler, dst, dstw);
1494                    if (src != SLJIT_UNUSED) {
1495                            fprintf(compiler->verbose, ", ");
1496                            sljit_verbose_param(compiler, src, srcw);
1497                    }
1498                    fprintf(compiler->verbose, ", %s\n", jump_names[type]);
1499          }          }
1500  #endif  #endif
1501  }  }
1502    
1503  static SLJIT_INLINE void check_sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  static SLJIT_INLINE void check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
1504  {  {
1505          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1506          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1200  static SLJIT_INLINE void check_sljit_get Line 1513  static SLJIT_INLINE void check_sljit_get
1513  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1514          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1515                  fprintf(compiler->verbose, "  local_base ");                  fprintf(compiler->verbose, "  local_base ");
1516                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(compiler, dst, dstw);
1517                  fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", offset);                  fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", offset);
1518          }          }
1519  #endif  #endif
1520  }  }
1521    
1522  static SLJIT_INLINE void check_sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w init_value)  static SLJIT_INLINE void check_sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value)
1523  {  {
1524          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
1525          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 1220  static SLJIT_INLINE void check_sljit_emi Line 1533  static SLJIT_INLINE void check_sljit_emi
1533  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1534          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1535                  fprintf(compiler->verbose, "  const ");                  fprintf(compiler->verbose, "  const ");
1536                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(compiler, dst, dstw);
1537                  fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", init_value);                  fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", init_value);
1538          }          }
1539  #endif  #endif
1540  }  }
1541    
1542  static SLJIT_INLINE int emit_mov_before_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  static SLJIT_INLINE sljit_si emit_mov_before_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
1543  {  {
1544          /* Return if don't need to do anything. */          /* Return if don't need to do anything. */
1545          if (op == SLJIT_UNUSED)          if (op == SLJIT_UNUSED)
1546                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1547    
1548  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1549          /* At the moment the pointer size is always equal to sljit_w. May be changed in the future. */          /* At the moment the pointer size is always equal to sljit_sw. May be changed in the future. */
1550          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
1551                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1552  #else  #else
# Line 1273  static SLJIT_INLINE int emit_mov_before_ Line 1586  static SLJIT_INLINE int emit_mov_before_
1586    
1587  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3  #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1588    
1589  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
1590          #include "sljitNativeX86_common.c"  #       include "sljitNativeX86_common.c"
 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  
         #include "sljitNativeX86_common.c"  
1591  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1592          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_32.c"
1593  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)  #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1594          #include "sljitNativeARM_v5.c"  #       include "sljitNativeARM_32.c"
1595  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1596          #include "sljitNativeARM_Thumb2.c"  #       include "sljitNativeARM_T2_32.c"
1597  #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1598          #include "sljitNativePPC_common.c"  #       include "sljitNativeARM_64.c"
1599  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
1600          #include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1601  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
1602          #include "sljitNativeMIPS_common.c"  #       include "sljitNativeMIPS_common.c"
1603  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #elif (defined SLJIT_CONFIG_SPARC && SLJIT_CONFIG_SPARC)
1604          #include "sljitNativeSPARC_common.c"  #       include "sljitNativeSPARC_common.c"
1605  #endif  #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
1606    #       include "sljitNativeTILEGX_64.c"
1607  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #endif
1608    
1609  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,  #if !(defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
1610          int src1, sljit_w src1w,  
1611          int src2, sljit_w src2w)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1612            sljit_si src1, sljit_sw src1w,
1613            sljit_si src2, sljit_sw src2w)
1614  {  {
1615          /* Default compare for most architectures. */          /* Default compare for most architectures. */
1616          int flags, tmp_src, condition;          sljit_si flags, tmp_src, condition;
1617          sljit_w tmp_srcw;          sljit_sw tmp_srcw;
1618    
1619          CHECK_ERROR_PTR();          CHECK_ERROR_PTR();
1620          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);
1621    
1622          condition = type & 0xff;          condition = type & 0xff;
1623    #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1624            if ((condition == SLJIT_C_EQUAL || condition == SLJIT_C_NOT_EQUAL)) {
1625                    if ((src1 & SLJIT_IMM) && !src1w) {
1626                            src1 = src2;
1627                            src1w = src2w;
1628                            src2 = SLJIT_IMM;
1629                            src2w = 0;
1630                    }
1631                    if ((src2 & SLJIT_IMM) && !src2w)
1632                            return emit_cmp_to0(compiler, type, src1, src1w);
1633            }
1634    #endif
1635    
1636          if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {          if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {
1637                  /* Immediate is prefered as second argument by most architectures. */                  /* Immediate is prefered as second argument by most architectures. */
1638                  switch (condition) {                  switch (condition) {
# Line 1362  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1688  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1688          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));          return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1689  }  }
1690    
1691  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1692          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1693          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1694  {  {
1695          int flags, condition;          sljit_si flags, condition;
1696    
1697          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);          check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1698    
1699          condition = type & 0xff;          condition = type & 0xff;
1700          if (condition <= SLJIT_C_FLOAT_NOT_EQUAL)          flags = (condition <= SLJIT_C_FLOAT_NOT_EQUAL) ? SLJIT_SET_E : SLJIT_SET_S;
1701                  flags = SLJIT_SET_E;          if (type & SLJIT_SINGLE_OP)
1702          else                  flags |= SLJIT_SINGLE_OP;
                 flags = SLJIT_SET_S;  
1703    
1704  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1705          compiler->skip_checks = 1;          compiler->skip_checks = 1;
1706  #endif  #endif
1707          sljit_emit_fop1(compiler, SLJIT_FCMP | flags, src1, src1w, src2, src2w);          sljit_emit_fop1(compiler, SLJIT_CMPD | flags, src1, src1w, src2, src2w);
1708    
1709  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1710          compiler->skip_checks = 1;          compiler->skip_checks = 1;
# Line 1389  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1714  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1714    
1715  #endif  #endif
1716    
1717  #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
1718    
1719  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
1720  {  {
1721          CHECK_ERROR();          CHECK_ERROR();
1722          check_sljit_get_local_base(compiler, dst, dstw, offset);          check_sljit_get_local_base(compiler, dst, dstw, offset);
1723    
1724          ADJUST_LOCAL_OFFSET(SLJIT_MEM1(SLJIT_LOCALS_REG), offset);          ADJUST_LOCAL_OFFSET(SLJIT_MEM1(SLJIT_SP), offset);
1725  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1726          compiler->skip_checks = 1;          compiler->skip_checks = 1;
1727  #endif  #endif
1728          if (offset != 0)          if (offset != 0)
1729                  return sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_LOCALS_REG, 0, SLJIT_IMM, offset);                  return sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
1730          return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_LOCALS_REG, 0);          return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_SP, 0);
1731  }  }
1732    
1733  #endif  #endif
# Line 1428  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1753  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1753          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1754  }  }
1755    
1756  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)  SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_si size)
1757  {  {
1758          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1759          SLJIT_UNUSED_ARG(size);          SLJIT_UNUSED_ARG(size);
# Line 1458  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1783  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1783          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1784  }  }
1785    
1786  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
1787            sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
1788            sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
1789  {  {
1790          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1791            SLJIT_UNUSED_ARG(options);
1792          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1793          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1794          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1795            SLJIT_UNUSED_ARG(fscratches);
1796            SLJIT_UNUSED_ARG(fsaveds);
1797          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1798          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1799          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1800  }  }
1801    
1802  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,
1803            sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds,
1804            sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
1805  {  {
1806          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1807            SLJIT_UNUSED_ARG(options);
1808          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1809          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(scratches);
1810          SLJIT_UNUSED_ARG(saveds);          SLJIT_UNUSED_ARG(saveds);
1811            SLJIT_UNUSED_ARG(fscratches);
1812            SLJIT_UNUSED_ARG(fsaveds);
1813          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1814          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1815  }  }
1816    
1817  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)
1818  {  {
1819          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1820          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1489  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1824  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1824          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1825  }  }
1826    
1827  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw)
1828  {  {
1829          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1830          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1831          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
         SLJIT_UNUSED_ARG(args);  
         SLJIT_UNUSED_ARG(temporaries);  
         SLJIT_UNUSED_ARG(saveds);  
         SLJIT_UNUSED_ARG(local_size);  
1832          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1833          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1834  }  }
1835    
1836  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_si src, sljit_sw srcw)
1837  {  {
1838          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1839          SLJIT_UNUSED_ARG(src);          SLJIT_UNUSED_ARG(src);
# Line 1511  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1842  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1842          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1843  }  }
1844    
1845  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op)
1846  {  {
1847          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1848          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1519  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1850  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1850          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1851  }  }
1852    
1853  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op,
1854          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1855          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1856  {  {
1857          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1858          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1533  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1864  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1864          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1865  }  }
1866    
1867  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op,
1868          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1869          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1870          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1871  {  {
1872          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1873          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1550  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1881  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1881          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1882  }  }
1883    
1884  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
1885  {  {
1886          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1887          return reg;          return reg;
1888  }  }
1889    
1890  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op_custom(struct sljit_compiler *compiler,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
1891          void *instruction, int size)          void *instruction, sljit_si size)
1892  {  {
1893          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1894          SLJIT_UNUSED_ARG(instruction);          SLJIT_UNUSED_ARG(instruction);
# Line 1566  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1897  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1897          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1898  }  }
1899    
1900  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void)
1901  {  {
1902          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1903          return 0;          return 0;
1904  }  }
1905    
1906  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
1907          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1908          int src, sljit_w srcw)          sljit_si src, sljit_sw srcw)
1909  {  {
1910          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1911          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1586  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1917  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1917          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1918  }  }
1919    
1920  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
1921          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
1922          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1923          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1924  {  {
1925          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1926          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
# Line 1610  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la Line 1941  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la
1941          return NULL;          return NULL;
1942  }  }
1943    
1944  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, int type)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_si type)
1945  {  {
1946          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1947          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1618  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1949  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1949          return NULL;          return NULL;
1950  }  }
1951    
1952  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1953          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1954          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1955  {  {
1956          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1957          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1632  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 1963  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
1963          return NULL;          return NULL;
1964  }  }
1965    
1966  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_si type,
1967          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
1968          int src2, sljit_w src2w)          sljit_si src2, sljit_sw src2w)
1969  {  {
1970          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1971          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1660  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 1991  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
1991          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1992  }  }
1993    
1994  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_ijump(struct sljit_compiler *compiler, sljit_si type, sljit_si src, sljit_sw srcw)
1995  {  {
1996          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1997          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
# Line 1670  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 2001  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
2001          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
2002  }  }
2003    
2004  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_si op,
2005            sljit_si dst, sljit_sw dstw,
2006            sljit_si src, sljit_sw srcw,
2007            sljit_si type)
2008  {  {
2009          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
2010          SLJIT_UNUSED_ARG(op);          SLJIT_UNUSED_ARG(op);
2011          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
2012          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
2013            SLJIT_UNUSED_ARG(src);
2014            SLJIT_UNUSED_ARG(srcw);
2015          SLJIT_UNUSED_ARG(type);          SLJIT_UNUSED_ARG(type);
2016          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
2017          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
2018  }  }
2019    
2020  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_local_base(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw offset)
2021  {  {
2022          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
2023          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1691  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l Line 2027  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l
2027          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
2028  }  }
2029    
2030  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w initval)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw initval)
2031  {  {
2032          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
2033          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
# Line 1708  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 2044  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
2044          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
2045  }  }
2046    
2047  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_constant)
2048  {  {
2049          SLJIT_UNUSED_ARG(addr);          SLJIT_UNUSED_ARG(addr);
2050          SLJIT_UNUSED_ARG(new_constant);          SLJIT_UNUSED_ARG(new_constant);

Legend:
Removed from v.1182  
changed lines
  Added in v.1499

  ViewVC Help
Powered by ViewVC 1.1.5