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: ICEs in validate_replace_src


> (1) It's missing the patch to validate_replace_src.
> (2) I understand English is not your native language, but I can't figure
> out what you mean in the comments in front of note_uses.  Specially, what
> "maximal" means.
> (2) There is a missing blank line before the declaration of "note_uses"
> and we usually put blank lines between declarations and code.
Here is updated patch.
I am just running bootstrap, but it got past the critical spot.

Mon Oct  9 21:59:51 MET DST 2000  Jan Hubicka  <jh@suse.cz>

	* recog.c (validate_replace_src_1): New.
	(validate_replace_src_data): Likewise.
	(validate_replace_src): Use note_uses.
	* rtl.h (note_uses): Declare.
	* rtlanal.c (note_uses): New.

*** recog.c.old	Sat Feb 17 14:05:07 2001
--- recog.c	Sat Feb 17 14:08:01 2001
*************** static void validate_replace_rtx_1	PARAM
*** 59,64 ****
--- 59,65 ----
  static rtx *find_single_use_1		PARAMS ((rtx, rtx *));
  static rtx *find_constant_term_loc	PARAMS ((rtx *));
  static int insn_invalid_p		PARAMS ((rtx));
+ static void validate_replace_src_1 	PARAMS ((rtx *, void *));
  
  /* Nonzero means allow operands to be volatile.
     This should be 0 if you are generating rtl, such as if you are calling
*************** validate_replace_rtx_group (from, to, in
*** 742,747 ****
--- 743,765 ----
    validate_replace_rtx_1 (&PATTERN (insn), from, to, insn);
  }
  
+ /* Function called by note_uses to replace used subexpressions.  */
+ struct validate_replace_src_data
+   {
+     rtx from, to, insn;
+   };
+ 
+ static void
+ validate_replace_src_1 (x, data)
+      rtx *x;
+      void *data;
+ {
+   struct validate_replace_src_data *d
+     = (struct validate_replace_src_data *) data;
+ 
+   validate_replace_rtx_1 (x, d->from, d->to, d->insn);
+ }
+ 
  /* Try replacing every occurrence of FROM in INSN with TO, avoiding
     SET_DESTs.  After all changes have been made, validate by seeing if
     INSN is still valid.  */
*************** int
*** 750,763 ****
  validate_replace_src (from, to, insn)
       rtx from, to, insn;
  {
!   if ((GET_CODE (insn) != INSN && GET_CODE (insn) != JUMP_INSN)
!       || GET_CODE (PATTERN (insn)) != SET)
!     abort ();
! 
!   validate_replace_rtx_1 (&SET_SRC (PATTERN (insn)), from, to, insn);
!   if (GET_CODE (SET_DEST (PATTERN (insn))) == MEM)
!     validate_replace_rtx_1 (&XEXP (SET_DEST (PATTERN (insn)), 0),
! 			    from, to, insn);
    return apply_change_group ();
  }
  
--- 768,778 ----
  validate_replace_src (from, to, insn)
       rtx from, to, insn;
  {
!   struct validate_replace_src_data d;
!   d.from = from;
!   d.to = to;
!   d.insn = insn;
!   note_uses (&PATTERN (insn), validate_replace_src_1, &d);
    return apply_change_group ();
  }
  
*** rtlanal.c.old	Sat Feb 17 14:05:12 2001
--- rtlanal.c	Sat Feb 17 14:06:55 2001
*************** note_stores (x, fun, data)
*** 1303,1308 ****
--- 1303,1361 ----
        note_stores (XVECEXP (x, 0, i), fun, data);
  }
  
+ /* Call function FUN for each subexpression that is not
+    used as an destination of SET or CLOBBER.  */
+ 
+ void
+ note_uses (expp, fun, data)
+      rtx *expp;
+      void (*fun) PARAMS ((rtx *, void *));
+      void *data;
+ {
+   rtx x = *expp;
+ 
+   switch (GET_CODE (x))
+     {
+     case PARALLEL:
+       {
+ 	int i;
+ 	for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
+ 	  note_uses (&XVECEXP (x, 0, i), fun, data);
+       }
+       break;
+     case SET:
+       {
+ 	rtx dest = SET_DEST (x);
+ 	/* For sets we replace everything in source plus registers in memory
+ 	   expression in store.  */
+ 	fun (&SET_SRC (x), data);
+ 	if (GET_CODE (dest) == ZERO_EXTRACT
+ 	    || GET_CODE (dest) == SIGN_EXTRACT
+ 	    || GET_CODE (dest) == STRICT_LOW_PART)
+ 	  {
+ 	    fun (&XEXP (dest, 1), data);
+ 	    fun (&XEXP (dest, 2), data);
+ 	  }
+ 	if (GET_CODE (dest) == SUBREG)
+ 	  dest = SUBREG_REG (dest);
+ 	if (GET_CODE (dest) == MEM)
+ 	  fun (&XEXP (dest, 0), data);
+       }
+       break;
+     case CLOBBER:
+       if (GET_CODE (x) == MEM)
+ 	fun (&XEXP (x, 0), data);
+       else if (GET_CODE (x) == SUBREG
+ 	       && GET_CODE (SUBREG_REG (x)) == MEM)
+ 	fun (&XEXP (SUBREG_REG (x), 0), data);
+       break;
+     default:
+       /* All the other patterns never store.  */
+       fun (expp, data);
+       break;
+     }
+ }
+ 
  /* Return nonzero if X's old contents don't survive after INSN.
     This will be true if X is (cc0) or if X is a register and
     X dies in INSN or because INSN entirely sets X.
*** rtl.h.old	Sat Feb 17 14:05:15 2001
--- rtl.h	Sat Feb 17 14:05:19 2001
*************** extern rtx set_of			PARAMS ((rtx, rtx));
*** 1403,1408 ****
--- 1403,1411 ----
  extern void note_stores			PARAMS ((rtx,
  						 void (*) (rtx, rtx, void *),
  						 void *));
+ extern void note_uses			PARAMS ((rtx *,
+ 						 void (*) (rtx *, void *),
+ 						 void *));
  extern rtx reg_set_last			PARAMS ((rtx, rtx));
  extern int dead_or_set_p		PARAMS ((rtx, rtx));
  extern int dead_or_set_regno_p		PARAMS ((rtx, unsigned int));


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