Commit efc0b2bd by Ian Lance Taylor Committed by Ian Lance Taylor

rtlanal.c (alloc_reg_note): New function, broken out of add_reg_note.

	* rtlanal.c (alloc_reg_note): New function, broken out of
	add_reg_note.
	(add_reg_note): Call alloc_reg_note.
	* rtl.h (alloc_reg_note): Declare.
	* combine.c (try_combine): Use alloc_reg_note.
	(recog_for_combine, move_deaths): Likewise.
	(distribute_notes): Use alloc_reg_note and add_reg_note.
	* haifa-sched.c (sched_create_recovery_edges): Use add_reg_note.
	* combine-stack-adj.c (adjust_frame_related_expr): Likewise.
	* reload1.c (eliminate_regs_1): Use alloc_reg_note.

From-SVN: r146201
parent 6080348f
2009-04-16 Ian Lance Taylor <iant@google.com>
* rtlanal.c (alloc_reg_note): New function, broken out of
add_reg_note.
(add_reg_note): Call alloc_reg_note.
* rtl.h (alloc_reg_note): Declare.
* combine.c (try_combine): Use alloc_reg_note.
(recog_for_combine, move_deaths): Likewise.
(distribute_notes): Use alloc_reg_note and add_reg_note.
* haifa-sched.c (sched_create_recovery_edges): Use add_reg_note.
* combine-stack-adj.c (adjust_frame_related_expr): Likewise.
* reload1.c (eliminate_regs_1): Use alloc_reg_note.
2009-04-16 Vladimir Makarov <vmakarov@redhat.com> 2009-04-16 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/39762 PR rtl-optimization/39762
......
/* Combine stack adjustments. /* Combine stack adjustments.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -333,9 +333,7 @@ adjust_frame_related_expr (rtx last_sp_set, rtx insn, ...@@ -333,9 +333,7 @@ adjust_frame_related_expr (rtx last_sp_set, rtx insn,
if (note) if (note)
XEXP (note, 0) = new_expr; XEXP (note, 0) = new_expr;
else else
REG_NOTES (last_sp_set) add_reg_note (last_sp_set, REG_FRAME_RELATED_EXPR, new_expr);
= gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, new_expr,
REG_NOTES (last_sp_set));
} }
/* Subroutine of combine_stack_adjustments, called for each basic block. */ /* Subroutine of combine_stack_adjustments, called for each basic block. */
...@@ -561,4 +559,3 @@ struct rtl_opt_pass pass_stack_adjustments = ...@@ -561,4 +559,3 @@ struct rtl_opt_pass pass_stack_adjustments =
TODO_ggc_collect, /* todo_flags_finish */ TODO_ggc_collect, /* todo_flags_finish */
} }
}; };
...@@ -3643,11 +3643,11 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) ...@@ -3643,11 +3643,11 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i3dest_killed) if (i3dest_killed)
{ {
if (newi2pat && reg_set_p (i3dest_killed, newi2pat)) if (newi2pat && reg_set_p (i3dest_killed, newi2pat))
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed, distribute_notes (alloc_reg_note (REG_DEAD, i3dest_killed,
NULL_RTX), NULL_RTX),
NULL_RTX, i2, NULL_RTX, elim_i2, elim_i1); NULL_RTX, i2, NULL_RTX, elim_i2, elim_i1);
else else
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed, distribute_notes (alloc_reg_note (REG_DEAD, i3dest_killed,
NULL_RTX), NULL_RTX),
NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
elim_i2, elim_i1); elim_i2, elim_i1);
...@@ -3656,10 +3656,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) ...@@ -3656,10 +3656,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i2dest_in_i2src) if (i2dest_in_i2src)
{ {
if (newi2pat && reg_set_p (i2dest, newi2pat)) if (newi2pat && reg_set_p (i2dest, newi2pat))
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i2dest, NULL_RTX), distribute_notes (alloc_reg_note (REG_DEAD, i2dest, NULL_RTX),
NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX); NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX);
else else
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i2dest, NULL_RTX), distribute_notes (alloc_reg_note (REG_DEAD, i2dest, NULL_RTX),
NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
NULL_RTX, NULL_RTX); NULL_RTX, NULL_RTX);
} }
...@@ -3667,10 +3667,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) ...@@ -3667,10 +3667,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i1dest_in_i1src) if (i1dest_in_i1src)
{ {
if (newi2pat && reg_set_p (i1dest, newi2pat)) if (newi2pat && reg_set_p (i1dest, newi2pat))
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i1dest, NULL_RTX), distribute_notes (alloc_reg_note (REG_DEAD, i1dest, NULL_RTX),
NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX); NULL_RTX, i2, NULL_RTX, NULL_RTX, NULL_RTX);
else else
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i1dest, NULL_RTX), distribute_notes (alloc_reg_note (REG_DEAD, i1dest, NULL_RTX),
NULL_RTX, i3, newi2pat ? i2 : NULL_RTX, NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
NULL_RTX, NULL_RTX); NULL_RTX, NULL_RTX);
} }
...@@ -9863,7 +9863,7 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes) ...@@ -9863,7 +9863,7 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH) if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH)
{ {
gcc_assert (REG_P (XEXP (XVECEXP (newpat, 0, i), 0))); gcc_assert (REG_P (XEXP (XVECEXP (newpat, 0, i), 0)));
notes = gen_rtx_EXPR_LIST (REG_UNUSED, notes = alloc_reg_note (REG_UNUSED,
XEXP (XVECEXP (newpat, 0, i), 0), notes); XEXP (XVECEXP (newpat, 0, i), 0), notes);
} }
} }
...@@ -12231,7 +12231,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx to_insn, ...@@ -12231,7 +12231,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx to_insn,
*pnotes = note; *pnotes = note;
} }
else else
*pnotes = gen_rtx_EXPR_LIST (REG_DEAD, x, *pnotes); *pnotes = alloc_reg_note (REG_DEAD, x, *pnotes);
} }
return; return;
...@@ -12800,8 +12800,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, ...@@ -12800,8 +12800,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
&& ! reg_bitfield_target_p (piece, && ! reg_bitfield_target_p (piece,
PATTERN (place))) PATTERN (place)))
{ {
rtx new_note rtx new_note = alloc_reg_note (REG_DEAD, piece,
= gen_rtx_EXPR_LIST (REG_DEAD, piece, NULL_RTX); NULL_RTX);
distribute_notes (new_note, place, place, distribute_notes (new_note, place, place,
NULL_RTX, NULL_RTX, NULL_RTX); NULL_RTX, NULL_RTX, NULL_RTX);
...@@ -12848,9 +12848,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, ...@@ -12848,9 +12848,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
} }
if (place2) if (place2)
REG_NOTES (place2) add_reg_note (place2, REG_NOTE_KIND (note), XEXP (note, 0));
= gen_rtx_fmt_ee (GET_CODE (note), REG_NOTE_KIND (note),
XEXP (note, 0), REG_NOTES (place2));
} }
} }
...@@ -13046,4 +13044,3 @@ struct rtl_opt_pass pass_combine = ...@@ -13046,4 +13044,3 @@ struct rtl_opt_pass pass_combine =
TODO_ggc_collect, /* todo_flags_finish */ TODO_ggc_collect, /* todo_flags_finish */
} }
}; };
/* Instruction scheduling pass. /* Instruction scheduling pass.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by, Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com) and currently maintained by, Jim Wilson (wilson@cygnus.com)
...@@ -3906,12 +3906,10 @@ sched_create_recovery_edges (basic_block first_bb, basic_block rec, ...@@ -3906,12 +3906,10 @@ sched_create_recovery_edges (basic_block first_bb, basic_block rec,
/* Rewritten from cfgrtl.c. */ /* Rewritten from cfgrtl.c. */
if (flag_reorder_blocks_and_partition if (flag_reorder_blocks_and_partition
&& targetm.have_named_sections) && targetm.have_named_sections)
{
/* We don't need the same note for the check because /* We don't need the same note for the check because
any_condjump_p (check) == true. */ any_condjump_p (check) == true. */
{ add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
REG_NOTES (jump) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
NULL_RTX,
REG_NOTES (jump));
} }
edge_flags = EDGE_CROSSING; edge_flags = EDGE_CROSSING;
} }
......
...@@ -2686,7 +2686,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn, ...@@ -2686,7 +2686,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true) ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true)
: NULL_RTX); : NULL_RTX);
x = gen_rtx_EXPR_LIST (REG_NOTE_KIND (x), new_rtx, XEXP (x, 1)); x = alloc_reg_note (REG_NOTE_KIND (x), new_rtx, XEXP (x, 1));
} }
} }
......
...@@ -1759,6 +1759,7 @@ extern rtx find_reg_equal_equiv_note (const_rtx); ...@@ -1759,6 +1759,7 @@ extern rtx find_reg_equal_equiv_note (const_rtx);
extern rtx find_constant_src (const_rtx); extern rtx find_constant_src (const_rtx);
extern int find_reg_fusage (const_rtx, enum rtx_code, 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 int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
extern void add_reg_note (rtx, enum reg_note, rtx); extern void add_reg_note (rtx, enum reg_note, rtx);
extern void remove_note (rtx, const_rtx); extern void remove_note (rtx, const_rtx);
extern void remove_reg_equal_equiv_notes (rtx); extern void remove_reg_equal_equiv_notes (rtx);
......
...@@ -1865,10 +1865,11 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno) ...@@ -1865,10 +1865,11 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno)
} }
/* Add register note with kind KIND and datum DATUM to INSN. */ /* Allocate a register note with kind KIND and datum DATUM. LIST is
stored as the pointer to the next register note. */
void rtx
add_reg_note (rtx insn, enum reg_note kind, rtx datum) alloc_reg_note (enum reg_note kind, rtx datum, rtx list)
{ {
rtx note; rtx note;
...@@ -1881,16 +1882,24 @@ add_reg_note (rtx insn, enum reg_note kind, rtx datum) ...@@ -1881,16 +1882,24 @@ add_reg_note (rtx insn, enum reg_note kind, rtx datum)
/* These types of register notes use an INSN_LIST rather than an /* These types of register notes use an INSN_LIST rather than an
EXPR_LIST, so that copying is done right and dumps look EXPR_LIST, so that copying is done right and dumps look
better. */ better. */
note = alloc_INSN_LIST (datum, REG_NOTES (insn)); note = alloc_INSN_LIST (datum, list);
PUT_REG_NOTE_KIND (note, kind); PUT_REG_NOTE_KIND (note, kind);
break; break;
default: default:
note = alloc_EXPR_LIST (kind, datum, REG_NOTES (insn)); note = alloc_EXPR_LIST (kind, datum, list);
break; break;
} }
REG_NOTES (insn) = note; return note;
}
/* Add register note with kind KIND and datum DATUM to INSN. */
void
add_reg_note (rtx insn, enum reg_note kind, rtx datum)
{
REG_NOTES (insn) = alloc_reg_note (kind, datum, REG_NOTES (insn));
} }
/* Remove register note NOTE from the REG_NOTES of INSN. */ /* Remove register note NOTE from the REG_NOTES of INSN. */
...@@ -5025,4 +5034,3 @@ constant_pool_constant_p (rtx x) ...@@ -5025,4 +5034,3 @@ constant_pool_constant_p (rtx x)
x = avoid_constant_pool_reference (x); x = avoid_constant_pool_reference (x);
return GET_CODE (x) == CONST_DOUBLE; return GET_CODE (x) == CONST_DOUBLE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment