2 * Stack-less Just-In-Time compiler
4 * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
6 * Redistribution and use in source and binary forms, with or without modification, are
7 * permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice, this list of
10 * conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 * of conditions and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #define CHECK_ERROR() \
31 if (SLJIT_UNLIKELY(compiler->error)) \
32 return compiler->error; \
35 #define CHECK_ERROR_PTR() \
37 if (SLJIT_UNLIKELY(compiler->error)) \
41 #define FAIL_IF(expr) \
43 if (SLJIT_UNLIKELY(expr)) \
44 return compiler->error; \
47 #define PTR_FAIL_IF(expr) \
49 if (SLJIT_UNLIKELY(expr)) \
53 #define FAIL_IF_NULL(ptr) \
55 if (SLJIT_UNLIKELY(!(ptr))) { \
56 compiler->error = SLJIT_ERR_ALLOC_FAILED; \
57 return SLJIT_ERR_ALLOC_FAILED; \
61 #define PTR_FAIL_IF_NULL(ptr) \
63 if (SLJIT_UNLIKELY(!(ptr))) { \
64 compiler->error = SLJIT_ERR_ALLOC_FAILED; \
69 #define PTR_FAIL_WITH_EXEC_IF(ptr) \
71 if (SLJIT_UNLIKELY(!(ptr))) { \
72 compiler->error = SLJIT_ERR_EX_ALLOC_FAILED; \
77 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
79 #define GET_OPCODE(op) \
80 ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
82 #define GET_FLAGS(op) \
83 ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))
85 #define GET_ALL_FLAGS(op) \
86 ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
88 #define TYPE_CAST_NEEDED(op) \
89 (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))
93 #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
94 #define ABUF_SIZE 2048
96 #define ABUF_SIZE 4096
99 /* Parameter parsing. */
100 #define REG_MASK 0x3f
101 #define OFFS_REG(reg) (((reg) >> 8) & REG_MASK)
102 #define OFFS_REG_MASK (REG_MASK << 8)
103 #define TO_OFFS_REG(reg) ((reg) << 8)
104 /* When reg cannot be unused. */
105 #define FAST_IS_REG(reg) ((reg) <= REG_MASK)
106 /* When reg can be unused. */
107 #define SLOW_IS_REG(reg) ((reg) > 0 && (reg) <= REG_MASK)
110 #define JUMP_LABEL 0x1
111 #define JUMP_ADDR 0x2
112 /* SLJIT_REWRITABLE_JUMP is 0x1000. */
114 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
115 # define PATCH_MB 0x4
116 # define PATCH_MW 0x8
117 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
118 # define PATCH_MD 0x10
122 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
127 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
128 # define CPOOL_SIZE 512
131 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
132 # define IS_COND 0x04
134 /* conditional + imm8 */
135 # define PATCH_TYPE1 0x10
136 /* conditional + imm20 */
137 # define PATCH_TYPE2 0x20
139 # define PATCH_TYPE3 0x30
141 # define PATCH_TYPE4 0x40
143 # define PATCH_TYPE5 0x50
145 # define PATCH_BL 0x60
146 /* 0xf00 cc code for branches */
149 #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
150 # define IS_COND 0x004
151 # define IS_CBZ 0x008
153 # define PATCH_B 0x020
154 # define PATCH_COND 0x040
155 # define PATCH_ABS48 0x080
156 # define PATCH_ABS64 0x100
159 #if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
160 # define IS_COND 0x004
161 # define IS_CALL 0x008
162 # define PATCH_B 0x010
163 # define PATCH_ABS_B 0x020
164 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
165 # define PATCH_ABS32 0x040
166 # define PATCH_ABS48 0x080
168 # define REMOVE_COND 0x100
171 #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
172 # define IS_MOVABLE 0x004
173 # define IS_JAL 0x008
174 # define IS_CALL 0x010
175 # define IS_BIT26_COND 0x020
176 # define IS_BIT16_COND 0x040
178 # define IS_COND (IS_BIT26_COND | IS_BIT16_COND)
180 # define PATCH_B 0x080
181 # define PATCH_J 0x100
183 #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
184 # define PATCH_ABS32 0x200
185 # define PATCH_ABS48 0x400
188 /* instruction types */
189 # define MOVABLE_INS 0
190 /* 1 - 31 last destination register */
191 /* no destination (i.e: store) */
192 # define UNMOVABLE_INS 32
193 /* FPU status register */
197 #if (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
199 # define IS_COND 0x08
201 # define PATCH_B 0x10
202 # define PATCH_J 0x20
205 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
206 # define IS_MOVABLE 0x04
207 # define IS_COND 0x08
208 # define IS_CALL 0x10
210 # define PATCH_B 0x20
211 # define PATCH_CALL 0x40
213 /* instruction types */
214 # define MOVABLE_INS 0
215 /* 1 - 31 last destination register */
216 /* no destination (i.e: store) */
217 # define UNMOVABLE_INS 32
219 # define DST_INS_MASK 0xff
221 /* ICC_SET is the same as SET_FLAGS. */
222 # define ICC_IS_SET (1 << 23)
223 # define FCC_IS_SET (1 << 24)
226 /* Stack management. */
228 #define GET_SAVED_REGISTERS_SIZE(scratches, saveds, extra) \
229 (((scratches < SLJIT_NUMBER_OF_SCRATCH_REGISTERS ? 0 : (scratches - SLJIT_NUMBER_OF_SCRATCH_REGISTERS)) + \
230 (saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? saveds : SLJIT_NUMBER_OF_SAVED_REGISTERS) + \
231 extra) * sizeof(sljit_sw))
233 #define ADJUST_LOCAL_OFFSET(p, i) \
234 if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
235 (i) += SLJIT_LOCALS_OFFSET;
237 #endif /* !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) */
239 /* Utils can still be used even if SLJIT_CONFIG_UNSUPPORTED is set. */
240 #include "sljitUtils.c"
242 #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
244 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
245 #include "sljitExecAllocator.c"
248 /* Argument checking features. */
250 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
252 /* Returns with error when an invalid argument is passed. */
254 #define CHECK_ARGUMENT(x) \
256 if (SLJIT_UNLIKELY(!(x))) \
260 #define CHECK_RETURN_TYPE sljit_si
261 #define CHECK_RETURN_OK return 0
265 if (SLJIT_UNLIKELY(x)) { \
266 compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
267 return SLJIT_ERR_BAD_ARGUMENT; \
271 #define CHECK_PTR(x) \
273 if (SLJIT_UNLIKELY(x)) { \
274 compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
279 #define CHECK_REG_INDEX(x) \
281 if (SLJIT_UNLIKELY(x)) { \
286 #elif (defined SLJIT_DEBUG && SLJIT_DEBUG)
288 /* Assertion failure occures if an invalid argument is passed. */
289 #undef SLJIT_ARGUMENT_CHECKS
290 #define SLJIT_ARGUMENT_CHECKS 1
292 #define CHECK_ARGUMENT(x) SLJIT_ASSERT(x)
293 #define CHECK_RETURN_TYPE void
294 #define CHECK_RETURN_OK return
296 #define CHECK_PTR(x) x
297 #define CHECK_REG_INDEX(x) x
299 #elif (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
301 /* Arguments are not checked. */
302 #define CHECK_RETURN_TYPE void
303 #define CHECK_RETURN_OK return
305 #define CHECK_PTR(x) x
306 #define CHECK_REG_INDEX(x) x
310 /* Arguments are not checked. */
313 #define CHECK_REG_INDEX(x)
315 #endif /* SLJIT_ARGUMENT_CHECKS */
317 /* --------------------------------------------------------------------- */
318 /* Public functions */
319 /* --------------------------------------------------------------------- */
321 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
322 #define SLJIT_NEEDS_COMPILER_INIT 1
323 static sljit_si compiler_initialized
= 0;
324 /* A thread safe initialization. */
325 static void init_compiler(void);
328 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_compiler
* sljit_create_compiler(void *allocator_data
)
330 struct sljit_compiler
*compiler
= (struct sljit_compiler
*)SLJIT_MALLOC(sizeof(struct sljit_compiler
), allocator_data
);
333 SLJIT_ZEROMEM(compiler
, sizeof(struct sljit_compiler
));
335 SLJIT_COMPILE_ASSERT(
336 sizeof(sljit_sb
) == 1 && sizeof(sljit_ub
) == 1
337 && sizeof(sljit_sh
) == 2 && sizeof(sljit_uh
) == 2
338 && sizeof(sljit_si
) == 4 && sizeof(sljit_ui
) == 4
339 && (sizeof(sljit_p
) == 4 || sizeof(sljit_p
) == 8)
340 && sizeof(sljit_p
) <= sizeof(sljit_sw
)
341 && (sizeof(sljit_sw
) == 4 || sizeof(sljit_sw
) == 8)
342 && (sizeof(sljit_uw
) == 4 || sizeof(sljit_uw
) == 8),
343 invalid_integer_types
);
344 SLJIT_COMPILE_ASSERT(SLJIT_INT_OP
== SLJIT_SINGLE_OP
,
345 int_op_and_single_op_must_be_the_same
);
346 SLJIT_COMPILE_ASSERT(SLJIT_REWRITABLE_JUMP
!= SLJIT_SINGLE_OP
,
347 rewritable_jump_and_single_op_must_not_be_the_same
);
349 /* Only the non-zero members must be set. */
350 compiler
->error
= SLJIT_SUCCESS
;
352 compiler
->allocator_data
= allocator_data
;
353 compiler
->buf
= (struct sljit_memory_fragment
*)SLJIT_MALLOC(BUF_SIZE
, allocator_data
);
354 compiler
->abuf
= (struct sljit_memory_fragment
*)SLJIT_MALLOC(ABUF_SIZE
, allocator_data
);
356 if (!compiler
->buf
|| !compiler
->abuf
) {
358 SLJIT_FREE(compiler
->buf
, allocator_data
);
360 SLJIT_FREE(compiler
->abuf
, allocator_data
);
361 SLJIT_FREE(compiler
, allocator_data
);
365 compiler
->buf
->next
= NULL
;
366 compiler
->buf
->used_size
= 0;
367 compiler
->abuf
->next
= NULL
;
368 compiler
->abuf
->used_size
= 0;
370 compiler
->scratches
= -1;
371 compiler
->saveds
= -1;
372 compiler
->fscratches
= -1;
373 compiler
->fsaveds
= -1;
374 compiler
->local_size
= -1;
376 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
380 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
381 compiler
->cpool
= (sljit_uw
*)SLJIT_MALLOC(CPOOL_SIZE
* sizeof(sljit_uw
)
382 + CPOOL_SIZE
* sizeof(sljit_ub
), allocator_data
);
383 if (!compiler
->cpool
) {
384 SLJIT_FREE(compiler
->buf
, allocator_data
);
385 SLJIT_FREE(compiler
->abuf
, allocator_data
);
386 SLJIT_FREE(compiler
, allocator_data
);
389 compiler
->cpool_unique
= (sljit_ub
*)(compiler
->cpool
+ CPOOL_SIZE
);
390 compiler
->cpool_diff
= 0xffffffff;
393 #if (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
394 compiler
->delay_slot
= UNMOVABLE_INS
;
397 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
398 compiler
->delay_slot
= UNMOVABLE_INS
;
401 #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)
402 if (!compiler_initialized
) {
404 compiler_initialized
= 1;
411 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_compiler(struct sljit_compiler
*compiler
)
413 struct sljit_memory_fragment
*buf
;
414 struct sljit_memory_fragment
*curr
;
415 void *allocator_data
= compiler
->allocator_data
;
416 SLJIT_UNUSED_ARG(allocator_data
);
422 SLJIT_FREE(curr
, allocator_data
);
425 buf
= compiler
->abuf
;
429 SLJIT_FREE(curr
, allocator_data
);
432 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
433 SLJIT_FREE(compiler
->cpool
, allocator_data
);
435 SLJIT_FREE(compiler
, allocator_data
);
438 #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
439 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_code(void* code
)
441 /* Remove thumb mode flag. */
442 SLJIT_FREE_EXEC((void*)((sljit_uw
)code
& ~0x1));
444 #elif (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
445 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_code(void* code
)
447 /* Resolve indirection. */
448 code
= (void*)(*(sljit_uw
*)code
);
449 SLJIT_FREE_EXEC(code
);
452 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_code(void* code
)
454 SLJIT_FREE_EXEC(code
);
458 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_label(struct sljit_jump
*jump
, struct sljit_label
* label
)
460 if (SLJIT_LIKELY(!!jump
) && SLJIT_LIKELY(!!label
)) {
461 jump
->flags
&= ~JUMP_ADDR
;
462 jump
->flags
|= JUMP_LABEL
;
463 jump
->u
.label
= label
;
467 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_target(struct sljit_jump
*jump
, sljit_uw target
)
469 if (SLJIT_LIKELY(!!jump
)) {
470 jump
->flags
&= ~JUMP_LABEL
;
471 jump
->flags
|= JUMP_ADDR
;
472 jump
->u
.target
= target
;
476 /* --------------------------------------------------------------------- */
477 /* Private functions */
478 /* --------------------------------------------------------------------- */
480 static void* ensure_buf(struct sljit_compiler
*compiler
, sljit_uw size
)
483 struct sljit_memory_fragment
*new_frag
;
485 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
;
488 compiler
->buf
->used_size
+= size
;
491 new_frag
= (struct sljit_memory_fragment
*)SLJIT_MALLOC(BUF_SIZE
, compiler
->allocator_data
);
492 PTR_FAIL_IF_NULL(new_frag
);
493 new_frag
->next
= compiler
->buf
;
494 compiler
->buf
= new_frag
;
495 new_frag
->used_size
= size
;
496 return new_frag
->memory
;
499 static void* ensure_abuf(struct sljit_compiler
*compiler
, sljit_uw size
)
502 struct sljit_memory_fragment
*new_frag
;
504 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
;
507 compiler
->abuf
->used_size
+= size
;
510 new_frag
= (struct sljit_memory_fragment
*)SLJIT_MALLOC(ABUF_SIZE
, compiler
->allocator_data
);
511 PTR_FAIL_IF_NULL(new_frag
);
512 new_frag
->next
= compiler
->abuf
;
513 compiler
->abuf
= new_frag
;
514 new_frag
->used_size
= size
;
515 return new_frag
->memory
;
518 SLJIT_API_FUNC_ATTRIBUTE
void* sljit_alloc_memory(struct sljit_compiler
*compiler
, sljit_si size
)
522 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
523 if (size
<= 0 || size
> 128)
525 size
= (size
+ 7) & ~7;
527 if (size
<= 0 || size
> 64)
529 size
= (size
+ 3) & ~3;
531 return ensure_abuf(compiler
, size
);
534 static SLJIT_INLINE
void reverse_buf(struct sljit_compiler
*compiler
)
536 struct sljit_memory_fragment
*buf
= compiler
->buf
;
537 struct sljit_memory_fragment
*prev
= NULL
;
538 struct sljit_memory_fragment
*tmp
;
545 } while (buf
!= NULL
);
547 compiler
->buf
= prev
;
550 static SLJIT_INLINE
void set_emit_enter(struct sljit_compiler
*compiler
,
551 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
552 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
554 SLJIT_UNUSED_ARG(args
);
555 SLJIT_UNUSED_ARG(local_size
);
557 compiler
->options
= options
;
558 compiler
->scratches
= scratches
;
559 compiler
->saveds
= saveds
;
560 compiler
->fscratches
= fscratches
;
561 compiler
->fsaveds
= fsaveds
;
562 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
563 compiler
->logical_local_size
= local_size
;
567 static SLJIT_INLINE
void set_set_context(struct sljit_compiler
*compiler
,
568 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
569 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
571 SLJIT_UNUSED_ARG(args
);
572 SLJIT_UNUSED_ARG(local_size
);
574 compiler
->options
= options
;
575 compiler
->scratches
= scratches
;
576 compiler
->saveds
= saveds
;
577 compiler
->fscratches
= fscratches
;
578 compiler
->fsaveds
= fsaveds
;
579 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
580 compiler
->logical_local_size
= local_size
;
584 static SLJIT_INLINE
void set_label(struct sljit_label
*label
, struct sljit_compiler
*compiler
)
587 label
->size
= compiler
->size
;
588 if (compiler
->last_label
)
589 compiler
->last_label
->next
= label
;
591 compiler
->labels
= label
;
592 compiler
->last_label
= label
;
595 static SLJIT_INLINE
void set_jump(struct sljit_jump
*jump
, struct sljit_compiler
*compiler
, sljit_si flags
)
599 if (compiler
->last_jump
)
600 compiler
->last_jump
->next
= jump
;
602 compiler
->jumps
= jump
;
603 compiler
->last_jump
= jump
;
606 static SLJIT_INLINE
void set_const(struct sljit_const
*const_
, struct sljit_compiler
*compiler
)
609 const_
->addr
= compiler
->size
;
610 if (compiler
->last_const
)
611 compiler
->last_const
->next
= const_
;
613 compiler
->consts
= const_
;
614 compiler
->last_const
= const_
;
617 #define ADDRESSING_DEPENDS_ON(exp, reg) \
618 (((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
620 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
621 #define FUNCTION_CHECK_OP() \
622 CHECK_ARGUMENT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
623 switch (GET_OPCODE(op)) { \
632 CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))); \
635 CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
638 CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
641 CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_S))); \
647 CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))); \
649 case SLJIT_BREAKPOINT: \
657 case SLJIT_MOVU_UI: \
659 /* Nothing allowed */ \
660 CHECK_ARGUMENT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
663 /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
664 CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
668 #define FUNCTION_CHECK_FOP() \
669 CHECK_ARGUMENT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
670 switch (GET_OPCODE(op)) { \
672 CHECK_ARGUMENT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
673 CHECK_ARGUMENT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
676 /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
677 CHECK_ARGUMENT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
681 #define FUNCTION_CHECK_IS_REG(r) \
682 (((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
683 ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
685 #define FUNCTION_CHECK_IS_REG_OR_UNUSED(r) \
686 ((r) == SLJIT_UNUSED || \
687 ((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
688 ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
690 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
691 #define CHECK_NOT_VIRTUAL_REGISTER(p) \
692 CHECK_ARGUMENT((p) < SLJIT_R3 || (p) > SLJIT_R6);
694 #define CHECK_NOT_VIRTUAL_REGISTER(p)
697 #define FUNCTION_CHECK_SRC(p, i) \
698 CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
699 if (FUNCTION_CHECK_IS_REG(p)) \
700 CHECK_ARGUMENT((i) == 0); \
701 else if ((p) == SLJIT_IMM) \
703 else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
704 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
706 CHECK_ARGUMENT((p) & SLJIT_MEM); \
707 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
708 CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
709 if ((p) & OFFS_REG_MASK) { \
710 CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
711 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
712 CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
713 CHECK_ARGUMENT(!((i) & ~0x3)); \
715 CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
718 #define FUNCTION_CHECK_DST(p, i) \
719 CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
720 if (FUNCTION_CHECK_IS_REG_OR_UNUSED(p)) \
721 CHECK_ARGUMENT((i) == 0); \
722 else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
723 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
725 CHECK_ARGUMENT((p) & SLJIT_MEM); \
726 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
727 CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
728 if ((p) & OFFS_REG_MASK) { \
729 CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
730 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
731 CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
732 CHECK_ARGUMENT(!((i) & ~0x3)); \
734 CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
737 #define FUNCTION_FCHECK(p, i) \
738 CHECK_ARGUMENT(compiler->fscratches != -1 && compiler->fsaveds != -1); \
739 if (((p) >= SLJIT_FR0 && (p) < (SLJIT_FR0 + compiler->fscratches)) || \
740 ((p) > (SLJIT_FS0 - compiler->fsaveds) && (p) <= SLJIT_FS0)) \
741 CHECK_ARGUMENT(i == 0); \
742 else if ((p) == (SLJIT_MEM1(SLJIT_SP))) \
743 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
745 CHECK_ARGUMENT((p) & SLJIT_MEM); \
746 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG_OR_UNUSED((p) & REG_MASK)); \
747 CHECK_NOT_VIRTUAL_REGISTER((p) & REG_MASK); \
748 if ((p) & OFFS_REG_MASK) { \
749 CHECK_ARGUMENT(((p) & REG_MASK) != SLJIT_UNUSED); \
750 CHECK_ARGUMENT(FUNCTION_CHECK_IS_REG(OFFS_REG(p))); \
751 CHECK_NOT_VIRTUAL_REGISTER(OFFS_REG(p)); \
752 CHECK_ARGUMENT(((p) & OFFS_REG_MASK) != TO_OFFS_REG(SLJIT_SP) && !(i & ~0x3)); \
754 CHECK_ARGUMENT(!((p) & ~(SLJIT_MEM | SLJIT_IMM | REG_MASK | OFFS_REG_MASK))); \
757 #define FUNCTION_CHECK_OP1() \
758 if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
759 CHECK_ARGUMENT(!(src & SLJIT_MEM) || (src & REG_MASK) != SLJIT_SP); \
760 CHECK_ARGUMENT(!(dst & SLJIT_MEM) || (dst & REG_MASK) != SLJIT_SP); \
761 if ((src & SLJIT_MEM) && (src & REG_MASK)) \
762 CHECK_ARGUMENT((dst & REG_MASK) != (src & REG_MASK) && OFFS_REG(dst) != (src & REG_MASK)); \
765 #endif /* SLJIT_ARGUMENT_CHECKS */
767 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
769 SLJIT_API_FUNC_ATTRIBUTE
void sljit_compiler_verbose(struct sljit_compiler
*compiler
, FILE* verbose
)
771 compiler
->verbose
= verbose
;
774 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
776 # define SLJIT_PRINT_D "I64"
778 # define SLJIT_PRINT_D "l"
781 # define SLJIT_PRINT_D ""
784 #define sljit_verbose_reg(compiler, r) \
786 if ((r) < (SLJIT_R0 + compiler->scratches)) \
787 fprintf(compiler->verbose, "r%d", (r) - SLJIT_R0); \
789 fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - (r)); \
792 #define sljit_verbose_param(compiler, p, i) \
793 if ((p) & SLJIT_IMM) \
794 fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
795 else if ((p) & SLJIT_MEM) { \
796 if ((p) & REG_MASK) { \
797 fputc('[', compiler->verbose); \
798 sljit_verbose_reg(compiler, (p) & REG_MASK); \
799 if ((p) & OFFS_REG_MASK) { \
800 fprintf(compiler->verbose, " + "); \
801 sljit_verbose_reg(compiler, OFFS_REG(p)); \
803 fprintf(compiler->verbose, " * %d", 1 << (i)); \
806 fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i)); \
807 fputc(']', compiler->verbose); \
810 fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
812 sljit_verbose_reg(compiler, p); \
814 fprintf(compiler->verbose, "unused");
816 #define sljit_verbose_fparam(compiler, p, i) \
817 if ((p) & SLJIT_MEM) { \
818 if ((p) & REG_MASK) { \
819 fputc('[', compiler->verbose); \
820 sljit_verbose_reg(compiler, (p) & REG_MASK); \
821 if ((p) & OFFS_REG_MASK) { \
822 fprintf(compiler->verbose, " + "); \
823 sljit_verbose_reg(compiler, OFFS_REG(p)); \
825 fprintf(compiler->verbose, "%d", 1 << (i)); \
828 fprintf(compiler->verbose, "%" SLJIT_PRINT_D "d", (i)); \
829 fputc(']', compiler->verbose); \
832 fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
835 if ((p) < (SLJIT_FR0 + compiler->fscratches)) \
836 fprintf(compiler->verbose, "fr%d", (p) - SLJIT_FR0); \
838 fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \
841 static SLJIT_CONST
char* op0_names
[] = {
842 (char*)"breakpoint", (char*)"nop",
843 (char*)"lumul", (char*)"lsmul", (char*)"ludiv", (char*)"lsdiv",
846 static SLJIT_CONST
char* op1_names
[] = {
847 (char*)"mov", (char*)"mov_ub", (char*)"mov_sb", (char*)"mov_uh",
848 (char*)"mov_sh", (char*)"mov_ui", (char*)"mov_si", (char*)"mov_p",
849 (char*)"movu", (char*)"movu_ub", (char*)"movu_sb", (char*)"movu_uh",
850 (char*)"movu_sh", (char*)"movu_ui", (char*)"movu_si", (char*)"movu_p",
851 (char*)"not", (char*)"neg", (char*)"clz",
854 static SLJIT_CONST
char* op2_names
[] = {
855 (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
856 (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
857 (char*)"shl", (char*)"lshr", (char*)"ashr",
860 static SLJIT_CONST
char* fop1_names
[] = {
861 (char*)"mov", (char*)"conv", (char*)"conv", (char*)"conv",
862 (char*)"conv", (char*)"conv", (char*)"cmp", (char*)"neg",
866 static SLJIT_CONST
char* fop2_names
[] = {
867 (char*)"add", (char*)"sub", (char*)"mul", (char*)"div"
870 #define JUMP_PREFIX(type) \
871 ((type & 0xff) <= SLJIT_MUL_NOT_OVERFLOW ? ((type & SLJIT_INT_OP) ? "i_" : "") \
872 : ((type & 0xff) <= SLJIT_D_ORDERED ? ((type & SLJIT_SINGLE_OP) ? "s_" : "d_") : ""))
874 static char* jump_names
[] = {
875 (char*)"equal", (char*)"not_equal",
876 (char*)"less", (char*)"greater_equal",
877 (char*)"greater", (char*)"less_equal",
878 (char*)"sig_less", (char*)"sig_greater_equal",
879 (char*)"sig_greater", (char*)"sig_less_equal",
880 (char*)"overflow", (char*)"not_overflow",
881 (char*)"mul_overflow", (char*)"mul_not_overflow",
882 (char*)"equal", (char*)"not_equal",
883 (char*)"less", (char*)"greater_equal",
884 (char*)"greater", (char*)"less_equal",
885 (char*)"unordered", (char*)"ordered",
886 (char*)"jump", (char*)"fast_call",
887 (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
890 #endif /* SLJIT_VERBOSE */
892 /* --------------------------------------------------------------------- */
894 /* --------------------------------------------------------------------- */
896 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
897 || (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
899 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_generate_code(struct sljit_compiler
*compiler
)
901 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
902 struct sljit_jump
*jump
;
905 SLJIT_UNUSED_ARG(compiler
);
907 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
908 CHECK_ARGUMENT(compiler
->size
> 0);
909 jump
= compiler
->jumps
;
911 /* All jumps have target. */
912 CHECK_ARGUMENT(jump
->flags
& (JUMP_LABEL
| JUMP_ADDR
));
919 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_enter(struct sljit_compiler
*compiler
,
920 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
921 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
923 SLJIT_UNUSED_ARG(compiler
);
925 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
926 CHECK_ARGUMENT(!(options
& ~SLJIT_DOUBLE_ALIGNMENT
));
927 CHECK_ARGUMENT(args
>= 0 && args
<= 3);
928 CHECK_ARGUMENT(scratches
>= 0 && scratches
<= SLJIT_NUMBER_OF_REGISTERS
);
929 CHECK_ARGUMENT(saveds
>= 0 && saveds
<= SLJIT_NUMBER_OF_REGISTERS
);
930 CHECK_ARGUMENT(scratches
+ saveds
<= SLJIT_NUMBER_OF_REGISTERS
);
931 CHECK_ARGUMENT(args
<= saveds
);
932 CHECK_ARGUMENT(fscratches
>= 0 && fscratches
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
933 CHECK_ARGUMENT(fsaveds
>= 0 && fsaveds
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
934 CHECK_ARGUMENT(fscratches
+ fsaveds
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
935 CHECK_ARGUMENT(local_size
>= 0 && local_size
<= SLJIT_MAX_LOCAL_SIZE
);
937 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
938 if (SLJIT_UNLIKELY(!!compiler
->verbose
))
939 fprintf(compiler
->verbose
, " enter options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
940 args
, scratches
, saveds
, fscratches
, fsaveds
, local_size
);
945 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_set_context(struct sljit_compiler
*compiler
,
946 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
947 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
949 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
950 compiler
->skip_checks
= 0;
954 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
955 CHECK_ARGUMENT(!(options
& ~SLJIT_DOUBLE_ALIGNMENT
));
956 CHECK_ARGUMENT(args
>= 0 && args
<= 3);
957 CHECK_ARGUMENT(scratches
>= 0 && scratches
<= SLJIT_NUMBER_OF_REGISTERS
);
958 CHECK_ARGUMENT(saveds
>= 0 && saveds
<= SLJIT_NUMBER_OF_REGISTERS
);
959 CHECK_ARGUMENT(scratches
+ saveds
<= SLJIT_NUMBER_OF_REGISTERS
);
960 CHECK_ARGUMENT(args
<= saveds
);
961 CHECK_ARGUMENT(fscratches
>= 0 && fscratches
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
962 CHECK_ARGUMENT(fsaveds
>= 0 && fsaveds
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
963 CHECK_ARGUMENT(fscratches
+ fsaveds
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
964 CHECK_ARGUMENT(local_size
>= 0 && local_size
<= SLJIT_MAX_LOCAL_SIZE
);
966 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
967 if (SLJIT_UNLIKELY(!!compiler
->verbose
))
968 fprintf(compiler
->verbose
, " set_context options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
969 args
, scratches
, saveds
, fscratches
, fsaveds
, local_size
);
974 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_return(struct sljit_compiler
*compiler
, sljit_si op
, sljit_si src
, sljit_sw srcw
)
976 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
977 CHECK_ARGUMENT(compiler
->scratches
>= 0);
978 if (op
!= SLJIT_UNUSED
) {
979 CHECK_ARGUMENT(op
>= SLJIT_MOV
&& op
<= SLJIT_MOV_P
);
980 FUNCTION_CHECK_SRC(src
, srcw
);
983 CHECK_ARGUMENT(src
== 0 && srcw
== 0);
985 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
986 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
987 if (op
== SLJIT_UNUSED
)
988 fprintf(compiler
->verbose
, " return\n");
990 fprintf(compiler
->verbose
, " return.%s ", op1_names
[op
- SLJIT_OP1_BASE
]);
991 sljit_verbose_param(compiler
, src
, srcw
);
992 fprintf(compiler
->verbose
, "\n");
999 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fast_enter(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
)
1001 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1002 FUNCTION_CHECK_DST(dst
, dstw
);
1004 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1005 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1006 fprintf(compiler
->verbose
, " fast_enter ");
1007 sljit_verbose_param(compiler
, dst
, dstw
);
1008 fprintf(compiler
->verbose
, "\n");
1014 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fast_return(struct sljit_compiler
*compiler
, sljit_si src
, sljit_sw srcw
)
1016 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1017 FUNCTION_CHECK_SRC(src
, srcw
);
1019 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1020 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1021 fprintf(compiler
->verbose
, " fast_return ");
1022 sljit_verbose_param(compiler
, src
, srcw
);
1023 fprintf(compiler
->verbose
, "\n");
1029 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_op0(struct sljit_compiler
*compiler
, sljit_si op
)
1031 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1032 CHECK_ARGUMENT((op
>= SLJIT_BREAKPOINT
&& op
<= SLJIT_LSMUL
)
1033 || ((op
& ~SLJIT_INT_OP
) >= SLJIT_LUDIV
&& (op
& ~SLJIT_INT_OP
) <= SLJIT_LSDIV
));
1034 CHECK_ARGUMENT(op
< SLJIT_LUMUL
|| compiler
->scratches
>= 2);
1036 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1037 if (SLJIT_UNLIKELY(!!compiler
->verbose
))
1038 fprintf(compiler
->verbose
, " %s%s\n", !(op
& SLJIT_INT_OP
) ? "" : "i", op0_names
[GET_OPCODE(op
) - SLJIT_OP0_BASE
]);
1043 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_op1(struct sljit_compiler
*compiler
, sljit_si op
,
1044 sljit_si dst
, sljit_sw dstw
,
1045 sljit_si src
, sljit_sw srcw
)
1047 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1048 compiler
->skip_checks
= 0;
1052 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1053 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_MOV
&& GET_OPCODE(op
) <= SLJIT_CLZ
);
1054 FUNCTION_CHECK_OP();
1055 FUNCTION_CHECK_SRC(src
, srcw
);
1056 FUNCTION_CHECK_DST(dst
, dstw
);
1057 FUNCTION_CHECK_OP1();
1059 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1060 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1061 fprintf(compiler
->verbose
, " %s%s%s%s%s%s%s%s ", !(op
& SLJIT_INT_OP
) ? "" : "i", op1_names
[GET_OPCODE(op
) - SLJIT_OP1_BASE
],
1062 !(op
& SLJIT_SET_E
) ? "" : ".e", !(op
& SLJIT_SET_U
) ? "" : ".u", !(op
& SLJIT_SET_S
) ? "" : ".s",
1063 !(op
& SLJIT_SET_O
) ? "" : ".o", !(op
& SLJIT_SET_C
) ? "" : ".c", !(op
& SLJIT_KEEP_FLAGS
) ? "" : ".k");
1064 sljit_verbose_param(compiler
, dst
, dstw
);
1065 fprintf(compiler
->verbose
, ", ");
1066 sljit_verbose_param(compiler
, src
, srcw
);
1067 fprintf(compiler
->verbose
, "\n");
1073 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_op2(struct sljit_compiler
*compiler
, sljit_si op
,
1074 sljit_si dst
, sljit_sw dstw
,
1075 sljit_si src1
, sljit_sw src1w
,
1076 sljit_si src2
, sljit_sw src2w
)
1078 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1079 compiler
->skip_checks
= 0;
1083 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1084 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_ADD
&& GET_OPCODE(op
) <= SLJIT_ASHR
);
1085 FUNCTION_CHECK_OP();
1086 FUNCTION_CHECK_SRC(src1
, src1w
);
1087 FUNCTION_CHECK_SRC(src2
, src2w
);
1088 FUNCTION_CHECK_DST(dst
, dstw
);
1090 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1091 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1092 fprintf(compiler
->verbose
, " %s%s%s%s%s%s%s%s ", !(op
& SLJIT_INT_OP
) ? "" : "i", op2_names
[GET_OPCODE(op
) - SLJIT_OP2_BASE
],
1093 !(op
& SLJIT_SET_E
) ? "" : ".e", !(op
& SLJIT_SET_U
) ? "" : ".u", !(op
& SLJIT_SET_S
) ? "" : ".s",
1094 !(op
& SLJIT_SET_O
) ? "" : ".o", !(op
& SLJIT_SET_C
) ? "" : ".c", !(op
& SLJIT_KEEP_FLAGS
) ? "" : ".k");
1095 sljit_verbose_param(compiler
, dst
, dstw
);
1096 fprintf(compiler
->verbose
, ", ");
1097 sljit_verbose_param(compiler
, src1
, src1w
);
1098 fprintf(compiler
->verbose
, ", ");
1099 sljit_verbose_param(compiler
, src2
, src2w
);
1100 fprintf(compiler
->verbose
, "\n");
1106 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_get_register_index(sljit_si reg
)
1108 SLJIT_UNUSED_ARG(reg
);
1109 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1110 CHECK_ARGUMENT(reg
> 0 && reg
<= SLJIT_NUMBER_OF_REGISTERS
);
1115 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_get_float_register_index(sljit_si reg
)
1117 SLJIT_UNUSED_ARG(reg
);
1118 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1119 CHECK_ARGUMENT(reg
> 0 && reg
<= SLJIT_NUMBER_OF_FLOAT_REGISTERS
);
1124 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_op_custom(struct sljit_compiler
*compiler
,
1125 void *instruction
, sljit_si size
)
1127 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1131 SLJIT_UNUSED_ARG(compiler
);
1133 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1134 CHECK_ARGUMENT(instruction
);
1135 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
1136 CHECK_ARGUMENT(size
> 0 && size
< 16);
1137 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1138 CHECK_ARGUMENT((size
== 2 && (((sljit_sw
)instruction
) & 0x1) == 0)
1139 || (size
== 4 && (((sljit_sw
)instruction
) & 0x3) == 0));
1141 CHECK_ARGUMENT(size
== 4 && (((sljit_sw
)instruction
) & 0x3) == 0);
1145 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1146 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1147 fprintf(compiler
->verbose
, " op_custom");
1148 for (i
= 0; i
< size
; i
++)
1149 fprintf(compiler
->verbose
, " 0x%x", ((sljit_ub
*)instruction
)[i
]);
1150 fprintf(compiler
->verbose
, "\n");
1156 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fop1(struct sljit_compiler
*compiler
, sljit_si op
,
1157 sljit_si dst
, sljit_sw dstw
,
1158 sljit_si src
, sljit_sw srcw
)
1160 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1161 compiler
->skip_checks
= 0;
1165 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1166 CHECK_ARGUMENT(sljit_is_fpu_available());
1167 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_DMOV
&& GET_OPCODE(op
) <= SLJIT_DABS
);
1168 FUNCTION_CHECK_FOP();
1169 FUNCTION_FCHECK(src
, srcw
);
1170 FUNCTION_FCHECK(dst
, dstw
);
1172 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1173 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1174 if (GET_OPCODE(op
) == SLJIT_CONVD_FROMS
)
1175 fprintf(compiler
->verbose
, " %s%s ", fop1_names
[SLJIT_CONVD_FROMS
- SLJIT_FOP1_BASE
],
1176 (op
& SLJIT_SINGLE_OP
) ? "s.fromd" : "d.froms");
1178 fprintf(compiler
->verbose
, " %s%s ", (op
& SLJIT_SINGLE_OP
) ? "s" : "d",
1179 fop1_names
[GET_OPCODE(op
) - SLJIT_FOP1_BASE
]);
1181 sljit_verbose_fparam(compiler
, dst
, dstw
);
1182 fprintf(compiler
->verbose
, ", ");
1183 sljit_verbose_fparam(compiler
, src
, srcw
);
1184 fprintf(compiler
->verbose
, "\n");
1190 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fop1_cmp(struct sljit_compiler
*compiler
, sljit_si op
,
1191 sljit_si src1
, sljit_sw src1w
,
1192 sljit_si src2
, sljit_sw src2w
)
1194 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1195 compiler
->skip_checks
= 0;
1199 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1200 CHECK_ARGUMENT(sljit_is_fpu_available());
1201 CHECK_ARGUMENT(GET_OPCODE(op
) == SLJIT_DCMP
);
1202 FUNCTION_CHECK_FOP();
1203 FUNCTION_FCHECK(src1
, src1w
);
1204 FUNCTION_FCHECK(src2
, src2w
);
1206 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1207 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1208 fprintf(compiler
->verbose
, " %s%s%s%s ", (op
& SLJIT_SINGLE_OP
) ? "s" : "d", fop1_names
[SLJIT_DCMP
- SLJIT_FOP1_BASE
],
1209 (op
& SLJIT_SET_E
) ? ".e" : "", (op
& SLJIT_SET_S
) ? ".s" : "");
1210 sljit_verbose_fparam(compiler
, src1
, src1w
);
1211 fprintf(compiler
->verbose
, ", ");
1212 sljit_verbose_fparam(compiler
, src2
, src2w
);
1213 fprintf(compiler
->verbose
, "\n");
1219 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fop1_convw_fromd(struct sljit_compiler
*compiler
, sljit_si op
,
1220 sljit_si dst
, sljit_sw dstw
,
1221 sljit_si src
, sljit_sw srcw
)
1223 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1224 compiler
->skip_checks
= 0;
1228 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1229 CHECK_ARGUMENT(sljit_is_fpu_available());
1230 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_CONVW_FROMD
&& GET_OPCODE(op
) <= SLJIT_CONVI_FROMD
);
1231 FUNCTION_CHECK_FOP();
1232 FUNCTION_FCHECK(src
, srcw
);
1233 FUNCTION_CHECK_DST(dst
, dstw
);
1235 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1236 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1237 fprintf(compiler
->verbose
, " %s%s.from%s ", fop1_names
[GET_OPCODE(op
) - SLJIT_FOP1_BASE
],
1238 (GET_OPCODE(op
) == SLJIT_CONVI_FROMD
) ? "i" : "w",
1239 (op
& SLJIT_SINGLE_OP
) ? "s" : "d");
1240 sljit_verbose_param(compiler
, dst
, dstw
);
1241 fprintf(compiler
->verbose
, ", ");
1242 sljit_verbose_fparam(compiler
, src
, srcw
);
1243 fprintf(compiler
->verbose
, "\n");
1249 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fop1_convd_fromw(struct sljit_compiler
*compiler
, sljit_si op
,
1250 sljit_si dst
, sljit_sw dstw
,
1251 sljit_si src
, sljit_sw srcw
)
1253 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1254 compiler
->skip_checks
= 0;
1258 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1259 CHECK_ARGUMENT(sljit_is_fpu_available());
1260 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_CONVD_FROMW
&& GET_OPCODE(op
) <= SLJIT_CONVD_FROMI
);
1261 FUNCTION_CHECK_FOP();
1262 FUNCTION_CHECK_SRC(src
, srcw
);
1263 FUNCTION_FCHECK(dst
, dstw
);
1265 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1266 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1267 fprintf(compiler
->verbose
, " %s%s.from%s ", fop1_names
[GET_OPCODE(op
) - SLJIT_FOP1_BASE
],
1268 (op
& SLJIT_SINGLE_OP
) ? "s" : "d",
1269 (GET_OPCODE(op
) == SLJIT_CONVD_FROMI
) ? "i" : "w");
1270 sljit_verbose_fparam(compiler
, dst
, dstw
);
1271 fprintf(compiler
->verbose
, ", ");
1272 sljit_verbose_param(compiler
, src
, srcw
);
1273 fprintf(compiler
->verbose
, "\n");
1279 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fop2(struct sljit_compiler
*compiler
, sljit_si op
,
1280 sljit_si dst
, sljit_sw dstw
,
1281 sljit_si src1
, sljit_sw src1w
,
1282 sljit_si src2
, sljit_sw src2w
)
1284 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1285 CHECK_ARGUMENT(sljit_is_fpu_available());
1286 CHECK_ARGUMENT(GET_OPCODE(op
) >= SLJIT_DADD
&& GET_OPCODE(op
) <= SLJIT_DDIV
);
1287 FUNCTION_CHECK_FOP();
1288 FUNCTION_FCHECK(src1
, src1w
);
1289 FUNCTION_FCHECK(src2
, src2w
);
1290 FUNCTION_FCHECK(dst
, dstw
);
1292 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1293 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1294 fprintf(compiler
->verbose
, " %s%s ", (op
& SLJIT_SINGLE_OP
) ? "s" : "d", fop2_names
[GET_OPCODE(op
) - SLJIT_FOP2_BASE
]);
1295 sljit_verbose_fparam(compiler
, dst
, dstw
);
1296 fprintf(compiler
->verbose
, ", ");
1297 sljit_verbose_fparam(compiler
, src1
, src1w
);
1298 fprintf(compiler
->verbose
, ", ");
1299 sljit_verbose_fparam(compiler
, src2
, src2w
);
1300 fprintf(compiler
->verbose
, "\n");
1306 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_label(struct sljit_compiler
*compiler
)
1308 SLJIT_UNUSED_ARG(compiler
);
1310 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1311 if (SLJIT_UNLIKELY(!!compiler
->verbose
))
1312 fprintf(compiler
->verbose
, "label:\n");
1317 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_jump(struct sljit_compiler
*compiler
, sljit_si type
)
1319 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1320 compiler
->skip_checks
= 0;
1324 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1325 CHECK_ARGUMENT(!(type
& ~(0xff | SLJIT_REWRITABLE_JUMP
| SLJIT_INT_OP
)));
1326 CHECK_ARGUMENT((type
& 0xff) >= SLJIT_EQUAL
&& (type
& 0xff) <= SLJIT_CALL3
);
1327 CHECK_ARGUMENT((type
& 0xff) < SLJIT_JUMP
|| !(type
& SLJIT_INT_OP
));
1328 CHECK_ARGUMENT((type
& 0xff) <= SLJIT_CALL0
|| ((type
& 0xff) - SLJIT_CALL0
) <= compiler
->scratches
);
1330 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1331 if (SLJIT_UNLIKELY(!!compiler
->verbose
))
1332 fprintf(compiler
->verbose
, " jump%s.%s%s\n", !(type
& SLJIT_REWRITABLE_JUMP
) ? "" : ".r",
1333 JUMP_PREFIX(type
), jump_names
[type
& 0xff]);
1338 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_cmp(struct sljit_compiler
*compiler
, sljit_si type
,
1339 sljit_si src1
, sljit_sw src1w
,
1340 sljit_si src2
, sljit_sw src2w
)
1342 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1343 CHECK_ARGUMENT(!(type
& ~(0xff | SLJIT_REWRITABLE_JUMP
| SLJIT_INT_OP
)));
1344 CHECK_ARGUMENT((type
& 0xff) >= SLJIT_EQUAL
&& (type
& 0xff) <= SLJIT_SIG_LESS_EQUAL
);
1345 FUNCTION_CHECK_SRC(src1
, src1w
);
1346 FUNCTION_CHECK_SRC(src2
, src2w
);
1348 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1349 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1350 fprintf(compiler
->verbose
, " cmp%s.%s%s ", !(type
& SLJIT_REWRITABLE_JUMP
) ? "" : ".r",
1351 (type
& SLJIT_INT_OP
) ? "i_" : "", jump_names
[type
& 0xff]);
1352 sljit_verbose_param(compiler
, src1
, src1w
);
1353 fprintf(compiler
->verbose
, ", ");
1354 sljit_verbose_param(compiler
, src2
, src2w
);
1355 fprintf(compiler
->verbose
, "\n");
1361 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_fcmp(struct sljit_compiler
*compiler
, sljit_si type
,
1362 sljit_si src1
, sljit_sw src1w
,
1363 sljit_si src2
, sljit_sw src2w
)
1365 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1366 CHECK_ARGUMENT(sljit_is_fpu_available());
1367 CHECK_ARGUMENT(!(type
& ~(0xff | SLJIT_REWRITABLE_JUMP
| SLJIT_SINGLE_OP
)));
1368 CHECK_ARGUMENT((type
& 0xff) >= SLJIT_D_EQUAL
&& (type
& 0xff) <= SLJIT_D_ORDERED
);
1369 FUNCTION_FCHECK(src1
, src1w
);
1370 FUNCTION_FCHECK(src2
, src2w
);
1372 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1373 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1374 fprintf(compiler
->verbose
, " fcmp%s.%s%s ", !(type
& SLJIT_REWRITABLE_JUMP
) ? "" : ".r",
1375 (type
& SLJIT_SINGLE_OP
) ? "s_" : "d_", jump_names
[type
& 0xff]);
1376 sljit_verbose_fparam(compiler
, src1
, src1w
);
1377 fprintf(compiler
->verbose
, ", ");
1378 sljit_verbose_fparam(compiler
, src2
, src2w
);
1379 fprintf(compiler
->verbose
, "\n");
1385 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_ijump(struct sljit_compiler
*compiler
, sljit_si type
, sljit_si src
, sljit_sw srcw
)
1387 if (SLJIT_UNLIKELY(compiler
->skip_checks
)) {
1388 compiler
->skip_checks
= 0;
1392 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1393 CHECK_ARGUMENT(type
>= SLJIT_JUMP
&& type
<= SLJIT_CALL3
);
1394 CHECK_ARGUMENT(type
<= SLJIT_CALL0
|| (type
- SLJIT_CALL0
) <= compiler
->scratches
);
1395 FUNCTION_CHECK_SRC(src
, srcw
);
1397 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1398 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1399 fprintf(compiler
->verbose
, " ijump.%s ", jump_names
[type
]);
1400 sljit_verbose_param(compiler
, src
, srcw
);
1401 fprintf(compiler
->verbose
, "\n");
1407 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_op_flags(struct sljit_compiler
*compiler
, sljit_si op
,
1408 sljit_si dst
, sljit_sw dstw
,
1409 sljit_si src
, sljit_sw srcw
,
1412 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1413 CHECK_ARGUMENT(!(type
& ~(0xff | SLJIT_INT_OP
)));
1414 CHECK_ARGUMENT((type
& 0xff) >= SLJIT_EQUAL
&& (type
& 0xff) <= SLJIT_D_ORDERED
);
1415 CHECK_ARGUMENT(op
== SLJIT_MOV
|| GET_OPCODE(op
) == SLJIT_MOV_UI
|| GET_OPCODE(op
) == SLJIT_MOV_SI
1416 || (GET_OPCODE(op
) >= SLJIT_AND
&& GET_OPCODE(op
) <= SLJIT_XOR
));
1417 CHECK_ARGUMENT((op
& (SLJIT_SET_U
| SLJIT_SET_S
| SLJIT_SET_O
| SLJIT_SET_C
)) == 0);
1418 CHECK_ARGUMENT((op
& (SLJIT_SET_E
| SLJIT_KEEP_FLAGS
)) != (SLJIT_SET_E
| SLJIT_KEEP_FLAGS
));
1419 if (GET_OPCODE(op
) < SLJIT_ADD
) {
1420 CHECK_ARGUMENT(src
== SLJIT_UNUSED
&& srcw
== 0);
1422 CHECK_ARGUMENT(src
== dst
&& srcw
== dstw
);
1424 FUNCTION_CHECK_DST(dst
, dstw
);
1426 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1427 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1428 fprintf(compiler
->verbose
, " flags.%s%s%s%s ", !(op
& SLJIT_INT_OP
) ? "" : "i",
1429 GET_OPCODE(op
) >= SLJIT_OP2_BASE
? op2_names
[GET_OPCODE(op
) - SLJIT_OP2_BASE
] : op1_names
[GET_OPCODE(op
) - SLJIT_OP1_BASE
],
1430 !(op
& SLJIT_SET_E
) ? "" : ".e", !(op
& SLJIT_KEEP_FLAGS
) ? "" : ".k");
1431 sljit_verbose_param(compiler
, dst
, dstw
);
1432 if (src
!= SLJIT_UNUSED
) {
1433 fprintf(compiler
->verbose
, ", ");
1434 sljit_verbose_param(compiler
, src
, srcw
);
1436 fprintf(compiler
->verbose
, ", %s%s\n", JUMP_PREFIX(type
), jump_names
[type
& 0xff]);
1442 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_get_local_base(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
, sljit_sw offset
)
1444 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1445 FUNCTION_CHECK_DST(dst
, dstw
);
1447 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1448 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1449 fprintf(compiler
->verbose
, " local_base ");
1450 sljit_verbose_param(compiler
, dst
, dstw
);
1451 fprintf(compiler
->verbose
, ", #%" SLJIT_PRINT_D
"d\n", offset
);
1457 static SLJIT_INLINE CHECK_RETURN_TYPE
check_sljit_emit_const(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
, sljit_sw init_value
)
1459 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1460 FUNCTION_CHECK_DST(dst
, dstw
);
1462 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1463 if (SLJIT_UNLIKELY(!!compiler
->verbose
)) {
1464 fprintf(compiler
->verbose
, " const ");
1465 sljit_verbose_param(compiler
, dst
, dstw
);
1466 fprintf(compiler
->verbose
, ", #%" SLJIT_PRINT_D
"d\n", init_value
);
1472 #endif /* SLJIT_ARGUMENT_CHECKS || SLJIT_VERBOSE */
1474 #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
1475 SLJIT_COMPILE_ASSERT(!(SLJIT_CONVW_FROMD & 0x1) && !(SLJIT_CONVD_FROMW & 0x1), \
1476 invalid_float_opcodes); \
1477 if (GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_DCMP) { \
1478 if (GET_OPCODE(op) == SLJIT_DCMP) { \
1479 CHECK(check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw)); \
1480 ADJUST_LOCAL_OFFSET(dst, dstw); \
1481 ADJUST_LOCAL_OFFSET(src, srcw); \
1482 return sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
1484 if ((GET_OPCODE(op) | 0x1) == SLJIT_CONVI_FROMD) { \
1485 CHECK(check_sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw)); \
1486 ADJUST_LOCAL_OFFSET(dst, dstw); \
1487 ADJUST_LOCAL_OFFSET(src, srcw); \
1488 return sljit_emit_fop1_convw_fromd(compiler, op, dst, dstw, src, srcw); \
1490 CHECK(check_sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw)); \
1491 ADJUST_LOCAL_OFFSET(dst, dstw); \
1492 ADJUST_LOCAL_OFFSET(src, srcw); \
1493 return sljit_emit_fop1_convd_fromw(compiler, op, dst, dstw, src, srcw); \
1495 CHECK(check_sljit_emit_fop1(compiler, op, dst, dstw, src, srcw)); \
1496 ADJUST_LOCAL_OFFSET(dst, dstw); \
1497 ADJUST_LOCAL_OFFSET(src, srcw);
1499 static SLJIT_INLINE sljit_si
emit_mov_before_return(struct sljit_compiler
*compiler
, sljit_si op
, sljit_si src
, sljit_sw srcw
)
1501 /* Return if don't need to do anything. */
1502 if (op
== SLJIT_UNUSED
)
1503 return SLJIT_SUCCESS
;
1505 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1506 /* At the moment the pointer size is always equal to sljit_sw. May be changed in the future. */
1507 if (src
== SLJIT_RETURN_REG
&& (op
== SLJIT_MOV
|| op
== SLJIT_MOV_P
))
1508 return SLJIT_SUCCESS
;
1510 if (src
== SLJIT_RETURN_REG
&& (op
== SLJIT_MOV
|| op
== SLJIT_MOV_UI
|| op
== SLJIT_MOV_SI
|| op
== SLJIT_MOV_P
))
1511 return SLJIT_SUCCESS
;
1514 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) \
1515 || (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1516 compiler
->skip_checks
= 1;
1518 return sljit_emit_op1(compiler
, op
, SLJIT_RETURN_REG
, 0, src
, srcw
);
1521 /* CPU description section */
1523 #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
1524 #define SLJIT_CPUINFO_PART1 " 32bit ("
1525 #elif (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1526 #define SLJIT_CPUINFO_PART1 " 64bit ("
1528 #error "Internal error: CPU type info missing"
1531 #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
1532 #define SLJIT_CPUINFO_PART2 "little endian + "
1533 #elif (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)
1534 #define SLJIT_CPUINFO_PART2 "big endian + "
1536 #error "Internal error: CPU type info missing"
1539 #if (defined SLJIT_UNALIGNED && SLJIT_UNALIGNED)
1540 #define SLJIT_CPUINFO_PART3 "unaligned)"
1542 #define SLJIT_CPUINFO_PART3 "aligned)"
1545 #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1547 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
1548 # include "sljitNativeX86_common.c"
1549 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1550 # include "sljitNativeARM_32.c"
1551 #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1552 # include "sljitNativeARM_32.c"
1553 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1554 # include "sljitNativeARM_T2_32.c"
1555 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1556 # include "sljitNativeARM_64.c"
1557 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
1558 # include "sljitNativePPC_common.c"
1559 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
1560 # include "sljitNativeMIPS_common.c"
1561 #elif (defined SLJIT_CONFIG_SPARC && SLJIT_CONFIG_SPARC)
1562 # include "sljitNativeSPARC_common.c"
1563 #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
1564 # include "sljitNativeTILEGX_64.c"
1567 #if !(defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
1569 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_jump
* sljit_emit_cmp(struct sljit_compiler
*compiler
, sljit_si type
,
1570 sljit_si src1
, sljit_sw src1w
,
1571 sljit_si src2
, sljit_sw src2w
)
1573 /* Default compare for most architectures. */
1574 sljit_si flags
, tmp_src
, condition
;
1578 CHECK_PTR(check_sljit_emit_cmp(compiler
, type
, src1
, src1w
, src2
, src2w
));
1580 condition
= type
& 0xff;
1581 #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
1582 if ((condition
== SLJIT_EQUAL
|| condition
== SLJIT_NOT_EQUAL
)) {
1583 if ((src1
& SLJIT_IMM
) && !src1w
) {
1589 if ((src2
& SLJIT_IMM
) && !src2w
)
1590 return emit_cmp_to0(compiler
, type
, src1
, src1w
);
1594 if (SLJIT_UNLIKELY((src1
& SLJIT_IMM
) && !(src2
& SLJIT_IMM
))) {
1595 /* Immediate is prefered as second argument by most architectures. */
1596 switch (condition
) {
1598 condition
= SLJIT_GREATER
;
1600 case SLJIT_GREATER_EQUAL
:
1601 condition
= SLJIT_LESS_EQUAL
;
1604 condition
= SLJIT_LESS
;
1606 case SLJIT_LESS_EQUAL
:
1607 condition
= SLJIT_GREATER_EQUAL
;
1609 case SLJIT_SIG_LESS
:
1610 condition
= SLJIT_SIG_GREATER
;
1612 case SLJIT_SIG_GREATER_EQUAL
:
1613 condition
= SLJIT_SIG_LESS_EQUAL
;
1615 case SLJIT_SIG_GREATER
:
1616 condition
= SLJIT_SIG_LESS
;
1618 case SLJIT_SIG_LESS_EQUAL
:
1619 condition
= SLJIT_SIG_GREATER_EQUAL
;
1622 type
= condition
| (type
& (SLJIT_INT_OP
| SLJIT_REWRITABLE_JUMP
));
1631 if (condition
<= SLJIT_NOT_ZERO
)
1632 flags
= SLJIT_SET_E
;
1633 else if (condition
<= SLJIT_LESS_EQUAL
)
1634 flags
= SLJIT_SET_U
;
1636 flags
= SLJIT_SET_S
;
1638 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
1639 || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1640 compiler
->skip_checks
= 1;
1642 PTR_FAIL_IF(sljit_emit_op2(compiler
, SLJIT_SUB
| flags
| (type
& SLJIT_INT_OP
),
1643 SLJIT_UNUSED
, 0, src1
, src1w
, src2
, src2w
));
1644 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
1645 || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1646 compiler
->skip_checks
= 1;
1648 return sljit_emit_jump(compiler
, condition
| (type
& SLJIT_REWRITABLE_JUMP
));
1651 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_jump
* sljit_emit_fcmp(struct sljit_compiler
*compiler
, sljit_si type
,
1652 sljit_si src1
, sljit_sw src1w
,
1653 sljit_si src2
, sljit_sw src2w
)
1655 sljit_si flags
, condition
;
1658 CHECK_PTR(check_sljit_emit_fcmp(compiler
, type
, src1
, src1w
, src2
, src2w
));
1660 condition
= type
& 0xff;
1661 flags
= (condition
<= SLJIT_D_NOT_EQUAL
) ? SLJIT_SET_E
: SLJIT_SET_S
;
1662 if (type
& SLJIT_SINGLE_OP
)
1663 flags
|= SLJIT_SINGLE_OP
;
1665 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
1666 || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1667 compiler
->skip_checks
= 1;
1669 sljit_emit_fop1(compiler
, SLJIT_DCMP
| flags
, src1
, src1w
, src2
, src2w
);
1671 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
1672 || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1673 compiler
->skip_checks
= 1;
1675 return sljit_emit_jump(compiler
, condition
| (type
& SLJIT_REWRITABLE_JUMP
));
1680 #if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
1682 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_get_local_base(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
, sljit_sw offset
)
1685 CHECK(check_sljit_get_local_base(compiler
, dst
, dstw
, offset
));
1687 ADJUST_LOCAL_OFFSET(SLJIT_MEM1(SLJIT_SP
), offset
);
1688 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
1689 || (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
1690 compiler
->skip_checks
= 1;
1693 return sljit_emit_op2(compiler
, SLJIT_ADD
| SLJIT_KEEP_FLAGS
, dst
, dstw
, SLJIT_SP
, 0, SLJIT_IMM
, offset
);
1694 return sljit_emit_op1(compiler
, SLJIT_MOV
, dst
, dstw
, SLJIT_SP
, 0);
1699 #else /* SLJIT_CONFIG_UNSUPPORTED */
1701 /* Empty function bodies for those machines, which are not (yet) supported. */
1703 SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST
char* sljit_get_platform_name(void)
1705 return "unsupported";
1708 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_compiler
* sljit_create_compiler(void)
1710 SLJIT_ASSERT_STOP();
1714 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_compiler(struct sljit_compiler
*compiler
)
1716 SLJIT_UNUSED_ARG(compiler
);
1717 SLJIT_ASSERT_STOP();
1720 SLJIT_API_FUNC_ATTRIBUTE
void* sljit_alloc_memory(struct sljit_compiler
*compiler
, sljit_si size
)
1722 SLJIT_UNUSED_ARG(compiler
);
1723 SLJIT_UNUSED_ARG(size
);
1724 SLJIT_ASSERT_STOP();
1728 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1729 SLJIT_API_FUNC_ATTRIBUTE
void sljit_compiler_verbose(struct sljit_compiler
*compiler
, FILE* verbose
)
1731 SLJIT_UNUSED_ARG(compiler
);
1732 SLJIT_UNUSED_ARG(verbose
);
1733 SLJIT_ASSERT_STOP();
1737 SLJIT_API_FUNC_ATTRIBUTE
void* sljit_generate_code(struct sljit_compiler
*compiler
)
1739 SLJIT_UNUSED_ARG(compiler
);
1740 SLJIT_ASSERT_STOP();
1744 SLJIT_API_FUNC_ATTRIBUTE
void sljit_free_code(void* code
)
1746 SLJIT_UNUSED_ARG(code
);
1747 SLJIT_ASSERT_STOP();
1750 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_enter(struct sljit_compiler
*compiler
,
1751 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
1752 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
1754 SLJIT_UNUSED_ARG(compiler
);
1755 SLJIT_UNUSED_ARG(options
);
1756 SLJIT_UNUSED_ARG(args
);
1757 SLJIT_UNUSED_ARG(scratches
);
1758 SLJIT_UNUSED_ARG(saveds
);
1759 SLJIT_UNUSED_ARG(fscratches
);
1760 SLJIT_UNUSED_ARG(fsaveds
);
1761 SLJIT_UNUSED_ARG(local_size
);
1762 SLJIT_ASSERT_STOP();
1763 return SLJIT_ERR_UNSUPPORTED
;
1766 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_set_context(struct sljit_compiler
*compiler
,
1767 sljit_si options
, sljit_si args
, sljit_si scratches
, sljit_si saveds
,
1768 sljit_si fscratches
, sljit_si fsaveds
, sljit_si local_size
)
1770 SLJIT_UNUSED_ARG(compiler
);
1771 SLJIT_UNUSED_ARG(options
);
1772 SLJIT_UNUSED_ARG(args
);
1773 SLJIT_UNUSED_ARG(scratches
);
1774 SLJIT_UNUSED_ARG(saveds
);
1775 SLJIT_UNUSED_ARG(fscratches
);
1776 SLJIT_UNUSED_ARG(fsaveds
);
1777 SLJIT_UNUSED_ARG(local_size
);
1778 SLJIT_ASSERT_STOP();
1779 return SLJIT_ERR_UNSUPPORTED
;
1782 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_return(struct sljit_compiler
*compiler
, sljit_si op
, sljit_si src
, sljit_sw srcw
)
1784 SLJIT_UNUSED_ARG(compiler
);
1785 SLJIT_UNUSED_ARG(op
);
1786 SLJIT_UNUSED_ARG(src
);
1787 SLJIT_UNUSED_ARG(srcw
);
1788 SLJIT_ASSERT_STOP();
1789 return SLJIT_ERR_UNSUPPORTED
;
1792 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_fast_enter(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
)
1794 SLJIT_UNUSED_ARG(compiler
);
1795 SLJIT_UNUSED_ARG(dst
);
1796 SLJIT_UNUSED_ARG(dstw
);
1797 SLJIT_ASSERT_STOP();
1798 return SLJIT_ERR_UNSUPPORTED
;
1801 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_fast_return(struct sljit_compiler
*compiler
, sljit_si src
, sljit_sw srcw
)
1803 SLJIT_UNUSED_ARG(compiler
);
1804 SLJIT_UNUSED_ARG(src
);
1805 SLJIT_UNUSED_ARG(srcw
);
1806 SLJIT_ASSERT_STOP();
1807 return SLJIT_ERR_UNSUPPORTED
;
1810 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_op0(struct sljit_compiler
*compiler
, sljit_si op
)
1812 SLJIT_UNUSED_ARG(compiler
);
1813 SLJIT_UNUSED_ARG(op
);
1814 SLJIT_ASSERT_STOP();
1815 return SLJIT_ERR_UNSUPPORTED
;
1818 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_op1(struct sljit_compiler
*compiler
, sljit_si op
,
1819 sljit_si dst
, sljit_sw dstw
,
1820 sljit_si src
, sljit_sw srcw
)
1822 SLJIT_UNUSED_ARG(compiler
);
1823 SLJIT_UNUSED_ARG(op
);
1824 SLJIT_UNUSED_ARG(dst
);
1825 SLJIT_UNUSED_ARG(dstw
);
1826 SLJIT_UNUSED_ARG(src
);
1827 SLJIT_UNUSED_ARG(srcw
);
1828 SLJIT_ASSERT_STOP();
1829 return SLJIT_ERR_UNSUPPORTED
;
1832 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_op2(struct sljit_compiler
*compiler
, sljit_si op
,
1833 sljit_si dst
, sljit_sw dstw
,
1834 sljit_si src1
, sljit_sw src1w
,
1835 sljit_si src2
, sljit_sw src2w
)
1837 SLJIT_UNUSED_ARG(compiler
);
1838 SLJIT_UNUSED_ARG(op
);
1839 SLJIT_UNUSED_ARG(dst
);
1840 SLJIT_UNUSED_ARG(dstw
);
1841 SLJIT_UNUSED_ARG(src1
);
1842 SLJIT_UNUSED_ARG(src1w
);
1843 SLJIT_UNUSED_ARG(src2
);
1844 SLJIT_UNUSED_ARG(src2w
);
1845 SLJIT_ASSERT_STOP();
1846 return SLJIT_ERR_UNSUPPORTED
;
1849 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_get_register_index(sljit_si reg
)
1851 SLJIT_ASSERT_STOP();
1855 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_op_custom(struct sljit_compiler
*compiler
,
1856 void *instruction
, sljit_si size
)
1858 SLJIT_UNUSED_ARG(compiler
);
1859 SLJIT_UNUSED_ARG(instruction
);
1860 SLJIT_UNUSED_ARG(size
);
1861 SLJIT_ASSERT_STOP();
1862 return SLJIT_ERR_UNSUPPORTED
;
1865 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_is_fpu_available(void)
1867 SLJIT_ASSERT_STOP();
1871 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_fop1(struct sljit_compiler
*compiler
, sljit_si op
,
1872 sljit_si dst
, sljit_sw dstw
,
1873 sljit_si src
, sljit_sw srcw
)
1875 SLJIT_UNUSED_ARG(compiler
);
1876 SLJIT_UNUSED_ARG(op
);
1877 SLJIT_UNUSED_ARG(dst
);
1878 SLJIT_UNUSED_ARG(dstw
);
1879 SLJIT_UNUSED_ARG(src
);
1880 SLJIT_UNUSED_ARG(srcw
);
1881 SLJIT_ASSERT_STOP();
1882 return SLJIT_ERR_UNSUPPORTED
;
1885 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_fop2(struct sljit_compiler
*compiler
, sljit_si op
,
1886 sljit_si dst
, sljit_sw dstw
,
1887 sljit_si src1
, sljit_sw src1w
,
1888 sljit_si src2
, sljit_sw src2w
)
1890 SLJIT_UNUSED_ARG(compiler
);
1891 SLJIT_UNUSED_ARG(op
);
1892 SLJIT_UNUSED_ARG(dst
);
1893 SLJIT_UNUSED_ARG(dstw
);
1894 SLJIT_UNUSED_ARG(src1
);
1895 SLJIT_UNUSED_ARG(src1w
);
1896 SLJIT_UNUSED_ARG(src2
);
1897 SLJIT_UNUSED_ARG(src2w
);
1898 SLJIT_ASSERT_STOP();
1899 return SLJIT_ERR_UNSUPPORTED
;
1902 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_label
* sljit_emit_label(struct sljit_compiler
*compiler
)
1904 SLJIT_UNUSED_ARG(compiler
);
1905 SLJIT_ASSERT_STOP();
1909 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_jump
* sljit_emit_jump(struct sljit_compiler
*compiler
, sljit_si type
)
1911 SLJIT_UNUSED_ARG(compiler
);
1912 SLJIT_UNUSED_ARG(type
);
1913 SLJIT_ASSERT_STOP();
1917 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_jump
* sljit_emit_cmp(struct sljit_compiler
*compiler
, sljit_si type
,
1918 sljit_si src1
, sljit_sw src1w
,
1919 sljit_si src2
, sljit_sw src2w
)
1921 SLJIT_UNUSED_ARG(compiler
);
1922 SLJIT_UNUSED_ARG(type
);
1923 SLJIT_UNUSED_ARG(src1
);
1924 SLJIT_UNUSED_ARG(src1w
);
1925 SLJIT_UNUSED_ARG(src2
);
1926 SLJIT_UNUSED_ARG(src2w
);
1927 SLJIT_ASSERT_STOP();
1931 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_jump
* sljit_emit_fcmp(struct sljit_compiler
*compiler
, sljit_si type
,
1932 sljit_si src1
, sljit_sw src1w
,
1933 sljit_si src2
, sljit_sw src2w
)
1935 SLJIT_UNUSED_ARG(compiler
);
1936 SLJIT_UNUSED_ARG(type
);
1937 SLJIT_UNUSED_ARG(src1
);
1938 SLJIT_UNUSED_ARG(src1w
);
1939 SLJIT_UNUSED_ARG(src2
);
1940 SLJIT_UNUSED_ARG(src2w
);
1941 SLJIT_ASSERT_STOP();
1945 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_label(struct sljit_jump
*jump
, struct sljit_label
* label
)
1947 SLJIT_UNUSED_ARG(jump
);
1948 SLJIT_UNUSED_ARG(label
);
1949 SLJIT_ASSERT_STOP();
1952 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_target(struct sljit_jump
*jump
, sljit_uw target
)
1954 SLJIT_UNUSED_ARG(jump
);
1955 SLJIT_UNUSED_ARG(target
);
1956 SLJIT_ASSERT_STOP();
1959 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_ijump(struct sljit_compiler
*compiler
, sljit_si type
, sljit_si src
, sljit_sw srcw
)
1961 SLJIT_UNUSED_ARG(compiler
);
1962 SLJIT_UNUSED_ARG(type
);
1963 SLJIT_UNUSED_ARG(src
);
1964 SLJIT_UNUSED_ARG(srcw
);
1965 SLJIT_ASSERT_STOP();
1966 return SLJIT_ERR_UNSUPPORTED
;
1969 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_emit_op_flags(struct sljit_compiler
*compiler
, sljit_si op
,
1970 sljit_si dst
, sljit_sw dstw
,
1971 sljit_si src
, sljit_sw srcw
,
1974 SLJIT_UNUSED_ARG(compiler
);
1975 SLJIT_UNUSED_ARG(op
);
1976 SLJIT_UNUSED_ARG(dst
);
1977 SLJIT_UNUSED_ARG(dstw
);
1978 SLJIT_UNUSED_ARG(src
);
1979 SLJIT_UNUSED_ARG(srcw
);
1980 SLJIT_UNUSED_ARG(type
);
1981 SLJIT_ASSERT_STOP();
1982 return SLJIT_ERR_UNSUPPORTED
;
1985 SLJIT_API_FUNC_ATTRIBUTE sljit_si
sljit_get_local_base(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
, sljit_sw offset
)
1987 SLJIT_UNUSED_ARG(compiler
);
1988 SLJIT_UNUSED_ARG(dst
);
1989 SLJIT_UNUSED_ARG(dstw
);
1990 SLJIT_UNUSED_ARG(offset
);
1991 SLJIT_ASSERT_STOP();
1992 return SLJIT_ERR_UNSUPPORTED
;
1995 SLJIT_API_FUNC_ATTRIBUTE
struct sljit_const
* sljit_emit_const(struct sljit_compiler
*compiler
, sljit_si dst
, sljit_sw dstw
, sljit_sw initval
)
1997 SLJIT_UNUSED_ARG(compiler
);
1998 SLJIT_UNUSED_ARG(dst
);
1999 SLJIT_UNUSED_ARG(dstw
);
2000 SLJIT_UNUSED_ARG(initval
);
2001 SLJIT_ASSERT_STOP();
2005 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_jump_addr(sljit_uw addr
, sljit_uw new_addr
)
2007 SLJIT_UNUSED_ARG(addr
);
2008 SLJIT_UNUSED_ARG(new_addr
);
2009 SLJIT_ASSERT_STOP();
2012 SLJIT_API_FUNC_ATTRIBUTE
void sljit_set_const(sljit_uw addr
, sljit_sw new_constant
)
2014 SLJIT_UNUSED_ARG(addr
);
2015 SLJIT_UNUSED_ARG(new_constant
);
2016 SLJIT_ASSERT_STOP();