Can be implemented differently.
Unified · Split
| @@ -499,7 +499,7 @@ static inline void asm_modrm(int reg, Operand *op) · 498 unmodified lines | ||
| 499 | 499 | ST_FUNC void asm_opcode(TCCState *s1, int opcode) |
| 500 | 500 | { |
| 501 | 501 | const ASMInstr *pa; |
| 502 | − int i, modrm_index, reg, v, op1, is_short_jmp, seg_prefix; | |
| 502 | + int i, modrm_index, reg, v, op1, seg_prefix; | |
| 503 | 503 | int nb_ops, s; |
| 504 | 504 | Operand ops[MAX_OPERANDS], *pop; |
| 505 | 505 | int op_type[3]; /* decoded op type */ |
| @@ -540,7 +540,6 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 34 unmodified lines | ||
| 540 | 540 | next(); |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | − is_short_jmp = 0; | |
| 544 | 543 | s = 0; /* avoid warning */ |
| 545 | 544 | |
| 546 | 545 | /* optimize matching by using a lookup table (no hashing is needed |
| @@ -759,8 +758,9 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 212 unmodified lines | ||
| 759 | 758 | jmp_disp = ops[0].e.v + sym->jnext - ind - 2 - (v >= 0xff); |
| 760 | 759 | if (jmp_disp == (int8_t)jmp_disp) { |
| 761 | 760 | /* OK to generate jump */ |
| 762 | − is_short_jmp = 1; | |
| 761 | + ops[0].e.sym = 0; | |
| 763 | 762 | ops[0].e.v = jmp_disp; |
| 763 | + op_type[0] = OP_IM8S; | |
| 764 | 764 | } else { |
| 765 | 765 | no_short_jump: |
| 766 | 766 | if (pa->instr_type & OPC_JMP) { |
| @@ -861,10 +861,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 94 unmodified lines | ||
| 861 | 861 | gen_le16(ops[i].e.v); |
| 862 | 862 | } else { |
| 863 | 863 | if (pa->instr_type & (OPC_JMP | OPC_SHORTJMP)) { |
| 864 | − if (is_short_jmp) | |
| 865 | − g(ops[i].e.v); | |
| 866 | − else | |
| 867 | − gen_disp32(&ops[i].e); | |
| 864 | + gen_disp32(&ops[i].e); | |
| 868 | 865 | } else { |
| 869 | 866 | #ifdef TCC_TARGET_X86_64 |
| 870 | 867 | if (v & OP_IM64) |