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

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

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

revision 836 by ph10, Wed Dec 28 17:16:11 2011 UTC revision 847 by zherczeg, Tue Jan 3 17:49:03 2012 UTC
# Line 38  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST cha Line 38  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST cha
38  #define TMP_FREG1       (SLJIT_FLOAT_REG4 + 1)  #define TMP_FREG1       (SLJIT_FLOAT_REG4 + 1)
39  #define TMP_FREG2       (SLJIT_FLOAT_REG4 + 2)  #define TMP_FREG2       (SLJIT_FLOAT_REG4 + 2)
40    
41  /* See sljit_emit_enter if you want to change them. */  /* See sljit_emit_enter and sljit_emit_op0 if you want to change them. */
42  static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 5] = {  static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 5] = {
43    0, 0, 1, 2, 12, 5, 6, 7, 8, 10, 11, 13, 3, 4, 14, 15    0, 0, 1, 2, 12, 5, 6, 7, 8, 10, 11, 13, 3, 4, 14, 15
44  };  };
# Line 158  typedef sljit_ui sljit_ins; Line 158  typedef sljit_ui sljit_ins;
158  #define SXTH            0xb200  #define SXTH            0xb200
159  #define SXTH_W          0xfa0ff080  #define SXTH_W          0xfa0ff080
160  #define TST             0x4200  #define TST             0x4200
161    #define UMULL           0xfba00000
162  #define UXTB            0xb2c0  #define UXTB            0xb2c0
163  #define UXTB_W          0xfa5ff080  #define UXTB_W          0xfa5ff080
164  #define UXTH            0xb280  #define UXTH            0xb280
# Line 1188  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1189  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1189  /*  Operators                                                            */  /*  Operators                                                            */
1190  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
1191    
1192    #ifdef __cplusplus
1193    extern "C" {
1194    #endif
1195    
1196    #if defined(__GNUC__)
1197    extern unsigned int __aeabi_uidivmod(unsigned numerator, unsigned denominator);
1198    extern unsigned int __aeabi_idivmod(unsigned numerator, unsigned denominator);
1199    #else
1200    #error "Software divmod functions are needed"
1201    #endif
1202    
1203    #ifdef __cplusplus
1204    }
1205    #endif
1206    
1207  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)
1208  {  {
1209          CHECK_ERROR();          CHECK_ERROR();
# Line 1201  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1217  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1217          case SLJIT_NOP:          case SLJIT_NOP:
1218                  push_inst16(compiler, NOP);                  push_inst16(compiler, NOP);
1219                  break;                  break;
1220            case SLJIT_UMUL:
1221            case SLJIT_SMUL:
1222                    return push_inst32(compiler, (op == SLJIT_UMUL ? UMULL : SMULL)
1223                            | (reg_map[SLJIT_TEMPORARY_REG2] << 8)
1224                            | (reg_map[SLJIT_TEMPORARY_REG1] << 12)
1225                            | (reg_map[SLJIT_TEMPORARY_REG1] << 16)
1226                            | reg_map[SLJIT_TEMPORARY_REG2]);
1227            case SLJIT_UDIV:
1228            case SLJIT_SDIV:
1229                    FAIL_IF(push_inst32(compiler, 0xf84d2d04 /* str r2, [sp, #-4]! */));
1230                    FAIL_IF(push_inst32(compiler, 0xf84dcd04 /* str ip, [sp, #-4]! */));
1231    #if defined(__GNUC__)
1232                    FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM,
1233                            (op == SLJIT_UDIV ? SLJIT_FUNC_OFFSET(__aeabi_uidivmod) : SLJIT_FUNC_OFFSET(__aeabi_idivmod))));
1234    #else
1235    #error "Software divmod functions are needed"
1236    #endif
1237                    FAIL_IF(push_inst32(compiler, 0xf85dcb04 /* ldr ip, [sp], #4 */));
1238                    return push_inst32(compiler, 0xf85d2b04 /* ldr r2, [sp], #4 */);
1239          }          }
1240    
1241          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
# Line 1412  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1447  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1447          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
1448  }  }
1449    
1450    SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)
1451    {
1452            check_sljit_get_register_index(reg);
1453            return reg_map[reg];
1454    }
1455    
1456    SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op_custom(struct sljit_compiler *compiler,
1457            void *instruction, int size)
1458    {
1459            CHECK_ERROR();
1460            check_sljit_emit_op_custom(compiler, instruction, size);
1461            SLJIT_ASSERT(size == 2 || size == 4);
1462    
1463            if (size == 2)
1464                    return push_inst16(compiler, *(sljit_uh*)instruction);
1465            return push_inst32(compiler, *(sljit_ins*)instruction);
1466    }
1467    
1468  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
1469  /*  Floating point operators                                             */  /*  Floating point operators                                             */
1470  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */

Legend:
Removed from v.836  
changed lines
  Added in v.847

  ViewVC Help
Powered by ViewVC 1.1.5