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]

Refinement of returning nonzero from cse_main


cse_main returns nonzero if jump needs to be rerun, but it was a bit
too liberal when it thinks it sees a need to add a REG_LABEL note.  This
fixes it.

Fri Feb 16 12:41:30 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* cse.c (new_label_ref): New variable.
	(insert): Set it instead of recorded_label_ref.
	(cse_basic_block): Set recorded_label_ref if new_label_ref use, has
	CODE_LABEL for this function, and not already in REG_LABEL note.

*** cse.c	2001/02/13 20:17:44	1.175
--- cse.c	2001/02/16 13:37:05
*************** static int cse_altered;
*** 383,391 ****
  static int cse_jumps_altered;
  
! /* Nonzero if we put a LABEL_REF into the hash table.  Since we may have put
!    it into an INSN without a REG_LABEL, we have to rerun jump after CSE
!    to put in the note.  */
  static int recorded_label_ref;
  
  /* canon_hash stores 1 in do_not_record
     if it notices a reference to CC0, PC, or some other volatile
--- 383,394 ----
  static int cse_jumps_altered;
  
! /* Nonzero if we put a LABEL_REF into the hash table for an INSN without a
!    REG_LABEL, we have to rerun jump after CSE to put in the note.  */
  static int recorded_label_ref;
  
+ /* Says which LABEL_REF was put in the hash table.  Used to see if we need
+    to set the above flag.  */
+ static rtx new_label_ref;
+ 
  /* canon_hash stores 1 in do_not_record
     if it notices a reference to CC0, PC, or some other volatile
*************** insert (x, classp, hash, mode)
*** 1582,1586 ****
        || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
  	  && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF))
!     recorded_label_ref = 1;
  
    /* Put an element for X into the right hash bucket.  */
--- 1585,1589 ----
        || (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
  	  && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF))
!     new_label_ref = x;
  
    /* Put an element for X into the right hash bucket.  */
*************** cse_basic_block (from, to, next_branch, 
*** 7309,7313 ****
--- 7312,7326 ----
  	    }
  
+ 	  new_label_ref = 0;
  	  cse_insn (insn, libcall_insn);
+ 
+ 	  /* If this insn uses a LABEL_REF and there isn't a REG_LABEL
+ 	     note for it, we must rerun jump since it needs to place the
+ 	     note.  If this is a LABEL_REF for a CODE_LABEL that isn't in
+ 	     the insn chain, don't do this since no REG_LABEL will be added. */
+ 	  if (new_label_ref != 0 && INSN_UID (XEXP (new_label_ref, 0)) != 0
+ 	      && reg_mentioned_p (new_label_ref, PATTERN (insn))
+ 	      && ! find_reg_note (insn, REG_LABEL, XEXP (new_label_ref, 0)))
+ 	    recorded_label_ref = 1;
  	}
  


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