History

Fix gv for long longs

long long a(); long long b() { return a(); } At the end of b there will be some useless register shuffling. This is because return wants to have the result of a in REG_IRET. gv checks if this is the case for BOTH registers of the long long. After this test it uses REG_LRET for the second register if the first is supposed to be REG_IRET. In other cases it uses RC_INT. The patch compares the second register against the class it will have in the end instead of the register class the first register will have. At this point I would like to remind those who pick up the patches that there are two other mails by me with uncommitted fixes: http://lists.gnu.org/archive/html/tinycc-devel/2003-10/msg00044.html http://lists.gnu.org/archive/html/tinycc-devel/2008-08/msg00007.html Daniel

Daniel Glöckner committed 18 years ago

Commit e263ee31 parent 15e0dc01 file · +4 −4Browse files

Unified · Split

tcc.c+4−4
@@ -4984,6 +4984,9 @@ int gv(int rc) · 4983 unmodified lines
49844984 #endif
49854985
49864986 r = vtop->r & VT_VALMASK;
4987+ rc2 = RC_INT;
4988+ if (rc == RC_IRET)
4989+ rc2 = RC_LRET;
49874990 /* need to reload if:
49884991 - constant
49894992 - lvalue (need to dereference pointer)
@@ -4992,7 +4995,7 @@ int gv(int rc) · 2 unmodified lines
49924995 (vtop->r & VT_LVAL) ||
49934996 !(reg_classes[r] & rc) ||
49944997 ((vtop->type.t & VT_BTYPE) == VT_LLONG &&
4995− !(reg_classes[vtop->r2] & rc))) {
4998+ !(reg_classes[vtop->r2] & rc2))) {
49964999 r = get_reg(rc);
49975000 if ((vtop->type.t & VT_BTYPE) == VT_LLONG) {
49985001 /* two register type load : expand to two words
@@ -5029,9 +5032,6 @@ int gv(int rc) · 30 unmodified lines
50295032 vtop->r = vtop[-1].r2;
50305033 }
50315034 /* allocate second register */
5032− rc2 = RC_INT;
5033− if (rc == RC_IRET)
5034− rc2 = RC_LRET;
50355035 r2 = get_reg(rc2);
50365036 load(r2, vtop);
50375037 vpop();