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
This commit is contained in:
Ian Lance Taylor 2009-04-16 16:08:04 +00:00 committed by Ian Lance Taylor
parent 6080348f0a
commit efc0b2bd80
7 changed files with 50 additions and 36 deletions

View File

@ -1,3 +1,16 @@
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>
PR rtl-optimization/39762

View File

@ -1,6 +1,6 @@
/* Combine stack adjustments.
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.
This file is part of GCC.
@ -333,9 +333,7 @@ adjust_frame_related_expr (rtx last_sp_set, rtx insn,
if (note)
XEXP (note, 0) = new_expr;
else
REG_NOTES (last_sp_set)
= gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, new_expr,
REG_NOTES (last_sp_set));
add_reg_note (last_sp_set, REG_FRAME_RELATED_EXPR, new_expr);
}
/* Subroutine of combine_stack_adjustments, called for each basic block. */
@ -561,4 +559,3 @@ struct rtl_opt_pass pass_stack_adjustments =
TODO_ggc_collect, /* todo_flags_finish */
}
};

View File

@ -3643,12 +3643,12 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i3dest_killed)
{
if (newi2pat && reg_set_p (i3dest_killed, newi2pat))
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed,
NULL_RTX),
distribute_notes (alloc_reg_note (REG_DEAD, i3dest_killed,
NULL_RTX),
NULL_RTX, i2, NULL_RTX, elim_i2, elim_i1);
else
distribute_notes (gen_rtx_EXPR_LIST (REG_DEAD, i3dest_killed,
NULL_RTX),
distribute_notes (alloc_reg_note (REG_DEAD, i3dest_killed,
NULL_RTX),
NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
elim_i2, elim_i1);
}
@ -3656,10 +3656,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i2dest_in_i2src)
{
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);
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, NULL_RTX);
}
@ -3667,10 +3667,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (i1dest_in_i1src)
{
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);
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, NULL_RTX);
}
@ -9863,8 +9863,8 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes)
if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH)
{
gcc_assert (REG_P (XEXP (XVECEXP (newpat, 0, i), 0)));
notes = gen_rtx_EXPR_LIST (REG_UNUSED,
XEXP (XVECEXP (newpat, 0, i), 0), notes);
notes = alloc_reg_note (REG_UNUSED,
XEXP (XVECEXP (newpat, 0, i), 0), notes);
}
}
pat = newpat;
@ -12231,7 +12231,7 @@ move_deaths (rtx x, rtx maybe_kill_insn, int from_luid, rtx to_insn,
*pnotes = note;
}
else
*pnotes = gen_rtx_EXPR_LIST (REG_DEAD, x, *pnotes);
*pnotes = alloc_reg_note (REG_DEAD, x, *pnotes);
}
return;
@ -12800,8 +12800,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
&& ! reg_bitfield_target_p (piece,
PATTERN (place)))
{
rtx new_note
= gen_rtx_EXPR_LIST (REG_DEAD, piece, NULL_RTX);
rtx new_note = alloc_reg_note (REG_DEAD, piece,
NULL_RTX);
distribute_notes (new_note, place, place,
NULL_RTX, NULL_RTX, NULL_RTX);
@ -12848,9 +12848,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
}
if (place2)
REG_NOTES (place2)
= gen_rtx_fmt_ee (GET_CODE (note), REG_NOTE_KIND (note),
XEXP (note, 0), REG_NOTES (place2));
add_reg_note (place2, REG_NOTE_KIND (note), XEXP (note, 0));
}
}
@ -13046,4 +13044,3 @@ struct rtl_opt_pass pass_combine =
TODO_ggc_collect, /* todo_flags_finish */
}
};

View File

@ -1,6 +1,6 @@
/* Instruction scheduling pass.
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.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com)
@ -3906,12 +3906,10 @@ sched_create_recovery_edges (basic_block first_bb, basic_block rec,
/* Rewritten from cfgrtl.c. */
if (flag_reorder_blocks_and_partition
&& targetm.have_named_sections)
/* 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));
/* We don't need the same note for the check because
any_condjump_p (check) == true. */
add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
}
edge_flags = EDGE_CROSSING;
}

View File

@ -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)
: 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));
}
}

View File

@ -1759,6 +1759,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 rtx alloc_reg_note (enum reg_note, rtx, rtx);
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);

View File

@ -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
add_reg_note (rtx insn, enum reg_note kind, rtx datum)
rtx
alloc_reg_note (enum reg_note kind, rtx datum, rtx list)
{
rtx note;
@ -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
EXPR_LIST, so that copying is done right and dumps look
better. */
note = alloc_INSN_LIST (datum, REG_NOTES (insn));
note = alloc_INSN_LIST (datum, list);
PUT_REG_NOTE_KIND (note, kind);
break;
default:
note = alloc_EXPR_LIST (kind, datum, REG_NOTES (insn));
note = alloc_EXPR_LIST (kind, datum, list);
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. */
@ -5025,4 +5034,3 @@ constant_pool_constant_p (rtx x)
x = avoid_constant_pool_reference (x);
return GET_CODE (x) == CONST_DOUBLE;
}