This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix to global.c problem in egcs 1.1.2
- To: egcs-patches at egcs dot cygnus dot com
- Subject: Fix to global.c problem in egcs 1.1.2
- From: Jim Kingdon <kingdon at redhat dot com>
- Date: Tue, 13 Jul 1999 14:21:05 -0400
This is the same bug (3777 in bugzilla at developer.redhat.com) that I
reported a few days ago to egcs-bugs. See
http://egcs.cygnus.com/ml/egcs-bugs/1999-07/msg00408.html for the test
case.
The enclosed patch, relative to egcs 1.1.2, does fix the problem on
this test case. Whether it really solves the underlying problem,
whether it introduces new bugs (I would guess not), and stuff like
that I don't really feel very able to comment on.
Tue Jul 13 14:05:07 1999 Jim Kingdon <http://developer.redhat.com>
* global.c (mark_reg_clobber): Also look for clobbered registers
buried in a MEM.
(mark_reg_store): Call mark_reg_clobber even if we aren't dealing
with a REG.
*** global.c.before Tue Jul 13 10:00:55 1999
--- global.c Tue Jul 13 12:47:34 1999
***************
*** 1347,1355 ****
reg = SUBREG_REG (reg);
}
- if (GET_CODE (reg) != REG)
- return;
-
if (setter && GET_CODE (setter) == CLOBBER)
{
/* A clobber of a register should be processed here too. */
--- 1347,1352 ----
***************
*** 1357,1362 ****
--- 1354,1362 ----
return;
}
+ if (GET_CODE (reg) != REG)
+ return;
+
regs_set[n_regs_set++] = reg;
if (setter)
***************
*** 1411,1416 ****
--- 1411,1434 ----
{
word = SUBREG_WORD (reg);
reg = SUBREG_REG (reg);
+ }
+
+ /* If we are offsetting from a register, then we need to treat that
+ register as clobbered (e.g. fix_truncsfdi2 in i386 generates
+ clobbers for stack slots, sometimes offsetting off %ebx in which
+ case we better not allocate %ebx for something else). To look
+ for MEM and PLUS here seems like something of a special-purpose
+ kludge - I'm not really sure what is legal in a clobber and
+ whether we should be handling this somewhere else. */
+
+ if (GET_CODE (reg) == MEM)
+ {
+ rtx addr = XEXP (reg, 0);
+ if (GET_CODE (addr) == PLUS)
+ {
+ mark_reg_clobber (XEXP (addr, 0), setter);
+ mark_reg_clobber (XEXP (addr, 1), setter);
+ }
}
if (GET_CODE (reg) != REG)