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]

Re: Recent changes to cse.c


On Mon, Jul 16, 2001 at 11:17:45PM -0700, Richard Henderson wrote:
> date: 2001/07/16 20:54:43;  author: hubicka;  state: Exp;  lines: +166 -107
>         * cse.c (set_live_p, insn_live_p, dead_libcall_p): Break out from ...
>         (delete_trivially_dead_insns): ... here; accept new argument
>         preserve_basic_blocks; preserve basic blocks if set.

I'm checking in the following after "make cse.o" of an m68k cross
compile finished.  In addition to the reported compile-time problem,
it also fixes several warning regressions, including the very serious

../../../src/gcc/cse.c: In function `insn_live_p':
../../../src/gcc/cse.c:7546: warning: control reaches end of non-void function

Jan, please examine *all* warnings when testing patches.


r~

PS: m68k seems to be having issues with "targetm = TARGET_INITIALIZER"
at the moment, so cc1 won't even build.  I guess I'll look at that too...



	* cse.c (set_live_p): Take INSN argument for cc0; update callers.
	(insn_live_p): Fix fall off end of function.
	(dead_libcall_p): Remove COUNTS argument; update callers.
	(delete_trivially_dead_insns): Remove unused variables.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.191
diff -c -p -d -r1.191 cse.c
*** cse.c	2001/07/16 20:54:43	1.191
--- cse.c	2001/07/17 06:26:50
*************** static int check_dependence	PARAMS ((rtx
*** 690,697 ****
  
  static void flush_hash_table	PARAMS ((void));
  static bool insn_live_p		PARAMS ((rtx, int *));
! static bool set_live_p		PARAMS ((rtx, int *));
! static bool dead_libcall_p	PARAMS ((rtx, int *));
  
  /* Dump the expressions in the equivalence class indicated by CLASSP.
     This function is used only for debugging.  */
--- 690,697 ----
  
  static void flush_hash_table	PARAMS ((void));
  static bool insn_live_p		PARAMS ((rtx, int *));
! static bool set_live_p		PARAMS ((rtx, rtx, int *));
! static bool dead_libcall_p	PARAMS ((rtx));
  
  /* Dump the expressions in the equivalence class indicated by CLASSP.
     This function is used only for debugging.  */
*************** count_reg_usage (x, counts, dest, incr)
*** 7486,7493 ****
  
  /* Return true if set is live.  */
  static bool
! set_live_p (set, counts)
       rtx set;
       int *counts;
  {
  #ifdef HAVE_cc0
--- 7486,7494 ----
  
  /* Return true if set is live.  */
  static bool
! set_live_p (set, insn, counts)
       rtx set;
+      rtx insn;
       int *counts;
  {
  #ifdef HAVE_cc0
*************** insn_live_p (insn, counts)
*** 7527,7546 ****
  {
    int i;
    if (GET_CODE (PATTERN (insn)) == SET)
!     return set_live_p (PATTERN (insn), counts);
    else if (GET_CODE (PATTERN (insn)) == PARALLEL)
!     for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
!       {
! 	rtx elt = XVECEXP (PATTERN (insn), 0, i);
  
! 	if (GET_CODE (elt) == SET)
! 	  {
! 	    if (set_live_p (elt, counts))
! 	      return true;
! 	  }
! 	else if (GET_CODE (elt) != CLOBBER && GET_CODE (elt) != USE)
! 	  return true;
!       }
    else
      return true;
  }
--- 7528,7550 ----
  {
    int i;
    if (GET_CODE (PATTERN (insn)) == SET)
!     return set_live_p (PATTERN (insn), insn, counts);
    else if (GET_CODE (PATTERN (insn)) == PARALLEL)
!     {
!       for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
! 	{
! 	  rtx elt = XVECEXP (PATTERN (insn), 0, i);
  
! 	  if (GET_CODE (elt) == SET)
! 	    {
! 	      if (set_live_p (elt, insn, counts))
! 		return true;
! 	    }
! 	  else if (GET_CODE (elt) != CLOBBER && GET_CODE (elt) != USE)
! 	    return true;
! 	}
!       return false;
!     }
    else
      return true;
  }
*************** insn_live_p (insn, counts)
*** 7548,7556 ****
  /* Return true if libcall is dead as a whole.  */
  
  static bool
! dead_libcall_p (insn, counts)
       rtx insn;
-      int *counts;
  {
    rtx note;
    /* See if there's a REG_EQUAL note on this insn and try to
--- 7552,7559 ----
  /* Return true if libcall is dead as a whole.  */
  
  static bool
! dead_libcall_p (insn)
       rtx insn;
  {
    rtx note;
    /* See if there's a REG_EQUAL note on this insn and try to
*************** delete_trivially_dead_insns (insns, nreg
*** 7616,7622 ****
      for (; insn; insn = prev)
        {
  	int live_insn = 0;
- 	rtx note;
  
  	prev = prev_real_insn (insn);
  
--- 7619,7624 ----
*************** delete_trivially_dead_insns (insns, nreg
*** 7629,7635 ****
  	  {
  	    in_libcall = 1;
  	    live_insn = 1;
! 	    dead_libcall = dead_libcall_p (insn, counts);
  	  }
  	else if (in_libcall)
  	  live_insn = ! dead_libcall;
--- 7631,7637 ----
  	  {
  	    in_libcall = 1;
  	    live_insn = 1;
! 	    dead_libcall = dead_libcall_p (insn);
  	  }
  	else if (in_libcall)
  	  live_insn = ! dead_libcall;
*************** delete_trivially_dead_insns (insns, nreg
*** 7656,7662 ****
        for (bb = BASIC_BLOCK (i), insn = bb->end; insn != bb->head; insn = prev)
  	{
  	  int live_insn = 0;
- 	  rtx note;
  
  	  prev = PREV_INSN (insn);
  	  if (!INSN_P (insn))
--- 7658,7663 ----
*************** delete_trivially_dead_insns (insns, nreg
*** 7671,7677 ****
  	    {
  	      in_libcall = 1;
  	      live_insn = 1;
! 	      dead_libcall = dead_libcall_p (insn, counts);
  	    }
  	  else if (in_libcall)
  	    live_insn = ! dead_libcall;
--- 7672,7678 ----
  	    {
  	      in_libcall = 1;
  	      live_insn = 1;
! 	      dead_libcall = dead_libcall_p (insn);
  	    }
  	  else if (in_libcall)
  	    live_insn = ! dead_libcall;


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