History

i386-gen: fix USE_EBX

Restore ebx from *ebp because alloca might change esp. Also disable USE_EBX for upcoming release. Actually the benefit is less than one would expect, it appears that tcc can't do much with more than 3 registers except with extensive use of long longs where the disassembly looks much prettier (and shorter also).

grischka committed 9 years ago

Commit 559ee1e1 parent d2332392 files · +11 −6Browse files

Unified · Split

2 files
  1. i386-gen.c +10 −5
  2. tccgen.c +1 −1
i386-gen.c+10−5
@@ -79,7 +79,7 @@ enum { · 78 unmodified lines
79#include "tcc.h"79#include "tcc.h"
80 80
81/* define to 1/0 to [not] have EBX as 4th register */81/* define to 1/0 to [not] have EBX as 4th register */
82#define USE_EBX 182#define USE_EBX 0
83 83
84ST_DATA const int reg_classes[NB_REGS] = {84ST_DATA const int reg_classes[NB_REGS] = {
85 /* eax */ RC_INT | RC_EAX,85 /* eax */ RC_INT | RC_EAX,
@@ -636,7 +636,15 @@ ST_FUNC void gfunc_epilog(void) · 550 unmodified lines
636 o(0x585a); /* restore returned value, if any */636 o(0x585a); /* restore returned value, if any */
637 }637 }
638#endif638#endif
639 o(0x5b * USE_EBX); /* pop ebx */639
640 /* align local size to word & save local variables */
641 v = (-loc + 3) & -4;
642
643#if USE_EBX
644 o(0x8b);
645 gen_modrm(TREG_EBX, VT_LOCAL, NULL, -(v+4));
646#endif
647
640 o(0xc9); /* leave */648 o(0xc9); /* leave */
641 if (func_ret_sub == 0) {649 if (func_ret_sub == 0) {
642 o(0xc3); /* ret */650 o(0xc3); /* ret */
@@ -645,9 +653,6 @@ ST_FUNC void gfunc_epilog(void) · 2 unmodified lines
645 g(func_ret_sub);653 g(func_ret_sub);
646 g(func_ret_sub >> 8);654 g(func_ret_sub >> 8);
647 }655 }
648 /* align local size to word & save local variables */
649
650 v = (-loc + 3) & -4;
651 saved_ind = ind;656 saved_ind = ind;
652 ind = func_sub_sp_offset - FUNC_PROLOG_SIZE;657 ind = func_sub_sp_offset - FUNC_PROLOG_SIZE;
653#ifdef TCC_TARGET_PE658#ifdef TCC_TARGET_PE
tccgen.c+1−1
@@ -5164,8 +5164,8 @@ static void expr_cond(void) · 5163 unmodified lines
5164#endif5164#endif
5165 } else5165 } else
5166 rc = RC_INT;5166 rc = RC_INT;
5167 save_regs(1);
5168 gv(rc);5167 gv(rc);
5168 save_regs(1);
5169 if (g)5169 if (g)
5170 gv_dup();5170 gv_dup();
5171 tt = gvtst(1, 0);5171 tt = gvtst(1, 0);

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