Lines Matching refs:jump

221 static SLJIT_INLINE sljit_ins* detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit…  in detect_jump_type()  argument
229 if (jump->flags & (SLJIT_REWRITABLE_JUMP | IS_CALL)) in detect_jump_type()
232 if (jump->flags & SLJIT_REWRITABLE_JUMP) in detect_jump_type()
236 if (jump->flags & JUMP_ADDR) in detect_jump_type()
237 target_addr = jump->u.target; in detect_jump_type()
239 SLJIT_ASSERT(jump->flags & JUMP_LABEL); in detect_jump_type()
240 target_addr = (sljit_uw)(code + jump->u.label->size); in detect_jump_type()
242 inst = (sljit_ins*)jump->addr; in detect_jump_type()
243 if (jump->flags & IS_COND) in detect_jump_type()
247 if (jump->flags & IS_CALL) in detect_jump_type()
252 if (jump->flags & IS_MOVABLE) { in detect_jump_type()
255 jump->flags |= PATCH_B; in detect_jump_type()
257 if (!(jump->flags & IS_COND)) { in detect_jump_type()
259 inst[-1] = (jump->flags & IS_JAL) ? BAL : B; in detect_jump_type()
260 jump->addr -= sizeof(sljit_ins); in detect_jump_type()
265 inst[-1] = saved_inst ^ invert_branch(jump->flags); in detect_jump_type()
266 jump->addr -= 2 * sizeof(sljit_ins); in detect_jump_type()
273 jump->flags |= PATCH_B; in detect_jump_type()
275 if (!(jump->flags & IS_COND)) { in detect_jump_type()
276 inst[0] = (jump->flags & IS_JAL) ? BAL : B; in detect_jump_type()
280 inst[0] = inst[0] ^ invert_branch(jump->flags); in detect_jump_type()
282 jump->addr -= sizeof(sljit_ins); in detect_jump_type()
287 if (jump->flags & IS_COND) { in detect_jump_type()
288 …if ((jump->flags & IS_MOVABLE) && (target_addr & ~0xfffffff) == ((jump->addr + 2 * sizeof(sljit_in… in detect_jump_type()
289 jump->flags |= PATCH_J; in detect_jump_type()
297 else if ((target_addr & ~0xfffffff) == ((jump->addr + 3 * sizeof(sljit_ins)) & ~0xfffffff)) { in detect_jump_type()
298 jump->flags |= PATCH_J; in detect_jump_type()
303 jump->addr += sizeof(sljit_ins); in detect_jump_type()
309 if ((jump->flags & IS_MOVABLE) && (target_addr & ~0xfffffff) == (jump->addr & ~0xfffffff)) { in detect_jump_type()
310 jump->flags |= PATCH_J; in detect_jump_type()
312 inst[-1] = (jump->flags & IS_JAL) ? JAL : J; in detect_jump_type()
313 jump->addr -= sizeof(sljit_ins); in detect_jump_type()
317 if ((target_addr & ~0xfffffff) == ((jump->addr + sizeof(sljit_ins)) & ~0xfffffff)) { in detect_jump_type()
318 jump->flags |= PATCH_J; in detect_jump_type()
319 inst[0] = (jump->flags & IS_JAL) ? JAL : J; in detect_jump_type()
328 jump->flags |= PATCH_ABS32; in detect_jump_type()
329 if (jump->flags & IS_COND) { in detect_jump_type()
338 jump->flags |= PATCH_ABS48; in detect_jump_type()
339 if (jump->flags & IS_COND) { in detect_jump_type()
370 struct sljit_jump *jump; in sljit_generate_code() local
384 jump = compiler->jumps; in sljit_generate_code()
392 SLJIT_ASSERT(!jump || jump->addr >= word_count); in sljit_generate_code()
401 if (jump && jump->addr == word_count) { in sljit_generate_code()
403 jump->addr = (sljit_uw)(code_ptr - 3); in sljit_generate_code()
405 jump->addr = (sljit_uw)(code_ptr - 7); in sljit_generate_code()
407 code_ptr = detect_jump_type(jump, code_ptr, code); in sljit_generate_code()
408 jump = jump->next; in sljit_generate_code()
429 SLJIT_ASSERT(!jump); in sljit_generate_code()
433 jump = compiler->jumps; in sljit_generate_code()
434 while (jump) { in sljit_generate_code()
436 addr = (jump->flags & JUMP_LABEL) ? jump->u.label->addr : jump->u.target; in sljit_generate_code()
437 buf_ptr = (sljit_ins*)jump->addr; in sljit_generate_code()
439 if (jump->flags & PATCH_B) { in sljit_generate_code()
440 addr = (sljit_sw)(addr - (jump->addr + sizeof(sljit_ins))) >> 2; in sljit_generate_code()
445 if (jump->flags & PATCH_J) { in sljit_generate_code()
446 SLJIT_ASSERT((addr & ~0xfffffff) == ((jump->addr + sizeof(sljit_ins)) & ~0xfffffff)); in sljit_generate_code()
456 if (jump->flags & PATCH_ABS32) { in sljit_generate_code()
461 else if (jump->flags & PATCH_ABS48) { in sljit_generate_code()
475 jump = jump->next; in sljit_generate_code()
1619 struct sljit_jump *jump; in sljit_emit_jump() local
1627 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
1628 PTR_FAIL_IF(!jump); in sljit_emit_jump()
1629 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
1689 jump->flags |= flags; in sljit_emit_jump()
1691 jump->flags |= IS_MOVABLE; in sljit_emit_jump()
1699 jump->addr = compiler->size; in sljit_emit_jump()
1704 jump->flags |= IS_JAL | (type >= SLJIT_CALL0 ? IS_CALL : 0); in sljit_emit_jump()
1706 jump->addr = compiler->size; in sljit_emit_jump()
1710 return jump; in sljit_emit_jump()
1737 struct sljit_jump *jump; in sljit_emit_cmp() local
1758 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
1759 PTR_FAIL_IF(!jump); in sljit_emit_cmp()
1760 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_cmp()
1766 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1768 jump->flags |= IS_MOVABLE; in sljit_emit_cmp()
1778 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1782 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1786 jump->flags |= IS_BIT16_COND; in sljit_emit_cmp()
1790 jump->flags |= IS_BIT16_COND; in sljit_emit_cmp()
1800 jump->flags |= IS_BIT16_COND; in sljit_emit_cmp()
1804 jump->flags |= IS_BIT16_COND; in sljit_emit_cmp()
1808 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1812 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1840 jump->flags |= IS_BIT26_COND; in sljit_emit_cmp()
1846 jump->addr = compiler->size; in sljit_emit_cmp()
1848 return jump; in sljit_emit_cmp()
1858 struct sljit_jump *jump; in sljit_emit_fcmp() local
1882 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_fcmp()
1883 PTR_FAIL_IF(!jump); in sljit_emit_fcmp()
1884 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_fcmp()
1885 jump->flags |= IS_BIT16_COND; in sljit_emit_fcmp()
1929 jump->addr = compiler->size; in sljit_emit_fcmp()
1931 return jump; in sljit_emit_fcmp()
1946 struct sljit_jump *jump = NULL; in sljit_emit_ijump() local
1981 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
1982 FAIL_IF(!jump); in sljit_emit_ijump()
1983 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_JAL : 0)); in sljit_emit_ijump()
1984 jump->u.target = srcw; in sljit_emit_ijump()
1987 jump->flags |= IS_MOVABLE; in sljit_emit_ijump()
1995 if (jump) in sljit_emit_ijump()
1996 jump->addr = compiler->size; in sljit_emit_ijump()