This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
global register allocation problem on c4x
- From: Herman ten Brugge <Haj dot Ten dot Brugge at net dot HCC dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Dec 2001 17:06:00 +0000 (WET)
- Subject: global register allocation problem on c4x
Hello,
I found a problem on the c4x target. The global register allocator
does not check for HARD_REGNO_CALL_PART_CLOBBERED in all places where
it tries to find a register.
The macro HARD_REGNO_CALL_PART_CLOBBERED is only used on the c4x target
and is set to 0 for all other targets.
This bug is there for a long time (at least since 2.95) but I never
had a problem until now.
I do not have write permission so can not make the change after aproval.
Herman.
2001-12-17 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* global.c (find_reg): Check for HARD_REGNO_CALL_PART_CLOBBERED
every where we allocate a register.
--- global.c.org Sat Dec 15 18:50:07 2001
+++ global.c Sat Dec 15 23:02:01 2001
@@ -1076,6 +1076,9 @@ find_reg (num, losers, alt_regs_p, accep
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (allocno[num].hard_reg_copy_preferences, i)
&& HARD_REGNO_MODE_OK (i, mode)
+ && (allocno[num].calls_crossed == 0
+ || accept_call_clobbered
+ || ! HARD_REGNO_CALL_PART_CLOBBERED (i, mode))
&& (REGNO_REG_CLASS (i) == REGNO_REG_CLASS (best_reg)
|| reg_class_subset_p (REGNO_REG_CLASS (i),
REGNO_REG_CLASS (best_reg))
@@ -1112,6 +1115,9 @@ find_reg (num, losers, alt_regs_p, accep
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (allocno[num].hard_reg_preferences, i)
&& HARD_REGNO_MODE_OK (i, mode)
+ && (allocno[num].calls_crossed == 0
+ || accept_call_clobbered
+ || ! HARD_REGNO_CALL_PART_CLOBBERED (i, mode))
&& (REGNO_REG_CLASS (i) == REGNO_REG_CLASS (best_reg)
|| reg_class_subset_p (REGNO_REG_CLASS (i),
REGNO_REG_CLASS (best_reg))
@@ -1192,6 +1198,9 @@ find_reg (num, losers, alt_regs_p, accep
/* Don't use a reg no good for this pseudo. */
&& ! TEST_HARD_REG_BIT (used2, regno)
&& HARD_REGNO_MODE_OK (regno, mode)
+ && (allocno[num].calls_crossed == 0
+ || accept_call_clobbered
+ || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
#ifdef CLASS_CANNOT_CHANGE_MODE
&& ! (REG_CHANGES_MODE (allocno[num].reg)
&& (TEST_HARD_REG_BIT