This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] regrename.c: Add HARD_REGNO_MODE_OK appropriately.


Hi,

Attached is a patch to fix the following failures introduced by

http://gcc.gnu.org/ml/gcc-cvs/2002-01/msg00187.html

FAIL: gcc.c-torture/execute/920501-8.c execution,  -O0 
FAIL: gcc.c-torture/execute/920501-8.c execution,  -O1 
FAIL: gcc.c-torture/execute/920501-8.c execution,  -O2 
FAIL: gcc.c-torture/execute/920501-8.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/920501-8.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/920501-8.c execution,  -Os 
FAIL: gcc.c-torture/execute/921112-1.c execution,  -O1 
FAIL: gcc.c-torture/execute/921112-1.c execution,  -O2 
FAIL: gcc.c-torture/execute/921112-1.c execution,  -Os 
FAIL: gcc.c-torture/execute/complex-3.c execution,  -O1 
FAIL: gcc.c-torture/execute/complex-3.c execution,  -O2 
FAIL: gcc.c-torture/execute/complex-3.c execution,  -Os 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O1 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O2 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O3 -fomit-frame-pointer 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O3 -fomit-frame-pointer -funroll-loops 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -O3 -g 
FAIL: gcc.c-torture/execute/nestfunc-3.c execution,  -Os 

On H8/300, which is one variant of what the h8300 port supports, a
variable in SImode takes up two consecutive registers, where the first
one must have an even register number.

Without the patch, gcc outputs an invalid (odd) register number.  The
patch avoids renaming registers to invalid ones by calling
HARD_REGNO_MODE_OK.

Regtested on h8300 port.  OK to apply?

Kazu Hirata

2002-01-09  Kazu Hirata  <kazu@hxi.com>

	* regrename.c (find_oldest_value_reg): Disregard a register
	that is not HARD_REGNO_MODE_OK.
	(copyprop_hardreg_forward_1): Likewise.

Index: regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.34
diff -c -r1.34 regrename.c
*** regrename.c	2002/01/08 06:13:34	1.34
--- regrename.c	2002/01/09 22:07:56
***************
*** 1299,1305 ****
    for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
      if (TEST_HARD_REG_BIT (reg_class_contents[class], i)
  	&& (vd->e[i].mode == mode
! 	    || mode_change_ok (vd->e[i].mode, mode, regno)))
        {
  	rtx new = gen_rtx_REG (mode, i);
  	ORIGINAL_REGNO (new) = ORIGINAL_REGNO (reg);
--- 1299,1306 ----
    for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
      if (TEST_HARD_REG_BIT (reg_class_contents[class], i)
  	&& (vd->e[i].mode == mode
! 	    || mode_change_ok (vd->e[i].mode, mode, regno))
! 	&& HARD_REGNO_MODE_OK (i, mode))
        {
  	rtx new = gen_rtx_REG (mode, i);
  	ORIGINAL_REGNO (new) = ORIGINAL_REGNO (reg);
***************
*** 1586,1592 ****
  	  /* Otherwise, try all valid registers and see if its valid.  */
  	  for (i = vd->e[regno].oldest_regno; i != regno;
  	       i = vd->e[i].next_regno)
! 	    if (mode == vd->e[regno].mode)
  	      {
  		new = gen_rtx_REG (mode, i);
  		if (validate_change (insn, &SET_SRC (set), new, 0))
--- 1587,1594 ----
  	  /* Otherwise, try all valid registers and see if its valid.  */
  	  for (i = vd->e[regno].oldest_regno; i != regno;
  	       i = vd->e[i].next_regno)
! 	    if (mode == vd->e[regno].mode
! 		&& HARD_REGNO_MODE_OK (i, mode))
  	      {
  		new = gen_rtx_REG (mode, i);
  		if (validate_change (insn, &SET_SRC (set), new, 0))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]