summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-02 18:01:18 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-02 18:01:18 +0000
commita1ddb869e0e3d5284a4065fe19e0390f16303611 (patch)
treefb50da4819a8e8a71c5d1bc4aa7a80c441cac4f3
parentb3fd46a0f94ccfc993aa26f42db901c8f486c8b1 (diff)
downloadgcc-a1ddb869e0e3d5284a4065fe19e0390f16303611.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137374 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog39
-rw-r--r--gcc/auto-inc-dec.c3
-rw-r--r--gcc/bb-reorder.c5
-rw-r--r--gcc/builtins.c6
-rw-r--r--gcc/calls.c15
-rw-r--r--gcc/cfgexpand.c10
-rw-r--r--gcc/cfglayout.c3
-rw-r--r--gcc/cfgrtl.c9
-rw-r--r--gcc/combine.c9
-rw-r--r--gcc/config/pa/pa.c3
-rw-r--r--gcc/config/sh/sh.c10
-rw-r--r--gcc/df-problems.c2
-rw-r--r--gcc/emit-rtl.c41
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/gcse.c5
-rw-r--r--gcc/haifa-sched.c6
-rw-r--r--gcc/jump.c3
-rw-r--r--gcc/loop-doloop.c17
-rw-r--r--gcc/loop-unswitch.c4
-rw-r--r--gcc/lower-subreg.c3
-rw-r--r--gcc/optabs.c3
-rw-r--r--gcc/predict.c14
-rw-r--r--gcc/recog.c12
-rw-r--r--gcc/reg-stack.c7
-rw-r--r--gcc/regmove.c5
-rw-r--r--gcc/reload.c4
-rw-r--r--gcc/reload1.c14
-rw-r--r--gcc/reorg.c11
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c28
30 files changed, 137 insertions, 160 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c1bbc252c54..06314eaed00 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+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.
+
2008-07-02 H.J. Lu <hongjiu.lu@intel.com>
PR target/36669
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 18c1b7107da..35d6c87a696 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -621,8 +621,7 @@ attempt_change (rtx new_addr, rtx inc_reg)
}
/* 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)
{
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index b36c6c24bb3..ae24c0c3245 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -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
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 10af34254aa..731955b5699 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -845,8 +845,7 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
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))
diff --git a/gcc/calls.c b/gcc/calls.c
index 79dc47b98fa..a4470fa1477 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -377,8 +377,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
/* 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, tree fndecl ATTRIBUTE_UNUSED,
/* 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 ignore)
/* 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 ();
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index afa3e123106..6a48e1632d7 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -67,18 +67,14 @@ add_reg_br_prob_note (rtx last, int probability)
|| 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)
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 623e5bdd911..e4049d66465 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -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);
}
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 8ce39006cf3..240455bca9d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1111,11 +1111,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target)
&& 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);
}
}
}
diff --git a/gcc/combine.c b/gcc/combine.c
index 59586a8bf18..a6cff36480f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12149,10 +12149,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx to_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_insn, rtx i3, rtx i2, rtx elim_i2,
|| 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;
}
}
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 0529a86a68c..238d35276e4 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -694,8 +694,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg)
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;
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 71419ec61de..380705104ee 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -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);
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 28c99638ec3..0c46bdaa496 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3191,7 +3191,7 @@ df_set_note (enum reg_note note_type, rtx insn, rtx old, rtx reg)
}
/* 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;
}
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 418da241b66..22c7979a773 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -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_note kind, rtx datum)
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 after)
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);
diff --git a/gcc/expr.c b/gcc/expr.c
index 6d6278a7bc7..33616d6900e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7102,10 +7102,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
&& 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));
}
}
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 771df43a321..0955744855c 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -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))++;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 8d5b38bbf32..d614986b49c 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -3773,11 +3773,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
/* 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
diff --git a/gcc/jump.c b/gcc/jump.c
index 23d183e932c..595363b1adb 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1068,8 +1068,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
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;
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index c6e0540d15f..293b3ae3776 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -321,9 +321,8 @@ add_test (rtx cond, edge *e, basic_block dest)
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 niter_desc *desc,
/* 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));
}
}
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index 54c39a5698a..9d66d41db6e 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -125,8 +125,8 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
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 ();
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 67a95984fab..57205b51e61 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -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));
}
}
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 32a6396bd70..6e8c6cf3d21 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3879,8 +3879,7 @@ emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
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
diff --git a/gcc/predict.c b/gcc/predict.c
index ca7f9448d01..ad5e8eae232 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -263,12 +263,10 @@ predict_insn (rtx insn, enum br_predictor predictor, int probability)
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, basic_block bb)
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. */
diff --git a/gcc/recog.c b/gcc/recog.c
index a176ed30af6..3ddfd86c635 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -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)
{
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index ffa06fd5752..4b5e422e207 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -788,9 +788,7 @@ emit_pop_insn (rtx insn, stack regstack, rtx reg, enum emit_where where)
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 regstack, rtx pat)
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);
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 4a53defed24..7de8d0d5b98 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -200,9 +200,8 @@ try_auto_increment (rtx insn, rtx inc_insn, rtx inc_insn_set, rtx reg,
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;
diff --git a/gcc/reload.c b/gcc/reload.c
index 9ab01375a91..e426d3634f6 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -4145,9 +4145,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
&& (!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]);
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 297acbf8aa5..f449ffa9c32 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4000,8 +4000,7 @@ fixup_eh_region_note (rtx insn, rtx prev, rtx next)
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));
}
}
}
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 7135a188574..25f410aad2d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3217,9 +3217,7 @@ delete_prior_computation (rtx note, rtx insn)
{
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);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 2e0884f8f56..b2b561c3421 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1755,6 +1755,7 @@ extern rtx find_reg_equal_equiv_note (const_rtx);
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);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index dec7daf0e3d..d569ff04b2b 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1842,6 +1842,34 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno)
}
+/* 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