Commit 8160cd3e by Vladimir Makarov Committed by Vladimir Makarov

re PR rtl-optimization/63620 (RELOAD lost SET_GOT dependency on Darwin)

2014-11-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/63620
	* lra-constraints.c (substitute_pseudo): Add prefix lra_ to the
	name.  Move to lra.c.  Make it external.
	(substitute_pseudo_within_insn): Ditto.
	(inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use
	the new names.
	(undo_optional_reloads): Ditto.
	* lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo):
	New prototypes.
	(lra_substitute_pseudo_within_insn): Ditto.
	* lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New.
	(mark_regno_live): Add parameter.  Update bb_gen_pseudos.
	(mark_regno_dead): Add parameter.  Update bb_gen_pseudos and
	bb_killed_pseudos.
	(struct bb_data, bb_data_t, bb_data): New.
	(get_bb_data, get_bb_data_by_index): Ditto.
	(all_hard_regs_bitmap): New.
	(live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New.
	(initiate_live_solver, finish_live_solver): New.
	(process_bb_lives): Change return type.  Add code updating local
	live data and removing dead insns.  Pass new argument to
	mark_regno_live and mark_regno_dead.  Check changing bb pseudo
	life info.  Return the result.
	(lra_create_live_ranges): Add code to do global pseudo live
	analysis.
	(lra_live_ranges_init): Call initiate_live_solver.
	(lra_live_ranges_finish): Call finish_live_solver.
	* lra.c (lra_dump_bitmap_with_title): New.
	(lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move
	from lra-constraints.c.

From-SVN: r217265
parent 205e9268
2014-11-09 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/63620
* lra-constraints.c (substitute_pseudo): Add prefix lra_ to the
name. Move to lra.c. Make it external.
(substitute_pseudo_within_insn): Ditto.
(inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use
the new names.
(undo_optional_reloads): Ditto.
* lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo):
New prototypes.
(lra_substitute_pseudo_within_insn): Ditto.
* lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New.
(mark_regno_live): Add parameter. Update bb_gen_pseudos.
(mark_regno_dead): Add parameter. Update bb_gen_pseudos and
bb_killed_pseudos.
(struct bb_data, bb_data_t, bb_data): New.
(get_bb_data, get_bb_data_by_index): Ditto.
(all_hard_regs_bitmap): New.
(live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New.
(initiate_live_solver, finish_live_solver): New.
(process_bb_lives): Change return type. Add code updating local
live data and removing dead insns. Pass new argument to
mark_regno_live and mark_regno_dead. Check changing bb pseudo
life info. Return the result.
(lra_create_live_ranges): Add code to do global pseudo live
analysis.
(lra_live_ranges_init): Call initiate_live_solver.
(lra_live_ranges_finish): Call finish_live_solver.
* lra.c (lra_dump_bitmap_with_title): New.
(lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move
from lra-constraints.c.
2014-11-09 Richard Biener <rguenther@suse.de>
* match.pd: Add patterns convering two conversions in a row
......@@ -4366,67 +4366,6 @@ add_next_usage_insn (int regno, rtx insn, int reloads_num)
usage_insns[regno].check = 0;
}
/* Replace all references to register OLD_REGNO in *LOC with pseudo
register NEW_REG. Return true if any change was made. */
static bool
substitute_pseudo (rtx *loc, int old_regno, rtx new_reg)
{
rtx x = *loc;
bool result = false;
enum rtx_code code;
const char *fmt;
int i, j;
if (x == NULL_RTX)
return false;
code = GET_CODE (x);
if (code == REG && (int) REGNO (x) == old_regno)
{
machine_mode mode = GET_MODE (*loc);
machine_mode inner_mode = GET_MODE (new_reg);
if (mode != inner_mode)
{
if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (inner_mode)
|| ! SCALAR_INT_MODE_P (inner_mode))
new_reg = gen_rtx_SUBREG (mode, new_reg, 0);
else
new_reg = gen_lowpart_SUBREG (mode, new_reg);
}
*loc = new_reg;
return true;
}
/* Scan all the operand sub-expressions. */
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
{
if (substitute_pseudo (&XEXP (x, i), old_regno, new_reg))
result = true;
}
else if (fmt[i] == 'E')
{
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
if (substitute_pseudo (&XVECEXP (x, i, j), old_regno, new_reg))
result = true;
}
}
return result;
}
/* Call substitute_pseudo within an insn. This won't update the insn ptr,
just the contents of the insn. */
static bool
substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg)
{
rtx loc = insn;
return substitute_pseudo (&loc, old_regno, new_reg);
}
/* Return first non-debug insn in list USAGE_INSNS. */
static rtx_insn *
skip_usage_debug_insns (rtx usage_insns)
......@@ -4588,7 +4527,7 @@ inherit_reload_reg (bool def_p, int original_regno,
}
return false;
}
substitute_pseudo_within_insn (insn, original_regno, new_reg);
lra_substitute_pseudo_within_insn (insn, original_regno, new_reg);
lra_update_insn_regno_info (insn);
if (! def_p)
/* We now have a new usage insn for original regno. */
......@@ -4620,7 +4559,7 @@ inherit_reload_reg (bool def_p, int original_regno,
lra_assert (DEBUG_INSN_P (usage_insn));
next_usage_insns = XEXP (next_usage_insns, 1);
}
substitute_pseudo (&usage_insn, original_regno, new_reg);
lra_substitute_pseudo (&usage_insn, original_regno, new_reg);
lra_update_insn_regno_info (as_a <rtx_insn *> (usage_insn));
if (lra_dump_file != NULL)
{
......@@ -4884,7 +4823,7 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
usage_insn = XEXP (next_usage_insns, 0);
lra_assert (DEBUG_INSN_P (usage_insn));
next_usage_insns = XEXP (next_usage_insns, 1);
substitute_pseudo (&usage_insn, original_regno, new_reg);
lra_substitute_pseudo (&usage_insn, original_regno, new_reg);
lra_update_insn_regno_info (as_a <rtx_insn *> (usage_insn));
if (lra_dump_file != NULL)
{
......@@ -5803,7 +5742,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
{
if (change_p && bitmap_bit_p (remove_pseudos, regno))
{
substitute_pseudo_within_insn (
lra_substitute_pseudo_within_insn (
curr_insn, regno, regno_reg_rtx[restore_regno]);
restored_regs_p = true;
}
......@@ -5927,7 +5866,7 @@ undo_optional_reloads (void)
we remove the inheritance pseudo and the optional
reload. */
}
substitute_pseudo_within_insn (
lra_substitute_pseudo_within_insn (
insn, regno,
regno_reg_rtx[lra_reg_info[regno].restore_regno]);
lra_update_insn_regno_info (insn);
......
......@@ -284,6 +284,7 @@ extern lra_insn_recog_data_t *lra_insn_recog_data;
extern int lra_curr_reload_num;
extern void lra_dump_bitmap_with_title (const char *, bitmap, int);
extern void lra_push_insn (rtx_insn *);
extern void lra_push_insn_by_uid (unsigned int);
extern void lra_push_insn_and_update_insn_regno_info (rtx_insn *);
......@@ -303,6 +304,9 @@ extern void lra_update_dups (lra_insn_recog_data_t, signed char *);
extern void lra_process_new_insns (rtx_insn *, rtx_insn *, rtx_insn *,
const char *);
extern bool lra_substitute_pseudo (rtx *, int, rtx);
extern bool lra_substitute_pseudo_within_insn (rtx_insn *, int, rtx);
extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx_insn *);
extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx_insn *);
extern void lra_set_used_insn_alternative (rtx_insn *, int);
......
......@@ -129,6 +129,33 @@ along with GCC; see the file COPYING3. If not see
#include "lra-int.h"
#include "df.h"
/* Dump bitmap SET with TITLE and BB INDEX. */
void
lra_dump_bitmap_with_title (const char *title, bitmap set, int index)
{
unsigned int i;
int count;
bitmap_iterator bi;
static const int max_nums_on_line = 10;
if (bitmap_empty_p (set))
return;
fprintf (lra_dump_file, " %s %d:", title, index);
fprintf (lra_dump_file, "\n");
count = max_nums_on_line + 1;
EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
{
if (count > max_nums_on_line)
{
fprintf (lra_dump_file, "\n ");
count = 0;
}
fprintf (lra_dump_file, " %4u", i);
count++;
}
fprintf (lra_dump_file, "\n");
}
/* Hard registers currently not available for allocation. It can
changed after some hard registers become not eliminable. */
HARD_REG_SET lra_no_alloc_regs;
......@@ -1753,6 +1780,68 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after,
/* Replace all references to register OLD_REGNO in *LOC with pseudo
register NEW_REG. Return true if any change was made. */
bool
lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg)
{
rtx x = *loc;
bool result = false;
enum rtx_code code;
const char *fmt;
int i, j;
if (x == NULL_RTX)
return false;
code = GET_CODE (x);
if (code == REG && (int) REGNO (x) == old_regno)
{
machine_mode mode = GET_MODE (*loc);
machine_mode inner_mode = GET_MODE (new_reg);
if (mode != inner_mode)
{
if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (inner_mode)
|| ! SCALAR_INT_MODE_P (inner_mode))
new_reg = gen_rtx_SUBREG (mode, new_reg, 0);
else
new_reg = gen_lowpart_SUBREG (mode, new_reg);
}
*loc = new_reg;
return true;
}
/* Scan all the operand sub-expressions. */
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e')
{
if (lra_substitute_pseudo (&XEXP (x, i), old_regno, new_reg))
result = true;
}
else if (fmt[i] == 'E')
{
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
if (lra_substitute_pseudo (&XVECEXP (x, i, j), old_regno, new_reg))
result = true;
}
}
return result;
}
/* Call lra_substitute_pseudo within an insn. This won't update the insn ptr,
just the contents of the insn. */
bool
lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg)
{
rtx loc = insn;
return lra_substitute_pseudo (&loc, old_regno, new_reg);
}
/* This page contains code dealing with scratches (changing them onto
pseudos and restoring them from the pseudos).
......
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