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

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

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

revision 1194 by zherczeg, Sun Oct 28 05:22:32 2012 UTC revision 1195 by zherczeg, Thu Nov 1 15:21:27 2012 UTC
# Line 153  of sljitConfigInternal.h */ Line 153  of sljitConfigInternal.h */
153  #define SLJIT_FLOAT_REG2        2  #define SLJIT_FLOAT_REG2        2
154  #define SLJIT_FLOAT_REG3        3  #define SLJIT_FLOAT_REG3        3
155  #define SLJIT_FLOAT_REG4        4  #define SLJIT_FLOAT_REG4        4
156    #define SLJIT_FLOAT_REG5        5
157    #define SLJIT_FLOAT_REG6        6
158    
159  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
160  /*  Main structures and functions                                        */  /*  Main structures and functions                                        */
# Line 161  of sljitConfigInternal.h */ Line 163  of sljitConfigInternal.h */
163  struct sljit_memory_fragment {  struct sljit_memory_fragment {
164          struct sljit_memory_fragment *next;          struct sljit_memory_fragment *next;
165          sljit_uw used_size;          sljit_uw used_size;
166            /* Must be aligned to sljit_sw. */
167          sljit_ub memory[1];          sljit_ub memory[1];
168  };  };
169    
# Line 174  struct sljit_label { Line 177  struct sljit_label {
177  struct sljit_jump {  struct sljit_jump {
178          struct sljit_jump *next;          struct sljit_jump *next;
179          sljit_uw addr;          sljit_uw addr;
180          sljit_w flags;          sljit_sw flags;
181          union {          union {
182                  sljit_uw target;                  sljit_uw target;
183                  struct sljit_label* label;                  struct sljit_label* label;
# Line 187  struct sljit_const { Line 190  struct sljit_const {
190  };  };
191    
192  struct sljit_compiler {  struct sljit_compiler {
193          int error;          sljit_si error;
194    
195          struct sljit_label *labels;          struct sljit_label *labels;
196          struct sljit_jump *jumps;          struct sljit_jump *jumps;
# Line 200  struct sljit_compiler { Line 203  struct sljit_compiler {
203          struct sljit_memory_fragment *abuf;          struct sljit_memory_fragment *abuf;
204    
205          /* Used local registers. */          /* Used local registers. */
206          int temporaries;          sljit_si temporaries;
207          /* Used saved registers. */          /* Used saved registers. */
208          int saveds;          sljit_si saveds;
209          /* Local stack size. */          /* Local stack size. */
210          int local_size;          sljit_si local_size;
211          /* Code size. */          /* Code size. */
212          sljit_uw size;          sljit_uw size;
213          /* For statistical purposes. */          /* For statistical purposes. */
214          sljit_uw executable_size;          sljit_uw executable_size;
215    
216  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
217          int args;          sljit_si args;
218          int locals_offset;          sljit_si locals_offset;
219          int temporaries_start;          sljit_si temporaries_start;
220          int saveds_start;          sljit_si saveds_start;
221  #endif  #endif
222    
223  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
224          int mode32;          sljit_si mode32;
225  #endif  #endif
226    
227  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
228          int flags_saved;          sljit_si flags_saved;
229  #endif  #endif
230    
231  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)  #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
# Line 239  struct sljit_compiler { Line 242  struct sljit_compiler {
242  #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)
243          /* Temporary fields. */          /* Temporary fields. */
244          sljit_uw shift_imm;          sljit_uw shift_imm;
245          int cache_arg;          sljit_si cache_arg;
246          sljit_w cache_argw;          sljit_sw cache_argw;
247  #endif  #endif
248    
249  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
250          int cache_arg;          sljit_si cache_arg;
251          sljit_w cache_argw;          sljit_sw cache_argw;
252  #endif  #endif
253    
254  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
255          sljit_w imm;          sljit_sw imm;
256          int cache_arg;          sljit_si cache_arg;
257          sljit_w cache_argw;          sljit_sw cache_argw;
258  #endif  #endif
259    
260  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
261          int delay_slot;          sljit_si delay_slot;
262          int cache_arg;          sljit_si cache_arg;
263          sljit_w cache_argw;          sljit_sw cache_argw;
264  #endif  #endif
265    
266  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
267          int delay_slot;          sljit_si delay_slot;
268          int cache_arg;          sljit_si cache_arg;
269          sljit_w cache_argw;          sljit_sw cache_argw;
270  #endif  #endif
271    
272  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
# Line 272  struct sljit_compiler { Line 275  struct sljit_compiler {
275    
276  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
277          /* Local size passed to the functions. */          /* Local size passed to the functions. */
278          int logical_local_size;          sljit_si logical_local_size;
279  #endif  #endif
280    
281  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
282          int skip_checks;          sljit_si skip_checks;
283  #endif  #endif
284  };  };
285    
# Line 290  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 293  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
293  /* Free everything except the codes. */  /* Free everything except the codes. */
294  SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler);  SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler);
295    
296  static SLJIT_INLINE int sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }  static SLJIT_INLINE sljit_si sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }
297    
298  /*  /*
299     Allocate a small amount of memory. The size must be <= 64 bytes on 32 bit,     Allocate a small amount of memory. The size must be <= 64 bytes on 32 bit,
300     and <= 128 bytes on 64 bit architectures. The memory area is owned by the compiler,     and <= 128 bytes on 64 bit architectures. The memory area is owned by the compiler,
301     and freed by sljit_free_compiler. The returned pointer is sizeof(sljit_w) aligned.     and freed by sljit_free_compiler. The returned pointer is sizeof(sljit_sw) aligned.
302     Excellent for allocating small blocks during the compiling, and no need to worry     Excellent for allocating small blocks during the compiling, and no need to worry
303     about freeing them. The size is enough to contain at most 16 pointers.     about freeing them. The size is enough to contain at most 16 pointers.
304     If the size is outside of the range, the function will return with NULL,     If the size is outside of the range, the function will return with NULL,
305     but this return value does not indicate that there is no more memory (does     but this return value does not indicate that there is no more memory (does
306     not set the compiler to out-of-memory status).     not set the compiler to out-of-memory status).
307  */  */
308  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);
309    
310  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
311  /* Passing NULL disables verbose. */  /* Passing NULL disables verbose. */
# Line 349  static SLJIT_INLINE sljit_uw sljit_get_g Line 352  static SLJIT_INLINE sljit_uw sljit_get_g
352    
353  #define SLJIT_MAX_LOCAL_SIZE    65536  #define SLJIT_MAX_LOCAL_SIZE    65536
354    
355  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler,
356          int args, int temporaries, int saveds, int local_size);          sljit_si args, sljit_si temporaries, sljit_si saveds, sljit_si local_size);
357    
358  /* The machine code has a context (which contains the local stack space size,  /* The machine code has a context (which contains the local stack space size,
359     number of used registers, etc.) which initialized by sljit_emit_enter. Several     number of used registers, etc.) which initialized by sljit_emit_enter. Several
# Line 365  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 368  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
368  /* Note: multiple calls of this function overwrites the previous call. */  /* Note: multiple calls of this function overwrites the previous call. */
369    
370  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,
371          int args, int temporaries, int saveds, int local_size);          sljit_si args, sljit_si temporaries, sljit_si saveds, sljit_si local_size);
372    
373  /* Return from machine code.  The op argument can be SLJIT_UNUSED which means the  /* Return from machine code.  The op argument can be SLJIT_UNUSED which means the
374     function does not return with anything or any opcode between SLJIT_MOV and     function does not return with anything or any opcode between SLJIT_MOV and
375     SLJIT_MOV_P (see sljit_emit_op1). As for src and srcw they must be 0 if op     SLJIT_MOV_P (see sljit_emit_op1). As for src and srcw they must be 0 if op
376     is SLJIT_UNUSED, otherwise see below the description about source and     is SLJIT_UNUSED, otherwise see below the description about source and
377     destination arguments. */     destination arguments. */
378  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op,
379          int src, sljit_w srcw);          sljit_si src, sljit_sw srcw);
380    
381  /* Really fast calling method for utility functions inside sljit (see SLJIT_FAST_CALL).  /* Really fast calling method for utility functions inside sljit (see SLJIT_FAST_CALL).
382     All registers and even the stack frame is passed to the callee. The return address is     All registers and even the stack frame is passed to the callee. The return address is
# Line 390  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 393  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
393  /* Note: although sljit_emit_fast_return could be replaced by an ijump, it is not suggested,  /* Note: although sljit_emit_fast_return could be replaced by an ijump, it is not suggested,
394     since many architectures do clever branch prediction on call / return instruction pairs. */     since many architectures do clever branch prediction on call / return instruction pairs. */
395    
396  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw);  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw);
397  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);
398    
399  /*  /*
400     Source and destination values for arithmetical instructions     Source and destination values for arithmetical instructions
# Line 400  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 403  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
403      [imm]            - absolute immediate memory address      [imm]            - absolute immediate memory address
404      [reg+imm]        - indirect memory address      [reg+imm]        - indirect memory address
405      [reg+(reg<<imm)] - indirect indexed memory address (shift must be between 0 and 3)      [reg+(reg<<imm)] - indirect indexed memory address (shift must be between 0 and 3)
406                         useful for (byte, half, int, sljit_w) array access                         useful for (byte, half, int, sljit_sw) array access
407                         (fully supported by both x86 and ARM architectures, and cheap operation on others)                         (fully supported by both x86 and ARM architectures, and cheap operation on others)
408  */  */
409    
# Line 410  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 413  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
413    
414       length | alignment       length | alignment
415     ---------+-----------     ---------+-----------
416       byte   | 1 byte (not aligned)       byte   | 1 byte (any physical_address is accepted)
417       half   | 2 byte (real_address & 0x1 == 0)       half   | 2 byte (physical_address & 0x1 == 0)
418       int    | 4 byte (real_address & 0x3 == 0)       int    | 4 byte (physical_address & 0x3 == 0)
419      sljit_w | 4 byte if SLJIT_32BIT_ARCHITECTURE is defined and its value is 1       word   | 4 byte if SLJIT_32BIT_ARCHITECTURE is defined and its value is 1
420              | 8 byte if SLJIT_64BIT_ARCHITECTURE is defined and its value is 1              | 8 byte if SLJIT_64BIT_ARCHITECTURE is defined and its value is 1
421        pointer | size of sljit_p type (4 byte on 32 bit machines, 4 or 8 byte
422                | on 64 bit machines)
423    
424     Note: different architectures have different addressing limitations     Note:   Different architectures have different addressing limitations.
425           Thus sljit may generate several instructions for other addressing modes             A single instruction is enough for the following addressing
426     x86:  all addressing modes supported, but write-back is not supported             modes. Other adrressing modes are emulated by instruction
427           (requires an extra instruction). On x86-64 only 32 bit signed             sequences. This information could help to improve those code
428           integers are supported by the architecture.             generators which focuses only a few architectures.
429     arm:  [reg+imm] supported for small immediates (-4095 <= imm <= 4095  
430           or -255 <= imm <= 255 for loading signed bytes, any halfs or doubles)     x86:    [reg+imm], -2^32+1 <= imm <= 2^32-1 (full adress space on x86-32)
431           [reg+(reg<<imm)] are supported or requires only two instructions             [reg+(reg<<imm)] is supported
432           Write back is limited to small immediates on thumb2             [imm], -2^32+1 <= imm <= 2^32-1 is supported
433     ppc:  [reg+imm], -65535 <= imm <= 65535. 64 bit moves requires immediates             Write-back is not supported
434           divisible by 4. [reg+reg] supported, write-back supported     arm:    [reg+imm], -4095 <= imm <= 4095 or -255 <= imm <= 255 for signed
435           [reg+(reg<<imm)] (imm != 0) is cheap (requires two instructions)                  bytes, any halfs or floating point values)
436               [reg+(reg<<imm)] is supported
437               Write-back is supported
438       arm-t2: [reg+imm], -255 <= imm <= 4095
439               [reg+(reg<<imm)] is supported
440               Write back is supported only for [reg+imm], where -255 <= imm <= 255
441       ppc:    [reg+imm], -65536 <= imm <= 65535. 64 bit loads/stores and 32 bit
442                    signed load on 64 bit requires immediates divisible by 4.
443                    [reg+imm] is not supported for signed 8 bit values.
444               [reg+reg] is supported
445               Write-back is supported except for one instruction: 32 bit signed
446                    load with [reg+imm] addressing mode on 64 bit.
447       mips:   [reg+imm], -65536 <= imm <= 65535
448               Nothing else is supported
449       sparc:  [reg+imm], -4096 <= imm <= 4095
450               [reg+reg] is supported
451               Nothing else is supported
452  */  */
453    
454  /* Register output: simply the name of the register.  /* Register output: simply the name of the register.
# Line 439  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 460  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
460  #define SLJIT_IMM               0x200  #define SLJIT_IMM               0x200
461    
462  /* Set 32 bit operation mode (I) on 64 bit CPUs. The flag is totally ignored on  /* Set 32 bit operation mode (I) on 64 bit CPUs. The flag is totally ignored on
463     32 bit CPUs. The arithmetic instruction uses only the lower 32 bit of the     32 bit CPUs. If this flag is set for an arithmetic operation, it uses only the
464     input register(s), and set the flags according to the 32 bit result. If the     lower 32 bit of the input register(s), and set the CPU status flags according
465     destination is a register, the higher 32 bit of the result is undefined.     to the 32 bit result. The higher 32 bits are undefined for both the input and
466     The addressing modes (SLJIT_MEM1/SLJIT_MEM2 macros) are unaffected by this flag. */     output. However, the CPU might not ignore those higher 32 bits, like MIPS, which
467       expects it to be the sign extension of the lower 32 bit. All 32 bit operations
468       are undefined, if this condition is not fulfilled. Therefore, when SLJIT_INT_OP
469       is specified, all register arguments must be the result of other operations with
470       the same SLJIT_INT_OP flag. In other words, although a register can hold either
471       a 64 or 32 bit value, these values cannot be mixed. The only exceptions are
472       SLJIT_IMOV and SLJIT_IMOVU (SLJIT_MOV_SI/SLJIT_MOV_UI/SLJIT_MOVU_SI/SLJIT_MOV_UI
473       with SLJIT_INT_OP flag) which can convert any source argument to SLJIT_INT_OP
474       compatible result. This conversion might be unnecessary on some CPUs like x86-64,
475       since the upper 32 bit is always ignored. In this case SLJIT is clever enough
476       to not generate any instructions if the source and destination operands are the
477       same registers. Affects sljit_emit_op0, sljit_emit_op1 and sljit_emit_op2. */
478  #define SLJIT_INT_OP            0x100  #define SLJIT_INT_OP            0x100
479    
480    /* Single precision mode (SP). This flag is similar to SLJIT_INT_OP, just
481       it applies to floating point registers (it is even the same bit). When
482       this flag is passed, the CPU performs single precision floating point
483       operations. Similar to SLJIT_INT_OP, all register arguments must be the
484       result of other floating point operations with this flag. Affects
485       sljit_emit_fop1, sljit_emit_fop2 and sljit_emit_fcmp. */
486    #define SLJIT_SINGLE_OP         0x100
487    
488  /* Common CPU status flags for all architectures (x86, ARM, PPC)  /* Common CPU status flags for all architectures (x86, ARM, PPC)
489      - carry flag      - carry flag
490      - overflow flag      - overflow flag
# Line 486  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 526  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
526     Note: may or may not cause an extra cycle wait     Note: may or may not cause an extra cycle wait
527           it can even decrease the runtime in a few cases. */           it can even decrease the runtime in a few cases. */
528  #define SLJIT_NOP                       1  #define SLJIT_NOP                       1
529  /* Flags: may destroy flags  /* Flags: - (may destroy flags)
530     Unsigned multiplication of SLJIT_TEMPORARY_REG1 and SLJIT_TEMPORARY_REG2.     Unsigned multiplication of SLJIT_TEMPORARY_REG1 and SLJIT_TEMPORARY_REG2.
531     Result goes to SLJIT_TEMPORARY_REG2:SLJIT_TEMPORARY_REG1 (high:low) word */     Result goes to SLJIT_TEMPORARY_REG2:SLJIT_TEMPORARY_REG1 (high:low) word */
532  #define SLJIT_UMUL                      2  #define SLJIT_UMUL                      2
533  /* Flags: may destroy flags  /* Flags: - (may destroy flags)
534     Signed multiplication of SLJIT_TEMPORARY_REG1 and SLJIT_TEMPORARY_REG2.     Signed multiplication of SLJIT_TEMPORARY_REG1 and SLJIT_TEMPORARY_REG2.
535     Result goes to SLJIT_TEMPORARY_REG2:SLJIT_TEMPORARY_REG1 (high:low) word */     Result goes to SLJIT_TEMPORARY_REG2:SLJIT_TEMPORARY_REG1 (high:low) word */
536  #define SLJIT_SMUL                      3  #define SLJIT_SMUL                      3
537  /* Flags: I | may destroy flags  /* Flags: I - (may destroy flags)
538     Unsigned divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.     Unsigned divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.
539     The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.     The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.
540     Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */     Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */
541  #define SLJIT_UDIV                      4  #define SLJIT_UDIV                      4
542  /* Flags: I | may destroy flags  #define SLJIT_IUDIV                     (SLJIT_UDIV | SLJIT_INT_OP)
543    /* Flags: I - (may destroy flags)
544     Signed divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.     Signed divide of the value in SLJIT_TEMPORARY_REG1 by the value in SLJIT_TEMPORARY_REG2.
545     The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.     The result is placed in SLJIT_TEMPORARY_REG1 and the remainder goes to SLJIT_TEMPORARY_REG2.
546     Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */     Note: if SLJIT_TEMPORARY_REG2 contains 0, the behaviour is undefined. */
547  #define SLJIT_SDIV                      5  #define SLJIT_SDIV                      5
548    #define SLJIT_ISDIV                     (SLJIT_SDIV | SLJIT_INT_OP)
549    
550  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);
551    
552  /* Notes for MOV instructions:  /* Notes for MOV instructions:
553     U = Mov with update (post form). If source or destination defined as SLJIT_MEM1(r1)     U = Mov with update (post form). If source or destination defined as SLJIT_MEM1(r1)
# Line 520  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 562  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
562    
563  /* Flags: - (never set any flags) */  /* Flags: - (never set any flags) */
564  #define SLJIT_MOV                       6  #define SLJIT_MOV                       6
565  /* Flags: - (never set any flags) */  /* Flags: I - (never set any flags) */
566  #define SLJIT_MOV_UB                    7  #define SLJIT_MOV_UB                    7
567  /* Flags: - (never set any flags) */  #define SLJIT_IMOV_UB                   (SLJIT_MOV_UB | SLJIT_INT_OP)
568    /* Flags: I - (never set any flags) */
569  #define SLJIT_MOV_SB                    8  #define SLJIT_MOV_SB                    8
570  /* Flags: - (never set any flags) */  #define SLJIT_IMOV_SB                   (SLJIT_MOV_SB | SLJIT_INT_OP)
571    /* Flags: I - (never set any flags) */
572  #define SLJIT_MOV_UH                    9  #define SLJIT_MOV_UH                    9
573  /* Flags: - (never set any flags) */  #define SLJIT_IMOV_UH                   (SLJIT_MOV_UH | SLJIT_INT_OP)
574    /* Flags: I - (never set any flags) */
575  #define SLJIT_MOV_SH                    10  #define SLJIT_MOV_SH                    10
576  /* Flags: - (never set any flags) */  #define SLJIT_IMOV_SH                   (SLJIT_MOV_SH | SLJIT_INT_OP)
577    /* Flags: I - (never set any flags)
578       Note: see SLJIT_INT_OP for further details. */
579  #define SLJIT_MOV_UI                    11  #define SLJIT_MOV_UI                    11
580  /* Flags: - (never set any flags) */  /* No SLJIT_INT_OP form, since it the same as SLJIT_IMOVU. */
581    /* Flags: I - (never set any flags)
582       Note: see SLJIT_INT_OP for further details. */
583  #define SLJIT_MOV_SI                    12  #define SLJIT_MOV_SI                    12
584    #define SLJIT_IMOV                      (SLJIT_MOV_SI | SLJIT_INT_OP)
585  /* Flags: - (never set any flags) */  /* Flags: - (never set any flags) */
586  #define SLJIT_MOV_P                     13  #define SLJIT_MOV_P                     13
587  /* Flags: - (never set any flags) */  /* Flags: - (never set any flags) */
588  #define SLJIT_MOVU                      14  #define SLJIT_MOVU                      14
589  /* Flags: - (never set any flags) */  /* Flags: I - (never set any flags) */
590  #define SLJIT_MOVU_UB                   15  #define SLJIT_MOVU_UB                   15
591  /* Flags: - (never set any flags) */  #define SLJIT_IMOVU_UB                  (SLJIT_MOVU_UB | SLJIT_INT_OP)
592    /* Flags: I - (never set any flags) */
593  #define SLJIT_MOVU_SB                   16  #define SLJIT_MOVU_SB                   16
594  /* Flags: - (never set any flags) */  #define SLJIT_IMOVU_SB                  (SLJIT_MOVU_SB | SLJIT_INT_OP)
595    /* Flags: I - (never set any flags) */
596  #define SLJIT_MOVU_UH                   17  #define SLJIT_MOVU_UH                   17
597  /* Flags: - (never set any flags) */  #define SLJIT_IMOVU_UH                  (SLJIT_MOVU_UH | SLJIT_INT_OP)
598    /* Flags: I - (never set any flags) */
599  #define SLJIT_MOVU_SH                   18  #define SLJIT_MOVU_SH                   18
600  /* Flags: - (never set any flags) */  #define SLJIT_IMOVU_SH                  (SLJIT_MOVU_SH | SLJIT_INT_OP)
601    /* Flags: I - (never set any flags)
602       Note: see SLJIT_INT_OP for further details. */
603  #define SLJIT_MOVU_UI                   19  #define SLJIT_MOVU_UI                   19
604  /* Flags: - (never set any flags) */  /* No SLJIT_INT_OP form, since it the same as SLJIT_IMOVU. */
605    /* Flags: I - (never set any flags)
606       Note: see SLJIT_INT_OP for further details. */
607  #define SLJIT_MOVU_SI                   20  #define SLJIT_MOVU_SI                   20
608    #define SLJIT_IMOVU                     (SLJIT_MOVU_SI | SLJIT_INT_OP)
609  /* Flags: - (never set any flags) */  /* Flags: - (never set any flags) */
610  #define SLJIT_MOVU_P                    21  #define SLJIT_MOVU_P                    21
611  /* Flags: I | E | K */  /* Flags: I | E | K */
612  #define SLJIT_NOT                       22  #define SLJIT_NOT                       22
613    #define SLJIT_INOT                      (SLJIT_NOT | SLJIT_INT_OP)
614  /* Flags: I | E | O | K */  /* Flags: I | E | O | K */
615  #define SLJIT_NEG                       23  #define SLJIT_NEG                       23
616    #define SLJIT_INEG                      (SLJIT_NEG | SLJIT_INT_OP)
617  /* Count leading zeroes  /* Count leading zeroes
618     Flags: I | E | K     Flags: I | E | K
619     Important note! Sparc 32 does not support K flag, since     Important note! Sparc 32 does not support K flag, since
620     the required popc instruction is introduced only in sparc 64. */     the required popc instruction is introduced only in sparc 64. */
621  #define SLJIT_CLZ                       24  #define SLJIT_CLZ                       24
622    #define SLJIT_ICLZ                      (SLJIT_CLZ | SLJIT_INT_OP)
623    
624  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,
625          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
626          int src, sljit_w srcw);          sljit_si src, sljit_sw srcw);
627    
628  /* Flags: I | E | O | C | K */  /* Flags: I | E | O | C | K */
629  #define SLJIT_ADD                       25  #define SLJIT_ADD                       25
630    #define SLJIT_IADD                      (SLJIT_ADD | SLJIT_INT_OP)
631  /* Flags: I | C | K */  /* Flags: I | C | K */
632  #define SLJIT_ADDC                      26  #define SLJIT_ADDC                      26
633    #define SLJIT_IADDC                     (SLJIT_ADDC | SLJIT_INT_OP)
634  /* Flags: I | E | S | U | O | C | K */  /* Flags: I | E | S | U | O | C | K */
635  #define SLJIT_SUB                       27  #define SLJIT_SUB                       27
636    #define SLJIT_ISUB                      (SLJIT_SUB | SLJIT_INT_OP)
637  /* Flags: I | C | K */  /* Flags: I | C | K */
638  #define SLJIT_SUBC                      28  #define SLJIT_SUBC                      28
639    #define SLJIT_ISUBC                     (SLJIT_SUBC | SLJIT_INT_OP)
640  /* Note: integer mul  /* Note: integer mul
641     Flags: I | O (see SLJIT_C_MUL_*) | K */     Flags: I | O (see SLJIT_C_MUL_*) | K */
642  #define SLJIT_MUL                       29  #define SLJIT_MUL                       29
643    #define SLJIT_IMUL                      (SLJIT_MUL | SLJIT_INT_OP)
644  /* Flags: I | E | K */  /* Flags: I | E | K */
645  #define SLJIT_AND                       30  #define SLJIT_AND                       30
646    #define SLJIT_IAND                      (SLJIT_AND | SLJIT_INT_OP)
647  /* Flags: I | E | K */  /* Flags: I | E | K */
648  #define SLJIT_OR                        31  #define SLJIT_OR                        31
649    #define SLJIT_IOR                       (SLJIT_OR | SLJIT_INT_OP)
650  /* Flags: I | E | K */  /* Flags: I | E | K */
651  #define SLJIT_XOR                       32  #define SLJIT_XOR                       32
652    #define SLJIT_IXOR                      (SLJIT_XOR | SLJIT_INT_OP)
653  /* Flags: I | E | K  /* Flags: I | E | K
654     Let bit_length be the length of the shift operation: 32 or 64.     Let bit_length be the length of the shift operation: 32 or 64.
655     If src2 is immediate, src2w is masked by (bit_length - 1).     If src2 is immediate, src2w is masked by (bit_length - 1).
656     Otherwise, if the content of src2 is outside the range from 0     Otherwise, if the content of src2 is outside the range from 0
657     to bit_length - 1, the operation is undefined. */     to bit_length - 1, the operation is undefined. */
658  #define SLJIT_SHL                       33  #define SLJIT_SHL                       33
659    #define SLJIT_ISHL                      (SLJIT_SHL | SLJIT_INT_OP)
660  /* Flags: I | E | K  /* Flags: I | E | K
661     Let bit_length be the length of the shift operation: 32 or 64.     Let bit_length be the length of the shift operation: 32 or 64.
662     If src2 is immediate, src2w is masked by (bit_length - 1).     If src2 is immediate, src2w is masked by (bit_length - 1).
663     Otherwise, if the content of src2 is outside the range from 0     Otherwise, if the content of src2 is outside the range from 0
664     to bit_length - 1, the operation is undefined. */     to bit_length - 1, the operation is undefined. */
665  #define SLJIT_LSHR                      34  #define SLJIT_LSHR                      34
666    #define SLJIT_ILSHR                     (SLJIT_LSHR | SLJIT_INT_OP)
667  /* Flags: I | E | K  /* Flags: I | E | K
668     Let bit_length be the length of the shift operation: 32 or 64.     Let bit_length be the length of the shift operation: 32 or 64.
669     If src2 is immediate, src2w is masked by (bit_length - 1).     If src2 is immediate, src2w is masked by (bit_length - 1).
670     Otherwise, if the content of src2 is outside the range from 0     Otherwise, if the content of src2 is outside the range from 0
671     to bit_length - 1, the operation is undefined. */     to bit_length - 1, the operation is undefined. */
672  #define SLJIT_ASHR                      35  #define SLJIT_ASHR                      35
673    #define SLJIT_IASHR                     (SLJIT_ASHR | SLJIT_INT_OP)
674    
675  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,
676          int dst, sljit_w dstw,          sljit_si dst, sljit_sw dstw,
677          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
678          int src2, sljit_w src2w);          sljit_si src2, sljit_sw src2w);
679    
680  /* The following function is a helper function for sljit_emit_op_custom.  /* The following function is a helper function for sljit_emit_op_custom.
681     It returns with the real machine register index of any SLJIT_TEMPORARY     It returns with the real machine register index of any SLJIT_TEMPORARY
# Line 612  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 684  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
684     Note: register returned by SLJIT_LOCALS_REG is not necessary the real     Note: register returned by SLJIT_LOCALS_REG is not necessary the real
685           stack pointer register of the target architecture. */           stack pointer register of the target architecture. */
686    
687  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg);  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg);
688    
689  /* Any instruction can be inserted into the instruction stream by  /* Any instruction can be inserted into the instruction stream by
690     sljit_emit_op_custom. It has a similar purpose as inline assembly.     sljit_emit_op_custom. It has a similar purpose as inline assembly.
# Line 624  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_r Line 696  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_r
696                if size == 4, the instruction argument must be 4 byte aligned.                if size == 4, the instruction argument must be 4 byte aligned.
697     Otherwise: size must be 4 and instruction argument must be 4 byte aligned. */     Otherwise: size must be 4 and instruction argument must be 4 byte aligned. */
698    
699  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,
700          void *instruction, int size);          void *instruction, sljit_si size);
701    
702  /* Returns with non-zero if fpu is available. */  /* Returns with non-zero if fpu is available. */
703    
704  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void);  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void);
705    
706  /* Note: dst is the left and src is the right operand for SLJIT_FCMP.  /* Note: dst is the left and src is the right operand for SLJIT_FCMP.
707     Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED is set,     Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED is set,
708           the comparison result is unpredictable.           the comparison result is unpredictable.
709     Flags: E | S (see SLJIT_C_FLOAT_*) */     Flags: SP | E | S (see SLJIT_C_FLOAT_*) */
710  #define SLJIT_FCMP                      36  #define SLJIT_CMPD                      36
711  /* Flags: - (never set any flags) */  #define SLJIT_CMPS                      (SLJIT_CMPD | SLJIT_SINGLE_OP)
712  #define SLJIT_FMOV                      37  /* Flags: SP - (never set any flags) */
713  /* Flags: - (never set any flags) */  #define SLJIT_MOVD                      37
714  #define SLJIT_FNEG                      38  #define SLJIT_MOVS                      (SLJIT_MOVD | SLJIT_SINGLE_OP)
715  /* Flags: - (never set any flags) */  /* Flags: SP - (never set any flags) */
716  #define SLJIT_FABS                      39  #define SLJIT_NEGD                      38
717    #define SLJIT_NEGS                      (SLJIT_NEGD | SLJIT_SINGLE_OP)
718  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  /* Flags: SP - (never set any flags) */
719          int dst, sljit_w dstw,  #define SLJIT_ABSD                      39
720          int src, sljit_w srcw);  #define SLJIT_ABSS                      (SLJIT_ABSD | SLJIT_SINGLE_OP)
721    
722  /* Flags: - (never set any flags) */  SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op,
723  #define SLJIT_FADD                      40          sljit_si dst, sljit_sw dstw,
724  /* Flags: - (never set any flags) */          sljit_si src, sljit_sw srcw);
725  #define SLJIT_FSUB                      41  
726  /* Flags: - (never set any flags) */  /* Flags: SP - (never set any flags) */
727  #define SLJIT_FMUL                      42  #define SLJIT_ADDD                      40
728  /* Flags: - (never set any flags) */  #define SLJIT_ADDS                      (SLJIT_ADDD | SLJIT_SINGLE_OP)
729  #define SLJIT_FDIV                      43  /* Flags: SP - (never set any flags) */
730    #define SLJIT_SUBD                      41
731  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  #define SLJIT_SUBS                      (SLJIT_SUBD | SLJIT_SINGLE_OP)
732          int dst, sljit_w dstw,  /* Flags: SP - (never set any flags) */
733          int src1, sljit_w src1w,  #define SLJIT_MULD                      42
734          int src2, sljit_w src2w);  #define SLJIT_MULS                      (SLJIT_MULD | SLJIT_SINGLE_OP)
735    /* Flags: SP - (never set any flags) */
736    #define SLJIT_DIVD                      43
737    #define SLJIT_DIVS                      (SLJIT_DIVD | SLJIT_SINGLE_OP)
738    
739    SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op,
740            sljit_si dst, sljit_sw dstw,
741            sljit_si src1, sljit_sw src1w,
742            sljit_si src2, sljit_sw src2w);
743    
744  /* Label and jump instructions. */  /* Label and jump instructions. */
745    
# Line 712  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la Line 792  SLJIT_API_FUNC_ATTRIBUTE struct sljit_la
792      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP
793     Flags: - (never set any flags) for both conditional and unconditional jumps.     Flags: - (never set any flags) for both conditional and unconditional jumps.
794     Flags: destroy all flags for calls. */     Flags: destroy all flags for calls. */
795  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);
796    
797  /* Basic arithmetic comparison. In most architectures it is implemented as  /* Basic arithmetic comparison. In most architectures it is implemented as
798     an SLJIT_SUB operation (with SLJIT_UNUSED destination and setting     an SLJIT_SUB operation (with SLJIT_UNUSED destination and setting
# Line 722  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 802  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
802      type must be between SLJIT_C_EQUAL and SLJIT_C_SIG_LESS_EQUAL      type must be between SLJIT_C_EQUAL and SLJIT_C_SIG_LESS_EQUAL
803      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP or SLJIT_INT_OP      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP or SLJIT_INT_OP
804     Flags: destroy flags. */     Flags: destroy flags. */
805  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,
806          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
807          int src2, sljit_w src2w);          sljit_si src2, sljit_sw src2w);
808    
809  /* Basic floating point comparison. In most architectures it is implemented as  /* Basic floating point comparison. In most architectures it is implemented as
810     an SLJIT_FCMP operation (setting appropriate flags) followed by a     an SLJIT_FCMP operation (setting appropriate flags) followed by a
# Line 732  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju Line 812  SLJIT_API_FUNC_ATTRIBUTE struct sljit_ju
812     special optimizations here. It is suggested to use this comparison form     special optimizations here. It is suggested to use this comparison form
813     when appropriate.     when appropriate.
814      type must be between SLJIT_C_FLOAT_EQUAL and SLJIT_C_FLOAT_ORDERED      type must be between SLJIT_C_FLOAT_EQUAL and SLJIT_C_FLOAT_ORDERED
815      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP      type can be combined (or'ed) with SLJIT_REWRITABLE_JUMP and SLJIT_SINGLE_OP
816     Flags: destroy flags.     Flags: destroy flags.
817     Note: if either operand is NaN, the behaviour is undefined for     Note: if either operand is NaN, the behaviour is undefined for
818           type <= SLJIT_C_FLOAT_LESS_EQUAL. */           type <= SLJIT_C_FLOAT_LESS_EQUAL. */
819  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,
820          int src1, sljit_w src1w,          sljit_si src1, sljit_sw src1w,
821          int src2, sljit_w src2w);          sljit_si src2, sljit_sw src2w);
822    
823  /* Set the destination of the jump to this label. */  /* Set the destination of the jump to this label. */
824  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label);  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label);
# Line 752  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 832  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
832      Indirect form: any other valid addressing mode      Indirect form: any other valid addressing mode
833     Flags: - (never set any flags) for unconditional jumps.     Flags: - (never set any flags) for unconditional jumps.
834     Flags: destroy all flags for calls. */     Flags: destroy all flags for calls. */
835  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);
836    
837  /* If op == SLJIT_MOV:  /* If op == SLJIT_MOV:
838       Set dst to 1 if condition is fulfilled, 0 otherwise       Set dst to 1 if condition is fulfilled, 0 otherwise
# Line 763  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 843  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
843       the condition is fulfilled. Otherwise it does nothing.       the condition is fulfilled. Otherwise it does nothing.
844       Flags: E | K       Flags: E | K
845     Note: sljit_emit_cond_value does nothing, if dst is SLJIT_UNUSED (regardless of op). */     Note: sljit_emit_cond_value does nothing, if dst is SLJIT_UNUSED (regardless of op). */
846  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_cond_value(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si type);
847    
848  /* Copies the base address of SLJIT_MEM1(SLJIT_LOCALS_REG)+offset to dst.  /* Copies the base address of SLJIT_LOCALS_REG+offset to dst.
849     Flags: - (never set any flags) */     Flags: - (never set any flags) */
850  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);
851    
852  /* The constant can be changed runtime (see: sljit_set_const)  /* The constant can be changed runtime (see: sljit_set_const)
853     Flags: - (never set any flags) */     Flags: - (never set any flags) */
854  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w init_value);  SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_si dst, sljit_sw dstw, sljit_sw init_value);
855    
856  /* After the code generation the address for label, jump and const instructions  /* After the code generation the address for label, jump and const instructions
857     are computed. Since these structures are freed sljit_free_compiler, the     are computed. Since these structures are freed sljit_free_compiler, the
# Line 782  static SLJIT_INLINE sljit_uw sljit_get_c Line 862  static SLJIT_INLINE sljit_uw sljit_get_c
862    
863  /* Only the address is required to rewrite the code. */  /* Only the address is required to rewrite the code. */
864  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr);  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr);
865  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);
866    
867  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
868  /*  Miscellaneous utility functions                                      */  /*  Miscellaneous utility functions                                      */
869  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
870    
871  #define SLJIT_MAJOR_VERSION     0  #define SLJIT_MAJOR_VERSION     0
872  #define SLJIT_MINOR_VERSION     88  #define SLJIT_MINOR_VERSION     90
873    
874  /* Get the human readable name of the platfrom.  /* Get the human readable name of the platfrom.
875     Can be useful for debugging on platforms like ARM, where ARM and     Can be useful for debugging on platforms like ARM, where ARM and
# Line 797  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 877  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
877  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void);  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void);
878    
879  /* Portble helper function to get an offset of a member. */  /* Portble helper function to get an offset of a member. */
880  #define SLJIT_OFFSETOF(base, member) ((sljit_w)(&((base*)0x10)->member) - 0x10)  #define SLJIT_OFFSETOF(base, member) ((sljit_sw)(&((base*)0x10)->member) - 0x10)
881    
882  #if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)  #if (defined SLJIT_UTIL_GLOBAL_LOCK && SLJIT_UTIL_GLOBAL_LOCK)
883  /* This global lock is useful to compile common functions. */  /* This global lock is useful to compile common functions. */
# Line 846  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL Line 926  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL
926     since the growth ratio can be added to the current limit, and sljit_stack_resize     since the growth ratio can be added to the current limit, and sljit_stack_resize
927     will do all the necessary checks. The fields of the stack are not changed if     will do all the necessary checks. The fields of the stack are not changed if
928     sljit_stack_resize fails. */     sljit_stack_resize fails. */
929  SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit);  SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit);
930    
931  #endif /* (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK) */  #endif /* (defined SLJIT_UTIL_STACK && SLJIT_UTIL_STACK) */
932    
933  #if !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)  #if !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
934    
935  /* Get the entry address of a given function. */  /* Get the entry address of a given function. */
936  #define SLJIT_FUNC_OFFSET(func_name)    ((sljit_w)func_name)  #define SLJIT_FUNC_OFFSET(func_name)    ((sljit_sw)func_name)
937    
938  #else /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */  #else /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */
939    
940  /* All JIT related code should be placed in the same context (library, binary, etc.). */  /* All JIT related code should be placed in the same context (library, binary, etc.). */
941    
942  #define SLJIT_FUNC_OFFSET(func_name)    ((sljit_w)*(void**)func_name)  #define SLJIT_FUNC_OFFSET(func_name)    ((sljit_sw)*(void**)func_name)
943    
944  /* For powerpc64, the function pointers point to a context descriptor. */  /* For powerpc64, the function pointers point to a context descriptor. */
945  struct sljit_function_context {  struct sljit_function_context {
946          sljit_w addr;          sljit_sw addr;
947          sljit_w r2;          sljit_sw r2;
948          sljit_w r11;          sljit_sw r11;
949  };  };
950    
951  /* Fill the context arguments using the addr and the function.  /* Fill the context arguments using the addr and the function.
952     If func_ptr is NULL, it will not be set to the address of context     If func_ptr is NULL, it will not be set to the address of context
953     If addr is NULL, the function address also comes from the func pointer. */     If addr is NULL, the function address also comes from the func pointer. */
954  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_w addr, void* func);  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_sw addr, void* func);
955    
956  #endif /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */  #endif /* !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) */
957    

Legend:
Removed from v.1194  
changed lines
  Added in v.1195

  ViewVC Help
Powered by ViewVC 1.1.5