/[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 1457 by zherczeg, Sun Mar 2 14:49:27 2014 UTC revision 1460 by zherczeg, Wed Mar 5 14:44:22 2014 UTC
# Line 83  Line 83 
83  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)  #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
84    
85  #define GET_OPCODE(op) \  #define GET_OPCODE(op) \
86          ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))          ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
87    
88  #define GET_FLAGS(op) \  #define GET_FLAGS(op) \
89          ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))          ((op) & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))
90    
91  #define GET_ALL_FLAGS(op) \  #define GET_ALL_FLAGS(op) \
92          ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))          ((op) & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
93    
94  #define TYPE_CAST_NEEDED(op) \  #define TYPE_CAST_NEEDED(op) \
95          (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))          (((op) >= SLJIT_MOV_UB && (op) <= SLJIT_MOV_SH) || ((op) >= SLJIT_MOVU_UB && (op) <= SLJIT_MOVU_SH))
# Line 153  Line 153 
153  #endif  #endif
154    
155  #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)  #if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
156  #       define IS_COND          0x04  #       define IS_COND          0x004
157  #       define IS_CBZ           0x08  #       define IS_CBZ           0x008
158  #       define IS_BL            0x10  #       define IS_BL            0x010
159  #       define PATCH_B          0x20  #       define PATCH_B          0x020
160  #       define PATCH_COND       0x40  #       define PATCH_COND       0x040
161    #       define PATCH_ABS48      0x080
162    #       define PATCH_ABS64      0x100
163  #endif  #endif
164    
165  #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)
# Line 165  Line 167 
167  #       define PATCH_B          0x08  #       define PATCH_B          0x08
168  #       define ABSOLUTE_B       0x10  #       define ABSOLUTE_B       0x10
169  #       define REMOVE_COND      0x20  #       define REMOVE_COND      0x20
170    #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
171    #       define PATCH_ABS32      0x40
172    #       define PATCH_ABS48      0x80
173    #endif
174  #endif  #endif
175    
176  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
177  #       define IS_MOVABLE       0x04  #       define IS_MOVABLE       0x004
178  #       define IS_JAL           0x08  #       define IS_JAL           0x008
179  #       define IS_BIT26_COND    0x10  #       define IS_BIT26_COND    0x010
180  #       define IS_BIT16_COND    0x20  #       define IS_BIT16_COND    0x020
181    
182  #       define IS_COND          (IS_BIT26_COND | IS_BIT16_COND)  #       define IS_COND          (IS_BIT26_COND | IS_BIT16_COND)
183    
184  #       define PATCH_B          0x40  #       define PATCH_B          0x040
185  #       define PATCH_J          0x80  #       define PATCH_J          0x080
186    
187    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
188    #       define PATCH_ABS32      0x100
189    #endif
190    
191          /* instruction types */          /* instruction types */
192  #       define MOVABLE_INS      0  #       define MOVABLE_INS      0
# Line 255  Line 265 
265  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))  #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_sw))
266  #endif  #endif
267    
268    #if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
269    #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
270    #define FIXED_LOCALS_OFFSET 0
271    #endif
272    
273  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
274  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1  #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
275  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))  #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_sw))
# Line 364  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 379  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
379          compiler->cpool_diff = 0xffffffff;          compiler->cpool_diff = 0xffffffff;
380  #endif  #endif
381    
382  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
383          compiler->delay_slot = UNMOVABLE_INS;          compiler->delay_slot = UNMOVABLE_INS;
384  #endif  #endif
385    
# Line 439  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_ Line 454  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_
454  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
455  {  {
456          if (SLJIT_LIKELY(!!jump)) {          if (SLJIT_LIKELY(!!jump)) {
                 SLJIT_ASSERT(jump->flags & SLJIT_REWRITABLE_JUMP);  
   
457                  jump->flags &= ~JUMP_LABEL;                  jump->flags &= ~JUMP_LABEL;
458                  jump->flags |= JUMP_ADDR;                  jump->flags |= JUMP_ADDR;
459                  jump->u.target = target;                  jump->u.target = target;
# Line 569  static SLJIT_INLINE void set_const(struc Line 582  static SLJIT_INLINE void set_const(struc
582          case SLJIT_SHL: \          case SLJIT_SHL: \
583          case SLJIT_LSHR: \          case SLJIT_LSHR: \
584          case SLJIT_ASHR: \          case SLJIT_ASHR: \
585                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C))); \
586                  break; \                  break; \
587          case SLJIT_NEG: \          case SLJIT_NEG: \
588                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
589                  break; \                  break; \
590          case SLJIT_MUL: \          case SLJIT_MUL: \
591                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_C))); \
592                  break; \                  break; \
593          case SLJIT_CMPD: \          case SLJIT_CMPD: \
594                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
595                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \                  SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
596                  break; \                  break; \
597          case SLJIT_ADD: \          case SLJIT_ADD: \
598                  SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_U | SLJIT_SET_S))); \
599                  break; \                  break; \
600          case SLJIT_SUB: \          case SLJIT_SUB: \
601                  break; \                  break; \
602          case SLJIT_ADDC: \          case SLJIT_ADDC: \
603          case SLJIT_SUBC: \          case SLJIT_SUBC: \
604                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O))); \
605                  break; \                  break; \
606          case SLJIT_BREAKPOINT: \          case SLJIT_BREAKPOINT: \
607          case SLJIT_NOP: \          case SLJIT_NOP: \
608          case SLJIT_UMUL: \          case SLJIT_UMUL: \
609          case SLJIT_SMUL: \          case SLJIT_SMUL: \
610          case SLJIT_MOV: \          case SLJIT_MOV: \
611            case SLJIT_MOV_UI: \
612          case SLJIT_MOV_P: \          case SLJIT_MOV_P: \
613          case SLJIT_MOVU: \          case SLJIT_MOVU: \
614            case SLJIT_MOVU_UI: \
615          case SLJIT_MOVU_P: \          case SLJIT_MOVU_P: \
616                  /* Nothing allowed */ \                  /* Nothing allowed */ \
617                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
618                  break; \                  break; \
619          default: \          default: \
620                  /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \                  /* Only SLJIT_INT_OP or SLJIT_SINGLE_OP is allowed. */ \
621                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \                  SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
622                  break; \                  break; \
623          }          }
624    
# Line 691  static char* freg_names[] = { Line 706  static char* freg_names[] = {
706          (char*)"f4", (char*)"f5", (char*)"f6"          (char*)"f4", (char*)"f5", (char*)"f6"
707  };  };
708    
709  #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \  #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
         || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \  
         || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)  
710  #ifdef _WIN64  #ifdef _WIN64
711  #       define SLJIT_PRINT_D    "I64"  #       define SLJIT_PRINT_D    "I64"
712  #else  #else
# Line 964  static SLJIT_INLINE void check_sljit_emi Line 977  static SLJIT_INLINE void check_sljit_emi
977  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
978          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
979                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
980                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_U) ? "" : ".u",                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
981                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
982                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
983                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
# Line 1006  static SLJIT_INLINE void check_sljit_emi Line 1019  static SLJIT_INLINE void check_sljit_emi
1019  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1020          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1021                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],                  fprintf(compiler->verbose, "  %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
1022                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_U) ? "" : ".u",                          !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s",
1023                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");                          !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k");
1024                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
1025                  fprintf(compiler->verbose, ", ");                  fprintf(compiler->verbose, ", ");
# Line 1248  static SLJIT_INLINE void check_sljit_emi Line 1261  static SLJIT_INLINE void check_sljit_emi
1261          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);          SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1262          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_UI || GET_OPCODE(op) == SLJIT_MOV_SI          SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_MOV_UI || GET_OPCODE(op) == SLJIT_MOV_SI
1263                  || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));                  || (GET_OPCODE(op) >= SLJIT_AND && GET_OPCODE(op) <= SLJIT_XOR));
1264          SLJIT_ASSERT((op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C)) == 0);          SLJIT_ASSERT((op & (SLJIT_SET_U | SLJIT_SET_S | SLJIT_SET_O | SLJIT_SET_C)) == 0);
1265          SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));          SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_KEEP_FLAGS)) != (SLJIT_SET_E | SLJIT_KEEP_FLAGS));
1266  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1267          if (GET_OPCODE(op) < SLJIT_ADD) {          if (GET_OPCODE(op) < SLJIT_ADD) {
# Line 1376  static SLJIT_INLINE sljit_si emit_mov_be Line 1389  static SLJIT_INLINE sljit_si emit_mov_be
1389  #       include "sljitNativePPC_common.c"  #       include "sljitNativePPC_common.c"
1390  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1391  #       include "sljitNativeMIPS_common.c"  #       include "sljitNativeMIPS_common.c"
1392    #elif (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
1393    #       include "sljitNativeMIPS_common.c"
1394  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)  #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1395  #       include "sljitNativeSPARC_common.c"  #       include "sljitNativeSPARC_common.c"
1396  #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)  #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
1397  #       include "sljitNativeTILEGX_64.c"  #       include "sljitNativeTILEGX_64.c"
1398  #endif  #endif
1399    
1400  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)  #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) && !(defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
1401    
1402  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,  SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_si type,
1403          sljit_si src1, sljit_sw src1w,          sljit_si src1, sljit_sw src1w,

Legend:
Removed from v.1457  
changed lines
  Added in v.1460

  ViewVC Help
Powered by ViewVC 1.1.5