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

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

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

revision 721 by zherczeg, Wed Sep 28 17:40:47 2011 UTC revision 722 by zherczeg, Fri Oct 7 19:18:55 2011 UTC
# Line 97  typedef sljit_ui sljit_ins; Line 97  typedef sljit_ui sljit_ins;
97  #define AND             (HI(0) | LO(36))  #define AND             (HI(0) | LO(36))
98  #define ANDI            (HI(12))  #define ANDI            (HI(12))
99  #define B               (HI(4))  #define B               (HI(4))
100    #define BAL             (HI(1) | (17 << 16))
101  #define BC1F            (HI(17) | (8 << 21))  #define BC1F            (HI(17) | (8 << 21))
102  #define BC1T            (HI(17) | (8 << 21) | (1 << 16))  #define BC1T            (HI(17) | (8 << 21) | (1 << 16))
103  #define BEQ             (HI(4))  #define BEQ             (HI(4))
# Line 111  typedef sljit_ui sljit_ins; Line 112  typedef sljit_ui sljit_ins;
112  #define C_ULT_D         (HI(17) | FMT_D | LO(53))  #define C_ULT_D         (HI(17) | FMT_D | LO(53))
113  #define DIV_D           (HI(17) | FMT_D | LO(3))  #define DIV_D           (HI(17) | FMT_D | LO(3))
114  #define J               (HI(2))  #define J               (HI(2))
115    #define JAL             (HI(3))
116  #define JALR            (HI(0) | LO(9))  #define JALR            (HI(0) | LO(9))
117  #define JR              (HI(0) | LO(8))  #define JR              (HI(0) | LO(8))
118  #define LD              (HI(55))  #define LD              (HI(55))
# Line 199  static SLJIT_INLINE sljit_ins* optimize_ Line 201  static SLJIT_INLINE sljit_ins* optimize_
201          sljit_ins *inst;          sljit_ins *inst;
202          sljit_ins saved_inst;          sljit_ins saved_inst;
203    
204          if (jump->flags & (SLJIT_REWRITABLE_JUMP | IS_JAL))          if (jump->flags & SLJIT_REWRITABLE_JUMP)
205                  return code_ptr;                  return code_ptr;
206    
207          if (jump->flags & JUMP_ADDR)          if (jump->flags & JUMP_ADDR)
# Line 220  static SLJIT_INLINE sljit_ins* optimize_ Line 222  static SLJIT_INLINE sljit_ins* optimize_
222    
223                          if (!(jump->flags & IS_COND)) {                          if (!(jump->flags & IS_COND)) {
224                                  inst[0] = inst[-1];                                  inst[0] = inst[-1];
225                                  inst[-1] = B;                                  inst[-1] = (jump->flags & IS_JAL) ? BAL : B;
226                                  jump->addr -= sizeof(sljit_ins);                                  jump->addr -= sizeof(sljit_ins);
227                                  return inst;                                  return inst;
228                          }                          }
# Line 237  static SLJIT_INLINE sljit_ins* optimize_ Line 239  static SLJIT_INLINE sljit_ins* optimize_
239                  jump->flags |= PATCH_B;                  jump->flags |= PATCH_B;
240    
241                  if (!(jump->flags & IS_COND)) {                  if (!(jump->flags & IS_COND)) {
242                          inst[0] = B;                          inst[0] = (jump->flags & IS_JAL) ? BAL : B;
243                          inst[1] = NOP;                          inst[1] = NOP;
244                          return inst + 1;                          return inst + 1;
245                  }                  }
# Line 265  static SLJIT_INLINE sljit_ins* optimize_ Line 267  static SLJIT_INLINE sljit_ins* optimize_
267                  if ((target_addr & ~0xfffffff) == (jump->addr & ~0xfffffff)) {                  if ((target_addr & ~0xfffffff) == (jump->addr & ~0xfffffff)) {
268                          jump->flags |= PATCH_J;                          jump->flags |= PATCH_J;
269                          inst[0] = inst[-1];                          inst[0] = inst[-1];
270                          inst[-1] = J;                          inst[-1] = (jump->flags & IS_JAL) ? JAL : J;
271                          jump->addr -= sizeof(sljit_ins);                          jump->addr -= sizeof(sljit_ins);
272                          return inst;                          return inst;
273                  }                  }
# Line 273  static SLJIT_INLINE sljit_ins* optimize_ Line 275  static SLJIT_INLINE sljit_ins* optimize_
275    
276          if ((target_addr & ~0xfffffff) == ((jump->addr + sizeof(sljit_ins)) & ~0xfffffff)) {          if ((target_addr & ~0xfffffff) == ((jump->addr + sizeof(sljit_ins)) & ~0xfffffff)) {
277                  jump->flags |= PATCH_J;                  jump->flags |= PATCH_J;
278                  inst[0] = J;                  inst[0] = (jump->flags & IS_JAL) ? JAL : J;
279                  inst[1] = NOP;                  inst[1] = NOP;
280                  return inst + 1;                  return inst + 1;
281          }          }
# Line 1396  struct sljit_jump* sljit_emit_jump(struc Line 1398  struct sljit_jump* sljit_emit_jump(struc
1398                  jump->addr = compiler->size;                  jump->addr = compiler->size;
1399                  PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));                  PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS));
1400          } else {          } else {
                 /* Cannot be optimized out. */  
1401                  SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);                  SLJIT_ASSERT(DR(PIC_ADDR_REG) == 25 && PIC_ADDR_REG == TMP_REG2);
1402                  jump->flags |= IS_JAL;                  /* Cannot be optimized out if type is >= CALL0. */
1403                    jump->flags |= IS_JAL | (type >= SLJIT_CALL0 ? SLJIT_REWRITABLE_JUMP : 0);
1404                  PTR_FAIL_IF(push_inst(compiler, JALR | S(TMP_REG2) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));                  PTR_FAIL_IF(push_inst(compiler, JALR | S(TMP_REG2) | DA(RETURN_ADDR_REG), UNMOVABLE_INS));
1405                  jump->addr = compiler->size;                  jump->addr = compiler->size;
1406                    /* A NOP if type < CALL1. */
1407                  PTR_FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_TEMPORARY_REG1) | TA(0) | DA(4), UNMOVABLE_INS));                  PTR_FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_TEMPORARY_REG1) | TA(0) | DA(4), UNMOVABLE_INS));
1408          }          }
1409          return jump;          return jump;
# Line 1596  int sljit_emit_ijump(struct sljit_compil Line 1599  int sljit_emit_ijump(struct sljit_compil
1599          if (src & SLJIT_IMM) {          if (src & SLJIT_IMM) {
1600                  jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));                  jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
1601                  FAIL_IF(!jump);                  FAIL_IF(!jump);
1602                  set_jump(jump, compiler, JUMP_ADDR);                  set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_JAL : 0));
1603                  jump->u.target = srcw;                  jump->u.target = srcw;
1604    
1605                  if (compiler->delay_slot != UNMOVABLE_INS)                  if (compiler->delay_slot != UNMOVABLE_INS)

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

  ViewVC Help
Powered by ViewVC 1.1.5