History

x86-asm: Get rid of is_short_jump

Can be implemented differently.

Michael Matz committed 10 years ago

Commit f3cee9c1 parent 55bd08c1 file · +4 −7Browse files

Unified · Split

i386-asm.c+4−7
@@ -499,7 +499,7 @@ static inline void asm_modrm(int reg, Operand *op) · 498 unmodified lines
499499 ST_FUNC void asm_opcode(TCCState *s1, int opcode)
500500 {
501501 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;
503503 int nb_ops, s;
504504 Operand ops[MAX_OPERANDS], *pop;
505505 int op_type[3]; /* decoded op type */
@@ -540,7 +540,6 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 34 unmodified lines
540540 next();
541541 }
542542
543− is_short_jmp = 0;
544543 s = 0; /* avoid warning */
545544
546545 /* 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
759758 jmp_disp = ops[0].e.v + sym->jnext - ind - 2 - (v >= 0xff);
760759 if (jmp_disp == (int8_t)jmp_disp) {
761760 /* OK to generate jump */
762− is_short_jmp = 1;
761+ ops[0].e.sym = 0;
763762 ops[0].e.v = jmp_disp;
763+ op_type[0] = OP_IM8S;
764764 } else {
765765 no_short_jump:
766766 if (pa->instr_type & OPC_JMP) {
@@ -861,10 +861,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 94 unmodified lines
861861 gen_le16(ops[i].e.v);
862862 } else {
863863 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);
868865 } else {
869866 #ifdef TCC_TARGET_X86_64
870867 if (v & OP_IM64)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t