Commit 80f466c4 by Vladimir Makarov Committed by Vladimir Makarov

lra-constraints.c (process_alt_operand): Calculate scratch_p and use it.

2013-10-02  Vladimir Makarov  <vmakarov@redhat.com>

	* lra-constraints.c (process_alt_operand): Calculate scratch_p and
	use it.  Use smaller increase for scratch.  Don't increase reject
	for early clobber scratch.
	* lra-eliminations.c (eliminate_regs_in_insn): Remove all insns
	setting eliminated regs except setting fp from hfp.
	(lra_eliminate): Check lra_insn_recog_data on NULL.

From-SVN: r203147
parent 7cfbb5a2
2013-10-02 Vladimir Makarov <vmakarov@redhat.com>
* lra-constraints.c (process_alt_operand): Calculate scratch_p and
use it. Use smaller increase for scratch. Don't increase reject
for early clobber scratch.
* lra-eliminations.c (eliminate_regs_in_insn): Remove all insns
setting eliminated regs except setting fp from hfp.
(lra_eliminate): Check lra_insn_recog_data on NULL.
2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com> 2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/58587 PR target/58587
......
...@@ -1453,6 +1453,7 @@ process_alt_operands (int only_alternative) ...@@ -1453,6 +1453,7 @@ process_alt_operands (int only_alternative)
HARD_REG_SET this_alternative_set, this_costly_alternative_set; HARD_REG_SET this_alternative_set, this_costly_alternative_set;
bool this_alternative_match_win, this_alternative_win; bool this_alternative_match_win, this_alternative_win;
bool this_alternative_offmemok; bool this_alternative_offmemok;
bool scratch_p;
enum machine_mode mode; enum machine_mode mode;
opalt_num = nalt * n_operands + nop; opalt_num = nalt * n_operands + nop;
...@@ -1858,6 +1859,8 @@ process_alt_operands (int only_alternative) ...@@ -1858,6 +1859,8 @@ process_alt_operands (int only_alternative)
} }
while ((p += len), c); while ((p += len), c);
scratch_p = (operand_reg[nop] != NULL_RTX
&& lra_former_scratch_p (REGNO (operand_reg[nop])));
/* Record which operands fit this alternative. */ /* Record which operands fit this alternative. */
if (win) if (win)
{ {
...@@ -1878,14 +1881,17 @@ process_alt_operands (int only_alternative) ...@@ -1878,14 +1881,17 @@ process_alt_operands (int only_alternative)
} }
else else
{ {
/* Prefer won reg to spilled pseudo under other equal /* Prefer won reg to spilled pseudo under other
conditions. */ equal conditions for possibe inheritance. */
if (! scratch_p)
{
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
fprintf fprintf
(lra_dump_file, (lra_dump_file,
" %d Non pseudo reload: reject++\n", " %d Non pseudo reload: reject++\n",
nop); nop);
reject++; reject++;
}
if (in_class_p (operand_reg[nop], if (in_class_p (operand_reg[nop],
this_costly_alternative, NULL)) this_costly_alternative, NULL))
{ {
...@@ -1904,13 +1910,13 @@ process_alt_operands (int only_alternative) ...@@ -1904,13 +1910,13 @@ process_alt_operands (int only_alternative)
insns are generated for the scratches. So it insns are generated for the scratches. So it
might cost something but probably less than old might cost something but probably less than old
reload pass believes. */ reload pass believes. */
if (lra_former_scratch_p (REGNO (operand_reg[nop]))) if (scratch_p)
{ {
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
fprintf (lra_dump_file, fprintf (lra_dump_file,
" %d Scratch win: reject+=3\n", " %d Scratch win: reject+=2\n",
nop); nop);
reject += 3; reject += 2;
} }
} }
} }
...@@ -2124,7 +2130,7 @@ process_alt_operands (int only_alternative) ...@@ -2124,7 +2130,7 @@ process_alt_operands (int only_alternative)
} }
} }
if (early_clobber_p) if (early_clobber_p && ! scratch_p)
{ {
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
fprintf (lra_dump_file, fprintf (lra_dump_file,
......
...@@ -809,43 +809,47 @@ eliminate_regs_in_insn (rtx insn, bool replace_p) ...@@ -809,43 +809,47 @@ eliminate_regs_in_insn (rtx insn, bool replace_p)
if (old_set != 0 && REG_P (SET_DEST (old_set)) if (old_set != 0 && REG_P (SET_DEST (old_set))
&& (ep = get_elimination (SET_DEST (old_set))) != NULL) && (ep = get_elimination (SET_DEST (old_set))) != NULL)
{ {
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if (ep->from_rtx == SET_DEST (old_set) && ep->can_eliminate)
{
bool delete_p = replace_p; bool delete_p = replace_p;
#ifdef HARD_FRAME_POINTER_REGNUM #ifdef HARD_FRAME_POINTER_REGNUM
/* If this is setting the frame pointer register to the hardware
frame pointer register and this is an elimination that will
be done (tested above), this insn is really adjusting the
frame pointer downward to compensate for the adjustment done
before a nonlocal goto. */
if (ep->from == FRAME_POINTER_REGNUM if (ep->from == FRAME_POINTER_REGNUM
&& ep->to == HARD_FRAME_POINTER_REGNUM) && ep->to == HARD_FRAME_POINTER_REGNUM)
/* If this is setting the frame pointer register to the
hardware frame pointer register and this is an
elimination that will be done (tested above), this
insn is really adjusting the frame pointer downward
to compensate for the adjustment done before a
nonlocal goto. */
{ {
rtx src = SET_SRC (old_set); rtx src = SET_SRC (old_set);
rtx off = remove_reg_equal_offset_note (insn, ep->to_rtx); rtx off = remove_reg_equal_offset_note (insn, ep->to_rtx);
if (off != NULL_RTX
|| src == ep->to_rtx
|| (GET_CODE (src) == PLUS
&& XEXP (src, 0) == ep->to_rtx
&& CONST_INT_P (XEXP (src, 1))))
{
HOST_WIDE_INT offset;
if (replace_p) if (replace_p)
{ {
SET_DEST (old_set) = ep->to_rtx; SET_DEST (old_set) = ep->to_rtx;
lra_update_insn_recog_data (insn); lra_update_insn_recog_data (insn);
return; return;
} }
else if (off != NULL_RTX offset = (off != NULL_RTX ? INTVAL (off)
|| src == ep->to_rtx : src == ep->to_rtx ? 0 : INTVAL (XEXP (src, 1)));
|| (GET_CODE (src) == PLUS
&& XEXP (src, 1) == ep->to_rtx
&& CONST_INT_P (XEXP (src, 1))))
{
HOST_WIDE_INT offset = (off != NULL_RTX
? INTVAL (off)
: src == ep->to_rtx
? 0 : INTVAL (XEXP (src, 1)));
offset -= (ep->offset - ep->previous_offset); offset -= (ep->offset - ep->previous_offset);
src = plus_constant (Pmode, ep->to_rtx, offset); src = plus_constant (Pmode, ep->to_rtx, offset);
/* First see if this insn remains valid when we make /* First see if this insn remains valid when we
the change. If not, keep the INSN_CODE the same make the change. If not, keep the INSN_CODE
and let the constraint pass fit it up. */ the same and let the constraint pass fit it
up. */
validate_change (insn, &SET_SRC (old_set), src, 1); validate_change (insn, &SET_SRC (old_set), src, 1);
validate_change (insn, &SET_DEST (old_set), validate_change (insn, &SET_DEST (old_set),
ep->from_rtx, 1); ep->from_rtx, 1);
...@@ -859,11 +863,6 @@ eliminate_regs_in_insn (rtx insn, bool replace_p) ...@@ -859,11 +863,6 @@ eliminate_regs_in_insn (rtx insn, bool replace_p)
add_reg_note (insn, REG_EQUAL, src); add_reg_note (insn, REG_EQUAL, src);
return; return;
} }
/* We can't delete this insn, but needn't process it
since it won't be used unless something changes. */
delete_p = false;
} }
#endif #endif
...@@ -873,6 +872,7 @@ eliminate_regs_in_insn (rtx insn, bool replace_p) ...@@ -873,6 +872,7 @@ eliminate_regs_in_insn (rtx insn, bool replace_p)
lra_delete_dead_insn (insn); lra_delete_dead_insn (insn);
return; return;
} }
}
/* We allow one special case which happens to work on all machines we /* We allow one special case which happens to work on all machines we
currently support: a single set with the source or a REG_EQUAL currently support: a single set with the source or a REG_EQUAL
...@@ -1318,6 +1318,8 @@ lra_eliminate (bool final_p) ...@@ -1318,6 +1318,8 @@ lra_eliminate (bool final_p)
"Updating elimination of equiv for reg %d\n", i); "Updating elimination of equiv for reg %d\n", i);
} }
EXECUTE_IF_SET_IN_BITMAP (&insns_with_changed_offsets, 0, uid, bi) EXECUTE_IF_SET_IN_BITMAP (&insns_with_changed_offsets, 0, uid, bi)
/* A dead insn can be deleted in process_insn_for_elimination. */
if (lra_insn_recog_data[uid] != NULL)
process_insn_for_elimination (lra_insn_recog_data[uid]->insn, final_p); process_insn_for_elimination (lra_insn_recog_data[uid]->insn, final_p);
bitmap_clear (&insns_with_changed_offsets); bitmap_clear (&insns_with_changed_offsets);
......
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