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]

RFA: Fix PR middle-end/20714


Bootstrapped & regtested on i686-pc-linux-gnu.
2005-04-08  J"orn Rennecke <joern.rennecke@st.com>

	PR middle-end/20714:
	* optabs.c (no_conflict_data): New struct.
	(no_conflict_move_test): New function.
	(emit_no_conflict_block): Use it.

Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.268
retrieving revision 1.268.2.1
diff -p -r1.268 -r1.268.2.1
*** optabs.c	24 Mar 2005 06:22:36 -0000	1.268
--- optabs.c	8 Apr 2005 18:28:00 -0000	1.268.2.1
*************** emit_unop_insn (int icode, rtx target, r
*** 2952,2957 ****
--- 2958,2988 ----
      emit_move_insn (target, temp);
  }
  
+ struct no_conflict_data
+ {
+   rtx target, insns, insn;
+   bool must_stay;
+ };
+ 
+ /* Called via note_stores by emit_no_conflict_block.  Set P->must_stay
+    if the currently examined clobber / store has to stay in the list of
+    insns that constitute the actual no_conflict block.  */
+ static void
+ no_conflict_move_test (rtx dest, rtx set, void *p0)
+ {
+   struct no_conflict_data *p= p0;
+ 
+   if (reg_overlap_mentioned_p (p->target, dest)
+       || (p->insn != p->insns
+ 	  && (reg_mentioned_p (dest, PATTERN (p->insns))
+ 	      || reg_used_between_p (dest, p->insns, p->insn)
+ 	      || (GET_CODE (set) == SET
+ 		  && (modified_in_p (SET_SRC (set), p->insns)
+ 		      || modified_between_p (SET_SRC (set), p->insns,
+ 					     p->insn))))))
+     p->must_stay = true;
+ }
+ 
  /* Emit code to perform a series of operations on a multi-word quantity, one
     word at a time.
  
*************** emit_no_conflict_block (rtx insns, rtx t
*** 2997,3004 ****
       these from the list.  */
    for (insn = insns; insn; insn = next)
      {
!       rtx set = 0, note;
!       int i;
  
        next = NEXT_INSN (insn);
  
--- 3028,3035 ----
       these from the list.  */
    for (insn = insns; insn; insn = next)
      {
!       rtx note;
!       struct no_conflict_data data;
  
        next = NEXT_INSN (insn);
  
*************** emit_no_conflict_block (rtx insns, rtx t
*** 3009,3031 ****
        if ((note = find_reg_note (insn, REG_RETVAL, NULL)) != NULL)
  	remove_note (insn, note);
  
!       if (GET_CODE (PATTERN (insn)) == SET || GET_CODE (PATTERN (insn)) == USE
! 	  || GET_CODE (PATTERN (insn)) == CLOBBER)
! 	set = PATTERN (insn);
!       else if (GET_CODE (PATTERN (insn)) == PARALLEL)
! 	{
! 	  for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
! 	    if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == SET)
! 	      {
! 		set = XVECEXP (PATTERN (insn), 0, i);
! 		break;
! 	      }
! 	}
! 
!       if (set == 0)
! 	abort ();
! 
!       if (! reg_overlap_mentioned_p (target, SET_DEST (set)))
  	{
  	  if (PREV_INSN (insn))
  	    NEXT_INSN (PREV_INSN (insn)) = next;
--- 3040,3051 ----
        if ((note = find_reg_note (insn, REG_RETVAL, NULL)) != NULL)
  	remove_note (insn, note);
  
!       data.target = target;
!       data.insns = insns;
!       data.insn = insn;
!       data.must_stay = 0;
!       note_stores (PATTERN (insn), no_conflict_move_test, &data);
!       if (! data.must_stay)
  	{
  	  if (PREV_INSN (insn))
  	    NEXT_INSN (PREV_INSN (insn)) = next;

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