This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
regrename doesn't take HARD_REGNO_CALL_PART_CLOBBERED into account
- To: gcc-patches at gcc dot gnu dot org
- Subject: regrename doesn't take HARD_REGNO_CALL_PART_CLOBBERED into account
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 11 Mar 2001 02:19:14 -0300
- Organization: GCC Team, Red Hat
It is possible that regrename chooses a register that may be partially
clobbered in function calls to replace one that is fully saved in the
mode(s) in which the register is used. It shouldn't do it. This
patch fixes it.
I've tested it on a new port I'm working on, then merged the patch
into current CVS. None of the mainstream hosts use this feature, so
it doesn't make sense to require bootstrapping of it. Ok to install,
as long as it builds and doesn't totally disable regrename?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* regrename.c (regrename_optimize): Don't use a register that may
be part-clobbered in the used modes.
Index: gcc/regrename.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regrename.c,v
retrieving revision 1.20
diff -u -p -r1.20 regrename.c
--- gcc/regrename.c 2001/01/04 14:17:38 1.20
+++ gcc/regrename.c 2001/03/11 05:11:12
@@ -1,5 +1,5 @@
/* Register renaming for the GNU compiler.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -303,7 +303,10 @@ regrename_optimize ()
/* See whether it accepts all modes that occur in
definition and uses. */
for (tmp = this; tmp; tmp = tmp->next_use)
- if (! HARD_REGNO_MODE_OK (new_reg, GET_MODE (*tmp->loc)))
+ if (! HARD_REGNO_MODE_OK (new_reg, GET_MODE (*tmp->loc))
+ || (last->need_caller_save_reg
+ && (HARD_REGNO_CALL_PART_CLOBBERED
+ (new_reg, GET_MODE (*tmp->loc)))))
break;
if (! tmp)
{
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me