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]

PATCH COMMITTED: Use add_reg_note to create REG_NOTES


The common pattern for adding a reg note to an insn looks like this:

  REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_BR_PROB, GEN_INT (prob),
					REG_NOTES (jump));

This doesn't work with C++, because the first parameter to
gen_rtx_EXPR_LIST should be an enum machine_mode.  When creating a
register note, the first argument is instead an enum reg_note.

We could add a lot of casts, but I think it is better in every way to
instead write this code as

  add_reg_note (jump, REG_BR_PROB, GEN_INT (prob));

It is shorter and clearer.  Also, it means that we can push the
decision about whether to use an EXPR_LIST or an INSN_LIST to one
place, rather than relying on everybody getting it right everytime
they create a reg note.

I bootstrapped and tested this mechanical patch on i686-pc-linux-gnu.
I committed it to mainline as revision 137374.

Ian


2008-07-02  Ian Lance Taylor  <iant@google.com>

	* rtlanal.c (add_reg_note): New function.
	* rtl.h (add_reg_note): Declare.
	* auto-inc-dec.c (attempt_change): Use add_reg_note.
	* bb-reorder.c (add_reg_crossing_jump_notes): Likewise.
	* builtins.c (expand_builtin_longjmp): Likewise.
	(expand_builtin_nonlocal_goto): Likewise.
	* calls.c (emit_call_1, expand_call): Likewise.
	* cfgexpand.c (add_reg_br_prob_note): Likewise.
	* cfglayout.c (fixup_reorder_chain): Likewise.
	* cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
	(commit_one_edge_insertion): Likewise.
	* combine.c (move_deaths, distribute_notes): Likewise.
	* df-problems.c (df_set_note): Likewise.
	* emit-rtl.c (link_cc0_insns, try_split): Likewise.
	(set_unique_reg_note): Likewise.
	(emit_copy_of_insn_after): Likewise.
	* expr.c (expand_expr_real): Likewise.
	* gcse.c (add_label_notes): Likewise.
	* haifa-sched.c (create_check_block_twin): Likewise.
	* jump.c (mark_jump_label_1): Likewise.
	* loop-doloop.c (add_test, doloop_modify): Likewise.
	* loop-unswitch.c (compare_and_jump_seq): Likewise.
	* lower-subreg.c (move_eh_region_note): Likewise.
	* optabs.c (emit_libcall_block): Likewise.
	* predict.c (predict_insn): Likewise.
	(combine_predictions_for_insn): Likewise.
	* recog.c (peephole2_optimize): Likewise.
	* regmove.c (try_auto_increment): Likewise.
	* reg-stack.c (emit_pop_insn, move_for_stack_reg): Likewise.
	* reload.c (find_reloads): Likewise.
	* reload1.c (fixup_eh_region_note): Likewise.
	(reload_as_needed, add_auto_inc_notes, copy_eh_notes): Likewise.
	* reorg.c (delete_prior_computation): Likewise.
	(delete_computation, dbr_schedule): Likewise.
	* config/pa/pa.c (legitimize_pic_address): Likewise.
	* config/sh/sh.c (sh_reorg): Likewise.


Index: loop-unswitch.c
===================================================================
--- loop-unswitch.c	(revision 137369)
+++ loop-unswitch.c	(working copy)
@@ -125,8 +125,8 @@ compare_and_jump_seq (rtx op0, rtx op1, 
       JUMP_LABEL (jump) = label;
       LABEL_NUSES (label)++;
     }
-  REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_BR_PROB, GEN_INT (prob),
-					REG_NOTES (jump));
+  add_reg_note (jump, REG_BR_PROB, GEN_INT (prob));
+
   seq = get_insns ();
   end_sequence ();
 
Index: optabs.c
===================================================================
--- optabs.c	(revision 137369)
+++ optabs.c	(working copy)
@@ -3879,8 +3879,7 @@ emit_libcall_block (rtx insns, rtx targe
 	  if (note != 0)
 	    XEXP (note, 0) = constm1_rtx;
 	  else
-	    REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, constm1_rtx,
-						  REG_NOTES (insn));
+	    add_reg_note (insn, REG_EH_REGION, constm1_rtx);
 	}
 
   /* First emit all insns that set pseudos.  Remove them from the list as
Index: reload.c
===================================================================
--- reload.c	(revision 137369)
+++ reload.c	(working copy)
@@ -4145,9 +4145,7 @@ find_reloads (rtx insn, int replace, int
 	      && (!JUMP_P (insn)
 		  || !label_is_jump_target_p (XEXP (substitution, 0),
 					      insn)))
-	    REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND,
-						  XEXP (substitution, 0),
-						  REG_NOTES (insn));
+	    add_reg_note (insn, REG_LABEL_OPERAND, XEXP (substitution, 0));
 	}
       else
 	retval |= (substed_operand[i] != *recog_data.operand_loc[i]);
Index: rtlanal.c
===================================================================
--- rtlanal.c	(revision 137369)
+++ rtlanal.c	(working copy)
@@ -1842,6 +1842,34 @@ find_regno_fusage (const_rtx insn, enum 
 }
 
 
+/* Add register note with kind KIND and datum DATUM to INSN.  */
+
+void
+add_reg_note (rtx insn, enum reg_note kind, rtx datum)
+{
+  rtx note;
+
+  switch (kind)
+    {
+    case REG_CC_SETTER:
+    case REG_CC_USER:
+    case REG_LABEL_TARGET:
+    case REG_LABEL_OPERAND:
+      /* These types of register notes use an INSN_LIST rather than an
+	 EXPR_LIST, so that copying is done right and dumps look
+	 better.  */
+      note = alloc_INSN_LIST (datum, REG_NOTES (insn));
+      PUT_REG_NOTE_KIND (note, kind);
+      break;
+
+    default:
+      note = alloc_EXPR_LIST (kind, datum, REG_NOTES (insn));
+      break;
+    }
+
+  REG_NOTES (insn) = note;
+}
+
 /* Remove register note NOTE from the REG_NOTES of INSN.  */
 
 void
Index: builtins.c
===================================================================
--- builtins.c	(revision 137369)
+++ builtins.c	(working copy)
@@ -845,8 +845,7 @@ expand_builtin_longjmp (rtx buf_addr, rt
 
       if (JUMP_P (insn))
 	{
-	  REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO, const0_rtx,
-					      REG_NOTES (insn));
+	  add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx);
 	  break;
 	}
       else if (CALL_P (insn))
@@ -929,8 +928,7 @@ expand_builtin_nonlocal_goto (tree exp)
     {
       if (JUMP_P (insn))
 	{
-	  REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO,
-					      const0_rtx, REG_NOTES (insn));
+	  add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx);
 	  break;
 	}
       else if (CALL_P (insn))
Index: auto-inc-dec.c
===================================================================
--- auto-inc-dec.c	(revision 137369)
+++ auto-inc-dec.c	(working copy)
@@ -621,8 +621,7 @@ attempt_change (rtx new_addr, rtx inc_re
     }
 
   /* Record that this insn has an implicit side effect.  */
-  REG_NOTES (mem_insn.insn) 
-    = alloc_EXPR_LIST (REG_INC, inc_reg, REG_NOTES (mem_insn.insn));
+  add_reg_note (mem_insn.insn, REG_INC, inc_reg);
 
   if (dump_file)
     {
Index: reorg.c
===================================================================
--- reorg.c	(revision 137369)
+++ reorg.c	(working copy)
@@ -3217,9 +3217,7 @@ delete_prior_computation (rtx note, rtx 
 		{
 		  int i;
 
-		  REG_NOTES (our_prev)
-		    = gen_rtx_EXPR_LIST (REG_UNUSED, reg,
-					 REG_NOTES (our_prev));
+		  add_reg_note (our_prev, REG_UNUSED, reg);
 
 		  for (i = dest_regno; i < dest_endregno; i++)
 		    if (! find_regno_note (our_prev, REG_UNUSED, i))
@@ -3281,8 +3279,7 @@ delete_computation (rtx insn)
 	    delete_computation (prev);
 	  else
 	    /* Otherwise, show that cc0 won't be used.  */
-	    REG_NOTES (prev) = gen_rtx_EXPR_LIST (REG_UNUSED,
-						  cc0_rtx, REG_NOTES (prev));
+	    add_reg_note (prev, REG_UNUSED, cc0_rtx);
 	}
     }
 #endif
@@ -4024,9 +4021,7 @@ dbr_schedule (rtx first)
 	continue;
 
       pred_flags = get_jump_flags (insn, JUMP_LABEL (insn));
-      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_BR_PRED,
-					    GEN_INT (pred_flags),
-					    REG_NOTES (insn));
+      add_reg_note (insn, REG_BR_PRED, GEN_INT (pred_flags));
     }
   free_resource_info ();
   free (uid_to_ruid);
Index: haifa-sched.c
===================================================================
--- haifa-sched.c	(revision 137369)
+++ haifa-sched.c	(working copy)
@@ -3773,11 +3773,7 @@ create_check_block_twin (rtx insn, bool 
 	    /* any_condjump_p (jump) == false.
 	       We don't need the same note for the check because
 	       any_condjump_p (check) == true.  */
-	    {
-	      REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
-						    NULL_RTX,
-						    REG_NOTES (jump));
-	    }
+	    add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
 	  edge_flags = EDGE_CROSSING;
 	}
       else
Index: jump.c
===================================================================
--- jump.c	(revision 137369)
+++ jump.c	(working copy)
@@ -1068,8 +1068,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool
 		   a label, except for the primary target of a jump,
 		   must have such a note.  */
 		if (! find_reg_note (insn, kind, label))
-		  REG_NOTES (insn)
-		    = gen_rtx_INSN_LIST (kind, label, REG_NOTES (insn));
+		  add_reg_note (insn, kind, label);
 	      }
 	  }
 	return;
Index: expr.c
===================================================================
--- expr.c	(revision 137369)
+++ expr.c	(working copy)
@@ -7102,10 +7102,7 @@ expand_expr_real (tree exp, rtx target, 
 	      && GET_CODE (PATTERN (insn)) != CLOBBER
 	      && GET_CODE (PATTERN (insn)) != USE
 	      && (CALL_P (insn) || may_trap_p (PATTERN (insn))))
-	    {
-	      REG_NOTES (insn) = alloc_EXPR_LIST (REG_EH_REGION, GEN_INT (rn),
-						  REG_NOTES (insn));
-	    }
+	    add_reg_note (insn, REG_EH_REGION, GEN_INT (rn));
 	}
     }
 
Index: predict.c
===================================================================
--- predict.c	(revision 137369)
+++ predict.c	(working copy)
@@ -263,12 +263,10 @@ predict_insn (rtx insn, enum br_predicto
   if (!flag_guess_branch_prob)
     return;
 
-  REG_NOTES (insn)
-    = gen_rtx_EXPR_LIST (REG_BR_PRED,
-			 gen_rtx_CONCAT (VOIDmode,
-					 GEN_INT ((int) predictor),
-					 GEN_INT ((int) probability)),
-			 REG_NOTES (insn));
+  add_reg_note (insn, REG_BR_PRED,
+		gen_rtx_CONCAT (VOIDmode,
+				GEN_INT ((int) predictor),
+				GEN_INT ((int) probability)));
 }
 
 /* Predict insn by given predictor.  */
@@ -561,9 +559,7 @@ combine_predictions_for_insn (rtx insn, 
 
   if (!prob_note)
     {
-      REG_NOTES (insn)
-	= gen_rtx_EXPR_LIST (REG_BR_PROB,
-			     GEN_INT (combined_probability), REG_NOTES (insn));
+      add_reg_note (insn, REG_BR_PROB, GEN_INT (combined_probability));
 
       /* Save the prediction into CFG in case we are seeing non-degenerated
 	 conditional jump.  */
Index: recog.c
===================================================================
--- recog.c	(revision 137369)
+++ recog.c	(working copy)
@@ -3045,10 +3045,9 @@ peephole2_optimize (void)
 			  {
 			  case REG_NORETURN:
 			  case REG_SETJMP:
-			    REG_NOTES (new_insn)
-			      = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
-						   XEXP (note, 0),
-						   REG_NOTES (new_insn));
+			    add_reg_note (new_insn, REG_NOTE_KIND (note),
+					  XEXP (note, 0));
+			    break;
 			  default:
 			    /* Discard all other reg notes.  */
 			    break;
@@ -3096,10 +3095,7 @@ peephole2_optimize (void)
 				&& !find_reg_note (x, REG_EH_REGION, NULL)))
 			  {
 			    if (note)
-			      REG_NOTES (x)
-			        = gen_rtx_EXPR_LIST (REG_EH_REGION,
-						     XEXP (note, 0),
-						     REG_NOTES (x));
+			      add_reg_note (x, REG_EH_REGION, XEXP (note, 0));
 
 			    if (x != BB_END (bb) && eh_edge)
 			      {
Index: regmove.c
===================================================================
--- regmove.c	(revision 137369)
+++ regmove.c	(working copy)
@@ -200,9 +200,8 @@ try_auto_increment (rtx insn, rtx inc_in
 		  if (note)
 		    PUT_MODE (note, REG_UNUSED);
 
-		  REG_NOTES (insn)
-		    = gen_rtx_EXPR_LIST (REG_INC,
-					 reg, REG_NOTES (insn));
+		  add_reg_note (insn, REG_INC, reg);
+
 		  if (! inc_insn_set)
 		    delete_insn (inc_insn);
 		  return 1;
Index: gcse.c
===================================================================
--- gcse.c	(revision 137369)
+++ gcse.c	(working copy)
@@ -4562,9 +4562,8 @@ add_label_notes (rtx x, rtx insn)
 	 such a LABEL_REF, so we don't have to handle REG_LABEL_TARGET
 	 notes.  */
       gcc_assert (!JUMP_P (insn));
-      REG_NOTES (insn)
-	= gen_rtx_INSN_LIST (REG_LABEL_OPERAND, XEXP (x, 0),
-			     REG_NOTES (insn));
+      add_reg_note (insn, REG_LABEL_OPERAND, XEXP (x, 0));
+
       if (LABEL_P (XEXP (x, 0)))
 	LABEL_NUSES (XEXP (x, 0))++;
 
Index: calls.c
===================================================================
--- calls.c	(revision 137369)
+++ calls.c	(working copy)
@@ -377,8 +377,7 @@ emit_call_1 (rtx funexp, tree fntree, tr
   /* If this call can't throw, attach a REG_EH_REGION reg note to that
      effect.  */
   if (ecf_flags & ECF_NOTHROW)
-    REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, const0_rtx,
-					       REG_NOTES (call_insn));
+    add_reg_note (call_insn, REG_EH_REGION, const0_rtx);
   else
     {
       int rn = lookup_stmt_eh_region (fntree);
@@ -386,18 +385,15 @@ emit_call_1 (rtx funexp, tree fntree, tr
       /* If rn < 0, then either (1) tree-ssa not used or (2) doesn't
 	 throw, which we already took care of.  */
       if (rn > 0)
-	REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (rn),
-						   REG_NOTES (call_insn));
+	add_reg_note (call_insn, REG_EH_REGION, GEN_INT (rn));
     }
 
   if (ecf_flags & ECF_NORETURN)
-    REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_NORETURN, const0_rtx,
-					       REG_NOTES (call_insn));
+    add_reg_note (call_insn, REG_NORETURN, const0_rtx);
 
   if (ecf_flags & ECF_RETURNS_TWICE)
     {
-      REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_SETJMP, const0_rtx,
-						 REG_NOTES (call_insn));
+      add_reg_note (call_insn, REG_SETJMP, const0_rtx);
       cfun->calls_setjmp = 1;
     }
 
@@ -2814,8 +2810,7 @@ expand_call (tree exp, rtx target, int i
 	  /* The return value from a malloc-like function can not alias
 	     anything else.  */
 	  last = get_last_insn ();
-	  REG_NOTES (last) =
-	    gen_rtx_EXPR_LIST (REG_NOALIAS, temp, REG_NOTES (last));
+	  add_reg_note (last, REG_NOALIAS, temp);
 
 	  /* Write out the sequence.  */
 	  insns = get_insns ();
Index: loop-doloop.c
===================================================================
--- loop-doloop.c	(revision 137369)
+++ loop-doloop.c	(working copy)
@@ -321,9 +321,8 @@ add_test (rtx cond, edge *e, basic_block
   JUMP_LABEL (jump) = label;
 
   /* The jump is supposed to handle an unlikely special case.  */
-  REG_NOTES (jump)
-	  = gen_rtx_EXPR_LIST (REG_BR_PROB,
-			       const0_rtx, REG_NOTES (jump));
+  add_reg_note (jump, REG_BR_PROB, const0_rtx);
+
   LABEL_NUSES (label)++;
 
   make_edge (bb, dest, (*e)->flags & ~EDGE_FALLTHRU);
@@ -518,18 +517,14 @@ doloop_modify (struct loop *loop, struct
   /* Add a REG_NONNEG note if the actual or estimated maximum number
      of iterations is non-negative.  */
   if (nonneg)
-    {
-      REG_NOTES (jump_insn)
-	= gen_rtx_EXPR_LIST (REG_NONNEG, NULL_RTX, REG_NOTES (jump_insn));
-    }
+    add_reg_note (jump_insn, REG_NONNEG, NULL_RTX);
+
   /* Update the REG_BR_PROB note.  */
   if (true_prob_val)
     {
       /* Seems safer to use the branch probability.  */
-      REG_NOTES (jump_insn) =
-        gen_rtx_EXPR_LIST (REG_BR_PROB,
-                           GEN_INT (desc->in_edge->probability),
-                           REG_NOTES (jump_insn));
+      add_reg_note (jump_insn, REG_BR_PROB, 
+		    GEN_INT (desc->in_edge->probability));
     }
 }
 
Index: lower-subreg.c
===================================================================
--- lower-subreg.c	(revision 137369)
+++ lower-subreg.c	(working copy)
@@ -551,8 +551,7 @@ move_eh_region_note (rtx insn, rtx insns
 	  || (flag_non_call_exceptions
 	      && INSN_P (p)
 	      && may_trap_p (PATTERN (p))))
-	REG_NOTES (p) = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (note, 0),
-					   REG_NOTES (p));
+	add_reg_note (p, REG_EH_REGION, XEXP (note, 0));
     }
 }
 
Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 137369)
+++ emit-rtl.c	(working copy)
@@ -3044,9 +3044,8 @@ link_cc0_insns (rtx insn)
   if (NONJUMP_INSN_P (user) && GET_CODE (PATTERN (user)) == SEQUENCE)
     user = XVECEXP (PATTERN (user), 0, 0);
 
-  REG_NOTES (user) = gen_rtx_INSN_LIST (REG_CC_SETTER, insn,
-					REG_NOTES (user));
-  REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_CC_USER, user, REG_NOTES (insn));
+  add_reg_note (user, REG_CC_SETTER, insn);
+  add_reg_note (insn, REG_CC_USER, user);
 }
 
 /* Return the next insn that uses CC0 after INSN, which is assumed to
@@ -3223,10 +3222,7 @@ try_split (rtx pat, rtx trial, int last)
 		 is responsible for this step using
 		 split_branch_probability variable.  */
 	      gcc_assert (njumps == 1);
-	      REG_NOTES (insn)
-		= gen_rtx_EXPR_LIST (REG_BR_PROB,
-				     GEN_INT (probability),
-				     REG_NOTES (insn));
+	      add_reg_note (insn, REG_BR_PROB, GEN_INT (probability));
 	    }
 	}
     }
@@ -3257,10 +3253,7 @@ try_split (rtx pat, rtx trial, int last)
 	      if (CALL_P (insn)
 		  || (flag_non_call_exceptions && INSN_P (insn)
 		      && may_trap_p (PATTERN (insn))))
-		REG_NOTES (insn)
-		  = gen_rtx_EXPR_LIST (REG_EH_REGION,
-				       XEXP (note, 0),
-				       REG_NOTES (insn));
+		add_reg_note (insn, REG_EH_REGION, XEXP (note, 0));
 	    }
 	  break;
 
@@ -3269,10 +3262,7 @@ try_split (rtx pat, rtx trial, int last)
 	  for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
 	    {
 	      if (CALL_P (insn))
-		REG_NOTES (insn)
-		  = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
-				       XEXP (note, 0),
-				       REG_NOTES (insn));
+		add_reg_note (insn, REG_NOTE_KIND (note), XEXP (note, 0));
 	    }
 	  break;
 
@@ -3280,10 +3270,7 @@ try_split (rtx pat, rtx trial, int last)
 	  for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
 	    {
 	      if (JUMP_P (insn))
-		REG_NOTES (insn)
-		  = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
-				       XEXP (note, 0),
-				       REG_NOTES (insn));
+		add_reg_note (insn, REG_NOTE_KIND (note), XEXP (note, 0));
 	    }
 	  break;
 
@@ -3294,8 +3281,7 @@ try_split (rtx pat, rtx trial, int last)
 	      rtx reg = XEXP (note, 0);
 	      if (!FIND_REG_INC_NOTE (insn, reg)
 		  && for_each_rtx (&PATTERN (insn), find_auto_inc, reg) > 0)
-		REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_INC, reg,
-						      REG_NOTES (insn));
+		add_reg_note (insn, REG_INC, reg);
 	    }
 	  break;
 #endif
@@ -4600,7 +4586,6 @@ rtx
 set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
 {
   rtx note = find_reg_note (insn, kind, NULL_RTX);
-  rtx new_note = NULL;
 
   switch (kind)
     {
@@ -4638,8 +4623,7 @@ set_unique_reg_note (rtx insn, enum reg_
       break;
     }
 
-  new_note = gen_rtx_EXPR_LIST (kind, datum, REG_NOTES (insn));
-  REG_NOTES (insn) = new_note;
+  add_reg_note (insn, kind, datum);
 
   switch (kind)
     {
@@ -5525,13 +5509,10 @@ emit_copy_of_insn_after (rtx insn, rtx a
     if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND)
       {
 	if (GET_CODE (link) == EXPR_LIST)
-	  REG_NOTES (new)
-		= gen_rtx_EXPR_LIST (REG_NOTE_KIND (link),
-		  copy_insn_1 (XEXP (link, 0)),  REG_NOTES (new));
+	  add_reg_note (new, REG_NOTE_KIND (link),
+			copy_insn_1 (XEXP (link, 0)));
 	else
-	  REG_NOTES (new)
-	       = gen_rtx_INSN_LIST (REG_NOTE_KIND (link),
-		 XEXP (link, 0),  REG_NOTES (new));
+	  add_reg_note (new, REG_NOTE_KIND (link), XEXP (link, 0));
       }
 
   INSN_CODE (new) = INSN_CODE (insn);
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 137369)
+++ cfgexpand.c	(working copy)
@@ -67,18 +67,14 @@ add_reg_br_prob_note (rtx last, int prob
 	    || NEXT_INSN (NEXT_INSN (NEXT_INSN (NEXT_INSN (last)))))
 	  goto failed;
 	gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
-	REG_NOTES (last)
-	  = gen_rtx_EXPR_LIST (REG_BR_PROB,
-			       GEN_INT (REG_BR_PROB_BASE - probability),
-			       REG_NOTES (last));
+	add_reg_note (last, REG_BR_PROB,
+		      GEN_INT (REG_BR_PROB_BASE - probability));
 	return;
       }
   if (!last || !JUMP_P (last) || !any_condjump_p (last))
     goto failed;
   gcc_assert (!find_reg_note (last, REG_BR_PROB, 0));
-  REG_NOTES (last)
-    = gen_rtx_EXPR_LIST (REG_BR_PROB,
-			 GEN_INT (probability), REG_NOTES (last));
+  add_reg_note (last, REG_BR_PROB, GEN_INT (probability));
   return;
 failed:
   if (dump_file)
Index: cfglayout.c
===================================================================
--- cfglayout.c	(revision 137369)
+++ cfglayout.c	(working copy)
@@ -855,8 +855,7 @@ fixup_reorder_chain (void)
 	      && JUMP_P (BB_END (bb))
 	      && !any_condjump_p (BB_END (bb))
 	      && (EDGE_SUCC (bb, 0)->flags & EDGE_CROSSING))
-	    REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
-	      (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+	    add_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX);
 	}
     }
 
Index: rtl.h
===================================================================
--- rtl.h	(revision 137369)
+++ rtl.h	(working copy)
@@ -1755,6 +1755,7 @@ extern rtx find_reg_equal_equiv_note (co
 extern rtx find_constant_src (const_rtx);
 extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
 extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
+extern void add_reg_note (rtx, enum reg_note, rtx);
 extern void remove_note (rtx, const_rtx);
 extern void remove_reg_equal_equiv_notes (rtx);
 extern int side_effects_p (const_rtx);
Index: combine.c
===================================================================
--- combine.c	(revision 137369)
+++ combine.c	(working copy)
@@ -12149,10 +12149,7 @@ move_deaths (rtx x, rtx maybe_kill_insn,
 
 	      for (i = deadregno; i < deadend; i++)
 		if (i < regno || i >= ourend)
-		  REG_NOTES (where_dead)
-		    = gen_rtx_EXPR_LIST (REG_DEAD,
-					 regno_reg_rtx[i],
-					 REG_NOTES (where_dead));
+		  add_reg_note (where_dead, REG_DEAD, regno_reg_rtx[i]);
 	    }
 
 	  /* If we didn't find any note, or if we found a REG_DEAD note that
@@ -12774,9 +12771,7 @@ distribute_notes (rtx notes, rtx from_in
 				    || reg_bitfield_target_p (piece,
 							      PATTERN (tem)))
 				  {
-				    REG_NOTES (tem)
-				      = gen_rtx_EXPR_LIST (REG_UNUSED, piece,
-							   REG_NOTES (tem));
+				    add_reg_note (tem, REG_UNUSED, piece);
 				    break;
 				  }
 			      }
Index: bb-reorder.c
===================================================================
--- bb-reorder.c	(revision 137369)
+++ bb-reorder.c	(working copy)
@@ -1785,10 +1785,7 @@ add_reg_crossing_jump_notes (void)
     FOR_EACH_EDGE (e, ei, bb->succs)
       if ((e->flags & EDGE_CROSSING)
 	  && JUMP_P (BB_END (e->src)))
-	REG_NOTES (BB_END (e->src)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
-							 NULL_RTX,
-							 REG_NOTES (BB_END
-								  (e->src)));
+	add_reg_note (BB_END (e->src), REG_CROSSING_JUMP, NULL_RTX);
 }
 
 /* Hot and cold basic blocks are partitioned and put in separate
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 137369)
+++ df-problems.c	(working copy)
@@ -3191,7 +3191,7 @@ df_set_note (enum reg_note note_type, rt
       }
   
   /* Did not find the note.  */
-  REG_NOTES (insn) = alloc_EXPR_LIST (note_type, reg, REG_NOTES (insn));
+  add_reg_note (insn, note_type, reg);
   return old;
 }
 
Index: reg-stack.c
===================================================================
--- reg-stack.c	(revision 137369)
+++ reg-stack.c	(working copy)
@@ -788,9 +788,7 @@ emit_pop_insn (rtx insn, stack regstack,
   else
     pop_insn = emit_insn_before (pop_rtx, insn);
 
-  REG_NOTES (pop_insn)
-    = gen_rtx_EXPR_LIST (REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode),
-			 REG_NOTES (pop_insn));
+  add_reg_note (pop_insn, REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode));
 
   regstack->reg[regstack->top - (hard_regno - FIRST_STACK_REG)]
     = regstack->reg[regstack->top];
@@ -1064,8 +1062,7 @@ move_for_stack_reg (rtx insn, stack regs
 
 	  push_rtx = gen_movxf (top_stack_reg, top_stack_reg);
 	  emit_insn_before (push_rtx, insn);
-	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_DEAD, top_stack_reg,
-						REG_NOTES (insn));
+	  add_reg_note (insn, REG_DEAD, top_stack_reg);
 	}
 
       replace_reg (psrc, FIRST_STACK_REG);
Index: config/sh/sh.c
===================================================================
--- config/sh/sh.c	(revision 137369)
+++ config/sh/sh.c	(working copy)
@@ -4983,10 +4983,8 @@ sh_reorg (void)
              or pseudo-op.  */
 
 	  label = gen_label_rtx ();
-	  REG_NOTES (link) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
-						REG_NOTES (link));
-	  REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
-						REG_NOTES (insn));
+	  add_reg_note (link, REG_LABEL_OPERAND, label);
+	  add_reg_note (insn, REG_LABEL_OPERAND, label);
 	  if (rescan)
 	    {
 	      scan = link;
@@ -5000,9 +4998,7 @@ sh_reorg (void)
 			   && reg_mentioned_p (reg, scan))
 			  || ((reg2 = sfunc_uses_reg (scan))
 			      && REGNO (reg2) == REGNO (reg))))
-		    REG_NOTES (scan)
-		      = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, label,
-					   REG_NOTES (scan));
+		    add_reg_note (scan, REG_LABEL_OPERAND, label);
 		}
 	      while (scan != dies);
 	    }
Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 137369)
+++ config/pa/pa.c	(working copy)
@@ -694,8 +694,7 @@ legitimize_pic_address (rtx orig, enum m
 	    orig = XEXP (XEXP (orig, 0), 0);
 	  /* Extract CODE_LABEL.  */
 	  orig = XEXP (orig, 0);
-	  REG_NOTES (insn) = gen_rtx_INSN_LIST (REG_LABEL_OPERAND, orig,
-						REG_NOTES (insn));
+	  add_reg_note (insn, REG_LABEL_OPERAND, orig);
 	  LABEL_NUSES (orig)++;
 	}
       crtl->uses_pic_offset_table = 1;
Index: cfgrtl.c
===================================================================
--- cfgrtl.c	(revision 137369)
+++ cfgrtl.c	(working copy)
@@ -1111,11 +1111,7 @@ force_nonfallthru_and_redirect (edge e, 
 	  && JUMP_P (BB_END (jump_block))
 	  && !any_condjump_p (BB_END (jump_block))
 	  && (EDGE_SUCC (jump_block, 0)->flags & EDGE_CROSSING))
-	REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
-							     NULL_RTX,
-							     REG_NOTES
-							     (BB_END
-							      (jump_block)));
+	add_reg_note (BB_END (jump_block), REG_CROSSING_JUMP, NULL_RTX);
 
       /* Wire edge in.  */
       new_edge = make_edge (e->src, jump_block, EDGE_FALLTHRU);
@@ -1418,8 +1414,7 @@ commit_one_edge_insertion (edge e)
 	      if (JUMP_P (BB_END (bb))
 		  && !any_condjump_p (BB_END (bb))
 		  && (single_succ_edge (bb)->flags & EDGE_CROSSING))
-		REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
-		  (REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
+		add_reg_note (BB_END (bb), REG_CROSSING_JUMP, NULL_RTX);
 	    }
 	}
     }
Index: reload1.c
===================================================================
--- reload1.c	(revision 137369)
+++ reload1.c	(working copy)
@@ -4000,8 +4000,7 @@ fixup_eh_region_note (rtx insn, rtx prev
     if (INSN_P (i) && i != insn && may_trap_p (PATTERN (i)))
       {
 	trap_count++;
-	REG_NOTES (i)
-	  = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (note, 0), REG_NOTES (i));
+	add_reg_note (i, REG_EH_REGION, XEXP (note, 0));
       }
 }
 
@@ -4235,9 +4234,7 @@ reload_as_needed (int live_known)
 			}
 		      if (n == 1)
 			{
-			  REG_NOTES (p)
-			    = gen_rtx_EXPR_LIST (REG_INC, reload_reg,
-						 REG_NOTES (p));
+			  add_reg_note (p, REG_INC, reload_reg);
 			  /* Mark this as having an output reload so that the
 			     REG_INC processing code below won't invalidate
 			     the reload for inheritance.  */
@@ -8535,8 +8532,7 @@ add_auto_inc_notes (rtx insn, rtx x)
 
   if (code == MEM && auto_inc_p (XEXP (x, 0)))
     {
-      REG_NOTES (insn)
-	= gen_rtx_EXPR_LIST (REG_INC, XEXP (XEXP (x, 0), 0), REG_NOTES (insn));
+      add_reg_note (insn, REG_INC, XEXP (XEXP (x, 0), 0));
       return;
     }
 
@@ -8563,9 +8559,7 @@ copy_eh_notes (rtx insn, rtx x)
       for (; x != 0; x = NEXT_INSN (x))
 	{
 	  if (may_trap_p (PATTERN (x)))
-	    REG_NOTES (x)
-	      = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (eh_note, 0),
-				   REG_NOTES (x));
+	    add_reg_note (x, REG_EH_REGION, XEXP (eh_note, 0));
 	}
     }
 }

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