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]

three minor rtl-checking patches


The first was reported by Graham wrt building GDB.

The second and third come from check-gcc on alphaev6.

The second is obvious.

The third trips up one of the alpha insn patterns.  We expected
reg_no_subreg_operand to accept only registers, and so accessed
REGNO without checking.  But register_operand also accepts ADDRESSOF.
For the patterns that use reg_no_subreg_operand, I don't think it's
terribly important to accept this.


r~


        * cfgrtl.c (delete_insn): Check for not NOTE_INSN_DELETED_LABEL
        before decrementing LABEL_NUSES from a jump table.

        * final.c (alter_subreg): Assign REGNO after changing the rtx code.

        * config/alpha/alpha.c (reg_no_subreg_operand): Reject all
        non-registers.

Index: gcc/cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.23
diff -c -p -d -r1.23 cfgrtl.c
*** cfgrtl.c	2001/12/30 12:20:42	1.23
--- cfgrtl.c	2001/12/31 21:29:22
*************** delete_insn (insn)
*** 161,167 ****
        int i;
  
        for (i = 0; i < len; i++)
! 	LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0))--;
      }
  
    return next;
--- 161,175 ----
        int i;
  
        for (i = 0; i < len; i++)
! 	{
! 	  rtx label = XEXP (XVECEXP (pat, diff_vec_p, i), 0);
! 
! 	  /* When deleting code in bulk (e.g. removing many unreachable
! 	     blocks) we can delete a label that's a target of the vector
! 	     before deleting the vector itself.  */
! 	  if (GET_CODE (label) != NOTE)
! 	    LABEL_NUSES (label)--;
! 	}
      }
  
    return next;
Index: gcc/final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.235
diff -c -p -d -r1.235 final.c
*** final.c	2001/12/31 03:56:16	1.235
--- final.c	2001/12/31 21:29:23
*************** alter_subreg (xp)
*** 2754,2761 ****
        /* Simplify_subreg can't handle some REG cases, but we have to.  */
        else if (GET_CODE (y) == REG)
  	{
! 	  REGNO (x) = subreg_hard_regno (x, 1);
  	  PUT_CODE (x, REG);
  	  ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y);
  	  /* This field has a different meaning for REGs and SUBREGs.  Make
  	     sure to clear it!  */
--- 2754,2762 ----
        /* Simplify_subreg can't handle some REG cases, but we have to.  */
        else if (GET_CODE (y) == REG)
  	{
! 	  unsigned int regno = subreg_hard_regno (x, 1);
  	  PUT_CODE (x, REG);
+ 	  REGNO (x) = regno;
  	  ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y);
  	  /* This field has a different meaning for REGs and SUBREGs.  Make
  	     sure to clear it!  */
Index: gcc/config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.218
diff -c -p -d -r1.218 alpha.c
*** alpha.c	2001/12/26 23:10:56	1.218
--- alpha.c	2001/12/31 21:29:23
*************** reg_no_subreg_operand (op, mode)
*** 1330,1336 ****
       register rtx op;
       enum machine_mode mode;
  {
!   if (GET_CODE (op) == SUBREG)
      return 0;
    return register_operand (op, mode);
  }
--- 1330,1336 ----
       register rtx op;
       enum machine_mode mode;
  {
!   if (GET_CODE (op) != REG)
      return 0;
    return register_operand (op, mode);
  }


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