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