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

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

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

revision 722 by zherczeg, Fri Oct 7 19:18:55 2011 UTC revision 740 by zherczeg, Mon Oct 31 06:10:14 2011 UTC
# Line 24  Line 24 
24   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25   */   */
26    
27  SLJIT_CONST char* sljit_get_platform_name()  SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name()
28  {  {
29  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
30          return "x86-32";          return "x86-32";
# Line 275  static sljit_ub* generate_near_jump_code Line 275  static sljit_ub* generate_near_jump_code
275          return code_ptr;          return code_ptr;
276  }  }
277    
278  void* sljit_generate_code(struct sljit_compiler *compiler)  SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
279  {  {
280          struct sljit_memory_fragment *buf;          struct sljit_memory_fragment *buf;
281          sljit_ub *code;          sljit_ub *code;
# Line 473  static void SLJIT_CALL sljit_touch_stack Line 473  static void SLJIT_CALL sljit_touch_stack
473  #include "sljitNativeX86_64.c"  #include "sljitNativeX86_64.c"
474  #endif  #endif
475    
476  int sljit_emit_op0(struct sljit_compiler *compiler, int op)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)
477  {  {
478          sljit_ub *buf;          sljit_ub *buf;
479    
# Line 927  static int emit_clz(struct sljit_compile Line 927  static int emit_clz(struct sljit_compile
927          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
928  }  }
929    
930  int sljit_emit_op1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,
931          int dst, sljit_w dstw,          int dst, sljit_w dstw,
932          int src, sljit_w srcw)          int src, sljit_w srcw)
933  {  {
# Line 955  int sljit_emit_op1(struct sljit_compiler Line 955  int sljit_emit_op1(struct sljit_compiler
955                  compiler->mode32 = 0;                  compiler->mode32 = 0;
956  #endif  #endif
957    
958                  SLJIT_ASSERT(SLJIT_MOV + 7 == SLJIT_MOVU);                  SLJIT_COMPILE_ASSERT(SLJIT_MOV + 7 == SLJIT_MOVU, movu_offset);
959                  if (op >= SLJIT_MOVU) {                  if (op >= SLJIT_MOVU) {
960                          update = 1;                          update = 1;
961                          op -= 7;                          op -= 7;
# Line 1418  static int emit_mul(struct sljit_compile Line 1418  static int emit_mul(struct sljit_compile
1418          }          }
1419          else {          else {
1420                  /* Neither argument is immediate. */                  /* Neither argument is immediate. */
1421                  if (depends_on(src2, dst_r))                  if (ADDRESSING_DEPENDS_ON(src2, dst_r))
1422                          dst_r = TMP_REGISTER;                          dst_r = TMP_REGISTER;
1423                  EMIT_MOV(compiler, dst_r, 0, src1, src1w);                  EMIT_MOV(compiler, dst_r, 0, src1, src1w);
1424                  code = emit_x86_instruction(compiler, 2, dst_r, 0, src2, src2w);                  code = emit_x86_instruction(compiler, 2, dst_r, 0, src2, src2w);
# Line 1706  static int emit_shift(struct sljit_compi Line 1706  static int emit_shift(struct sljit_compi
1706                  *code |= mode;                  *code |= mode;
1707                  EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REGISTER, 0);                  EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REGISTER, 0);
1708          }          }
1709          else if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS && dst != src2 && !depends_on(src2, dst)) {          else if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS && dst != src2 && !ADDRESSING_DEPENDS_ON(src2, dst)) {
1710                  if (src1 != dst)                  if (src1 != dst)
1711                          EMIT_MOV(compiler, dst, 0, src1, src1w);                          EMIT_MOV(compiler, dst, 0, src1, src1w);
1712                  EMIT_MOV(compiler, TMP_REGISTER, 0, SLJIT_PREF_SHIFT_REG, 0);                  EMIT_MOV(compiler, TMP_REGISTER, 0, SLJIT_PREF_SHIFT_REG, 0);
# Line 1744  static int emit_shift(struct sljit_compi Line 1744  static int emit_shift(struct sljit_compi
1744          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
1745  }  }
1746    
1747  int sljit_emit_op2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,
1748          int dst, sljit_w dstw,          int dst, sljit_w dstw,
1749          int src1, sljit_w src1w,          int src1, sljit_w src1w,
1750          int src2, sljit_w src2w)          int src2, sljit_w src2w)
# Line 1893  static void init_compiler() Line 1893  static void init_compiler()
1893    
1894  #endif  #endif
1895    
1896  int sljit_is_fpu_available(void)  SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)
1897  {  {
1898          /* Always available. */          /* Always available. */
1899          return 1;          return 1;
# Line 1938  static SLJIT_INLINE int emit_sse2_store( Line 1938  static SLJIT_INLINE int emit_sse2_store(
1938  }  }
1939    
1940  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)
1941  int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,
1942  #else  #else
1943  static int sljit_emit_sse2_fop1(struct sljit_compiler *compiler, int op,  static int sljit_emit_sse2_fop1(struct sljit_compiler *compiler, int op,
1944  #endif  #endif
# Line 2000  static int sljit_emit_sse2_fop1(struct s Line 2000  static int sljit_emit_sse2_fop1(struct s
2000  }  }
2001    
2002  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)
2003  int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,
2004  #else  #else
2005  static int sljit_emit_sse2_fop2(struct sljit_compiler *compiler, int op,  static int sljit_emit_sse2_fop2(struct sljit_compiler *compiler, int op,
2006  #endif  #endif
# Line 2123  static int emit_fop_regs(struct sljit_co Line 2123  static int emit_fop_regs(struct sljit_co
2123  }  }
2124    
2125  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)
2126  int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,
2127  #else  #else
2128  static int sljit_emit_fpu_fop1(struct sljit_compiler *compiler, int op,  static int sljit_emit_fpu_fop1(struct sljit_compiler *compiler, int op,
2129  #endif  #endif
# Line 2188  static int sljit_emit_fpu_fop1(struct sl Line 2188  static int sljit_emit_fpu_fop1(struct sl
2188  }  }
2189    
2190  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)  #if !(defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)
2191  int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,
2192  #else  #else
2193  static int sljit_emit_fpu_fop2(struct sljit_compiler *compiler, int op,  static int sljit_emit_fpu_fop2(struct sljit_compiler *compiler, int op,
2194  #endif  #endif
# Line 2266  static int sljit_emit_fpu_fop2(struct sl Line 2266  static int sljit_emit_fpu_fop2(struct sl
2266    
2267  #if (defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)  #if (defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO)
2268    
2269  int sljit_emit_fop1(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,
2270          int dst, sljit_w dstw,          int dst, sljit_w dstw,
2271          int src, sljit_w srcw)          int src, sljit_w srcw)
2272  {  {
# Line 2276  int sljit_emit_fop1(struct sljit_compile Line 2276  int sljit_emit_fop1(struct sljit_compile
2276                  return sljit_emit_fpu_fop1(compiler, op, dst, dstw, src, srcw);                  return sljit_emit_fpu_fop1(compiler, op, dst, dstw, src, srcw);
2277  }  }
2278    
2279  int sljit_emit_fop2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,
2280          int dst, sljit_w dstw,          int dst, sljit_w dstw,
2281          int src1, sljit_w src1w,          int src1, sljit_w src1w,
2282          int src2, sljit_w src2w)          int src2, sljit_w src2w)
# Line 2293  int sljit_emit_fop2(struct sljit_compile Line 2293  int sljit_emit_fop2(struct sljit_compile
2293  /*  Conditional instructions                                             */  /*  Conditional instructions                                             */
2294  /* --------------------------------------------------------------------- */  /* --------------------------------------------------------------------- */
2295    
2296  struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
2297  {  {
2298          sljit_ub *buf;          sljit_ub *buf;
2299          struct sljit_label *label;          struct sljit_label *label;
# Line 2322  struct sljit_label* sljit_emit_label(str Line 2322  struct sljit_label* sljit_emit_label(str
2322          return label;          return label;
2323  }  }
2324    
2325  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, int type)
2326  {  {
2327          sljit_ub *buf;          sljit_ub *buf;
2328          struct sljit_jump *jump;          struct sljit_jump *jump;
# Line 2359  struct sljit_jump* sljit_emit_jump(struc Line 2359  struct sljit_jump* sljit_emit_jump(struc
2359          return jump;          return jump;
2360  }  }
2361    
2362  int sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)
2363  {  {
2364          sljit_ub *code;          sljit_ub *code;
2365          struct sljit_jump *jump;          struct sljit_jump *jump;
# Line 2441  int sljit_emit_ijump(struct sljit_compil Line 2441  int sljit_emit_ijump(struct sljit_compil
2441          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
2442  }  }
2443    
2444  int sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)
2445  {  {
2446          sljit_ub *buf;          sljit_ub *buf;
2447          sljit_ub cond_set = 0;          sljit_ub cond_set = 0;
# Line 2629  int sljit_emit_cond_value(struct sljit_c Line 2629  int sljit_emit_cond_value(struct sljit_c
2629          return SLJIT_SUCCESS;          return SLJIT_SUCCESS;
2630  }  }
2631    
2632  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, int dst, sljit_w dstw, sljit_w init_value)
2633  {  {
2634          sljit_ub *buf;          sljit_ub *buf;
2635          struct sljit_const *const_;          struct sljit_const *const_;
# Line 2675  struct sljit_const* sljit_emit_const(str Line 2675  struct sljit_const* sljit_emit_const(str
2675          return const_;          return const_;
2676  }  }
2677    
2678  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)
2679  {  {
2680  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
2681          *(sljit_w*)addr = new_addr - (addr + 4);          *(sljit_w*)addr = new_addr - (addr + 4);
# Line 2684  void sljit_set_jump_addr(sljit_uw addr, Line 2684  void sljit_set_jump_addr(sljit_uw addr,
2684  #endif  #endif
2685  }  }
2686    
2687  void sljit_set_const(sljit_uw addr, sljit_w new_constant)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)
2688  {  {
2689          *(sljit_w*)addr = new_constant;          *(sljit_w*)addr = new_constant;
2690  }  }

Legend:
Removed from v.722  
changed lines
  Added in v.740

  ViewVC Help
Powered by ViewVC 1.1.5