v850/v850.c (v850_reorg): Call alter_subreg. Delete subreg support.

Jim Wilson wilson@cygnus.com
Thu Oct 22 23:35:00 GMT 1998


I have installed this patch which fixes a v850 bug exposed by Joern's recent
reload patches.  It wasn't properly handling a (SUBREG (MEM)), which is
possible after reload.  This caused the compiler to core dump while compiling
libgcc.

It might be useful to move the existing alter_subreg calls from final to
just after reload, so that none of the passes after reload have to worry
about handling subregs correctly.

1998-10-22  Jim Wilson  <wilson@cygnus.com>

	* v850/v850.c (v850_reorg): Call alter_subreg.  Delete subreg support.

Index: v850.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/v850/v850.c,v
retrieving revision 1.91
diff -p -r1.91 v850.c
*** v850.c	1998/10/13 19:58:54	1.91
--- v850.c	1998/10/23 01:26:29
*************** void v850_reorg (start_insn)
*** 1347,1352 ****
--- 1347,1360 ----
  	      /* Memory operands are signed by default.  */
  	      int unsignedp = FALSE;
  
+ 	      /* We might have (SUBREG (MEM)) here, so just get rid of the
+ 		 subregs to make this code simpler.  It is safe to call
+ 		 alter_subreg any time after reload.  */
+ 	      if (GET_CODE (dest) == SUBREG)
+ 		dest = alter_subreg (dest);
+ 	      if (GET_CODE (src) == SUBREG)
+ 		src = alter_subreg (src);
+ 
  	      if (GET_CODE (dest) == MEM && GET_CODE (src) == MEM)
  		mem = NULL_RTX;
  
*************** void v850_reorg (start_insn)
*** 1412,1431 ****
  
  	      /* Loading up a register in the basic block zaps any savings
  		 for the register */
! 	      if (GET_CODE (dest) == REG || GET_CODE (dest) == SUBREG)
  		{
  		  enum machine_mode mode = GET_MODE (dest);
- 		  int word = 0;
  		  int regno;
  		  int endregno;
- 
- 		  while (GET_CODE (dest) == SUBREG)
- 		    {
- 		      word = SUBREG_WORD (dest);
- 		      dest = SUBREG_REG (dest);
- 		    }
  
! 		  regno = REGNO (dest) + word;
  		  endregno = regno + HARD_REGNO_NREGS (regno, mode);
  
  		  if (!use_ep)
--- 1420,1432 ----
  
  	      /* Loading up a register in the basic block zaps any savings
  		 for the register */
! 	      if (GET_CODE (dest) == REG)
  		{
  		  enum machine_mode mode = GET_MODE (dest);
  		  int regno;
  		  int endregno;
  
! 		  regno = REGNO (dest);
  		  endregno = regno + HARD_REGNO_NREGS (regno, mode);
  
  		  if (!use_ep)



More information about the Gcc-patches mailing list