This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
local-alloc.c (combine_regs): Don't combine if we have a hard reg
- To: egcs-patches at egcs dot cygnus dot com
- Subject: local-alloc.c (combine_regs): Don't combine if we have a hard reg
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Mon, 08 Mar 1999 18:02:25 -0800
I have checked in this patch.
This fixes a minor performance problem. We get an unnecessary move insn
for this example on the SH:
void func(void)
{
func1(func2());
}
The problem occurs because local-alloc ties the function address of a call
insn with the result register, but this happens to be a single-register
class, and local-alloc isn't supposed to allocate things to single-register
regclasses. This results in a little confusion later on and we get one more
move insn that we should have gotten. I have fixed this by disabling tying
if one register is CLASS_LIKELY_SPILLED_P.
It is suspected that we should completely disable tying for CALL_INSNs,
but we don't have any testcase to prove whether this is useful or not.
Mon Mar 8 16:04:44 1999 Jim Wilson <wilson@cygnus.com>
* local-alloc.c (combine_regs): Don't combine if we have a hard reg
for which CLASS_LIKELY_SPILLED_P is true.
Index: local-alloc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/local-alloc.c,v
retrieving revision 1.36
diff -p -r1.36 local-alloc.c
*** local-alloc.c 1999/02/25 23:45:25 1.36
--- local-alloc.c 1999/03/09 01:48:39
*************** combine_regs (usedreg, setreg, may_save_
*** 1648,1653 ****
--- 1648,1658 ----
|| ureg == sreg
/* Don't try to connect two different hardware registers. */
|| (ureg < FIRST_PSEUDO_REGISTER && sreg < FIRST_PSEUDO_REGISTER)
+ /* Don't use a hard reg that might be spilled. */
+ || (ureg < FIRST_PSEUDO_REGISTER
+ && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (ureg)))
+ || (sreg < FIRST_PSEUDO_REGISTER
+ && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (sreg)))
/* Don't connect two different machine modes if they have different
implications as to which registers may be used. */
|| !MODES_TIEABLE_P (GET_MODE (usedreg), GET_MODE (setreg)))