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

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

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

revision 969 by zherczeg, Sun May 27 04:33:38 2012 UTC revision 1182 by zherczeg, Sun Oct 28 05:22:32 2012 UTC
# Line 122  Line 122 
122  #endif  #endif
123    
124  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)  #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
125          #define IS_CONDITIONAL  0x04          #define IS_COND         0x04
126          #define IS_BL           0x08          #define IS_BL           0x08
127          /* cannot be encoded as branch */          /* cannot be encoded as branch */
128          #define B_TYPE0         0x00          #define B_TYPE0         0x00
# Line 159  Line 159 
159          #define PATCH_J         0x80          #define PATCH_J         0x80
160    
161          /* instruction types */          /* instruction types */
162          #define UNMOVABLE_INS   0          #define MOVABLE_INS     0
163          /* 1 - 31 last destination register */          /* 1 - 31 last destination register */
         #define FCSR_FCC        32  
164          /* no destination (i.e: store) */          /* no destination (i.e: store) */
165          #define MOVABLE_INS     33          #define UNMOVABLE_INS   32
166            /* FPU status register */
167            #define FCSR_FCC        33
168    #endif
169    
170    #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
171            #define IS_MOVABLE      0x04
172            #define IS_COND         0x08
173            #define IS_CALL         0x10
174    
175            #define PATCH_B         0x20
176            #define PATCH_CALL      0x40
177    
178            /* instruction types */
179            #define MOVABLE_INS     0
180            /* 1 - 31 last destination register */
181            /* no destination (i.e: store) */
182            #define UNMOVABLE_INS   32
183    
184            #define DST_INS_MASK    0xff
185    
186            /* ICC_SET is the same as SET_FLAGS. */
187            #define ICC_IS_SET      (1 << 23)
188            #define FCC_IS_SET      (1 << 24)
189  #endif  #endif
190    
191  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
# Line 179  Line 201 
201  #endif  #endif
202  #endif  #endif
203    
 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  
 #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  
 #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))  
 #endif  
   
204  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)  #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
205  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
206    #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
207    #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))
208    #else
209  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))
210  #endif  #endif
211    #endif
212    
213  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
214  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
215  #define FIXED_LOCALS_OFFSET ((7 + 8) * sizeof(sljit_w))  #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))
216    #endif
217    
218    #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
219    #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
220    #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))
221    #endif
222    
223    #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
224    #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
225    #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))
226  #endif  #endif
227    
228  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)  #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)
# Line 249  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 280  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
280                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1                  sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1
281                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2                  && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2
282                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4                  && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4
283                  && ((sizeof(sljit_w) == 4 && sizeof(sljit_uw) == 4) || (sizeof(sljit_w) == 8 && sizeof(sljit_uw) == 8)),                  && (sizeof(sljit_p) == 4 || sizeof(sljit_p) == 8)
284                    && (sizeof(sljit_w) == 4 || sizeof(sljit_w) == 8)
285                    && (sizeof(sljit_uw) == 4 || sizeof(sljit_uw) == 8),
286                  invalid_integer_types);                  invalid_integer_types);
287    
288          /* Only the non-zero members must be set. */          /* Only the non-zero members must be set. */
# Line 295  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 328  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
328          compiler->delay_slot = UNMOVABLE_INS;          compiler->delay_slot = UNMOVABLE_INS;
329  #endif  #endif
330    
331    #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
332            compiler->delay_slot = UNMOVABLE_INS;
333    #endif
334    
335  #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)  #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)
336          if (!compiler_initialized) {          if (!compiler_initialized) {
337                  init_compiler();                  init_compiler();
# Line 336  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 373  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
373          /* Remove thumb mode flag. */          /* Remove thumb mode flag. */
374          SLJIT_FREE_EXEC((void*)((sljit_uw)code & ~0x1));          SLJIT_FREE_EXEC((void*)((sljit_uw)code & ~0x1));
375  }  }
376  #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  #elif (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
377  SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)  SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
378  {  {
379          /* Resolve indirection. */          /* Resolve indirection. */
# Line 574  static SLJIT_INLINE void set_const(struc Line 611  static SLJIT_INLINE void set_const(struc
611                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
612    
613  #define FUNCTION_CHECK_OP1() \  #define FUNCTION_CHECK_OP1() \
614          if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \          if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
615                  SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \                  SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \
616          } \          } \
617          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \          if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_P) { \
618                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \
619                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \                  SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \
620                  if ((src & SLJIT_MEM) && (src & 0xf)) \                  if ((src & SLJIT_MEM) && (src & 0xf)) \
# Line 662  static SLJIT_CONST char* op_names[] = { Line 699  static SLJIT_CONST char* op_names[] = {
699          (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",          (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",
700          /* op1 */          /* op1 */
701          (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",          (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",
702          (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"movu",          (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"mov.p",
703          (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh", (char*)"movu.sh",          (char*)"movu", (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh",
704          (char*)"movu.ui", (char*)"movu.si", (char*)"not", (char*)"neg",          (char*)"movu.sh", (char*)"movu.ui", (char*)"movu.si", (char*)"movu.p",
705          (char*)"clz",          (char*)"not", (char*)"neg", (char*)"clz",
706          /* op2 */          /* op2 */
707          (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",          (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
708          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",          (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
# Line 774  static SLJIT_INLINE void check_sljit_emi Line 811  static SLJIT_INLINE void check_sljit_emi
811    
812  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
813          if (op != SLJIT_UNUSED) {          if (op != SLJIT_UNUSED) {
814                  SLJIT_ASSERT(op >= SLJIT_MOV && op <= SLJIT_MOV_SI);                  SLJIT_ASSERT(op >= SLJIT_MOV && op <= SLJIT_MOV_P);
815                  FUNCTION_CHECK_SRC(src, srcw);                  FUNCTION_CHECK_SRC(src, srcw);
816          }          }
817          else          else
# Line 1088  static SLJIT_INLINE void check_sljit_emi Line 1125  static SLJIT_INLINE void check_sljit_emi
1125    
1126          SLJIT_ASSERT(sljit_is_fpu_available());          SLJIT_ASSERT(sljit_is_fpu_available());
1127          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));          SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
1128          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_NOT_NAN);          SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);
1129  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1130          FUNCTION_FCHECK(src1, src1w);          FUNCTION_FCHECK(src1, src1w);
1131          FUNCTION_FCHECK(src2, src2w);          FUNCTION_FCHECK(src2, src2w);
# Line 1196  static SLJIT_INLINE int emit_mov_before_ Line 1233  static SLJIT_INLINE int emit_mov_before_
1233                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1234    
1235  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1236          if (src == SLJIT_RETURN_REG && op == SLJIT_MOV)          /* At the moment the pointer size is always equal to sljit_w. May be changed in the future. */
1237            if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_P))
1238                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1239  #else  #else
1240          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI))          if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI || op == SLJIT_MOV_P))
1241                  return SLJIT_SUCCESS;                  return SLJIT_SUCCESS;
1242  #endif  #endif
1243    
# Line 1251  static SLJIT_INLINE int emit_mov_before_ Line 1289  static SLJIT_INLINE int emit_mov_before_
1289          #include "sljitNativePPC_common.c"          #include "sljitNativePPC_common.c"
1290  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1291          #include "sljitNativeMIPS_common.c"          #include "sljitNativeMIPS_common.c"
1292    #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1293            #include "sljitNativeSPARC_common.c"
1294  #endif  #endif
1295    
1296  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
# Line 1371  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l Line 1411  SLJIT_API_FUNC_ATTRIBUTE int sljit_get_l
1411    
1412  /* Empty function bodies for those machines, which are not (yet) supported. */  /* Empty function bodies for those machines, which are not (yet) supported. */
1413    
1414  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name()  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
1415  {  {
1416          return "unsupported";          return "unsupported";
1417  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.5