mirror of git://gcc.gnu.org/git/gcc.git
re PR rtl-optimization/38711 (ira should not be using df-lr except at -O1.)
PR rtl-optimization/38711 * df.h (df_get_live_out, df_get_live_in): Make static inline functions. * df-problems.c (df_get_live_out, df_get_live_in): Moved to df.h. * ira-lives.c (process_bb_node_lives): Use df_get_live_out instead of DF_LR_OUT. * ira-build.c (create_bb_allocnos): Likewise. (create_loop_allocnos): Likewise, and use df_get_live_in instead of DF_LR_IN. * ira-emit.c (generate_edge_moves): Likewise. (add_ranges_and_copies): Likewise. * ira-color.c (ira_loop_edge_freq): Use df_get_live_out instead of DF_LR_OUT, and df_get_live_in instead of DF_LR_IN. * ira.c (mark_elimination): Update DF_LR and DF_LIVE. (build_insn_chain): Use df_get_live_out instead of DF_LR_OUT. (do_reload): Remove the DF_LIVE problem for -O1. From-SVN: r192440
This commit is contained in:
parent
6e74642b2c
commit
bf744527f1
|
|
@ -1,3 +1,22 @@
|
||||||
|
2012-10-14 Steven Bosscher <steven@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR rtl-optimization/38711
|
||||||
|
* df.h (df_get_live_out, df_get_live_in): Make static inline functions.
|
||||||
|
* df-problems.c (df_get_live_out, df_get_live_in): Moved to df.h.
|
||||||
|
* ira-lives.c (process_bb_node_lives): Use df_get_live_out instead of
|
||||||
|
DF_LR_OUT.
|
||||||
|
* ira-build.c (create_bb_allocnos): Likewise.
|
||||||
|
(create_loop_allocnos): Likewise, and use df_get_live_in instead of
|
||||||
|
DF_LR_IN.
|
||||||
|
* ira-emit.c (generate_edge_moves): Likewise.
|
||||||
|
(add_ranges_and_copies): Likewise.
|
||||||
|
* ira-color.c (ira_loop_edge_freq): Use df_get_live_out instead of
|
||||||
|
DF_LR_OUT, and df_get_live_in instead of DF_LR_IN.
|
||||||
|
* ira.c (mark_elimination): Update DF_LR and DF_LIVE.
|
||||||
|
(build_insn_chain): Use df_get_live_out instead of DF_LR_OUT.
|
||||||
|
(do_reload): Remove the DF_LIVE problem for -O1.
|
||||||
|
|
||||||
|
|
||||||
2012-10-14 Steven Bosscher <steven@gcc.gnu.org>
|
2012-10-14 Steven Bosscher <steven@gcc.gnu.org>
|
||||||
|
|
||||||
PR rtl-optimization/54919
|
PR rtl-optimization/54919
|
||||||
|
|
|
||||||
|
|
@ -57,42 +57,6 @@ along with GCC; see the file COPYING3. If not see
|
||||||
static bitmap_head seen_in_block;
|
static bitmap_head seen_in_block;
|
||||||
static bitmap_head seen_in_insn;
|
static bitmap_head seen_in_insn;
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
Public functions access functions for the dataflow problems.
|
|
||||||
----------------------------------------------------------------------------*/
|
|
||||||
/* Get the live at out set for BB no matter what problem happens to be
|
|
||||||
defined. This function is used by the register allocators who
|
|
||||||
choose different dataflow problems depending on the optimization
|
|
||||||
level. */
|
|
||||||
|
|
||||||
bitmap
|
|
||||||
df_get_live_out (basic_block bb)
|
|
||||||
{
|
|
||||||
gcc_assert (df_lr);
|
|
||||||
|
|
||||||
if (df_live)
|
|
||||||
return DF_LIVE_OUT (bb);
|
|
||||||
else
|
|
||||||
return DF_LR_OUT (bb);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the live at in set for BB no matter what problem happens to be
|
|
||||||
defined. This function is used by the register allocators who
|
|
||||||
choose different dataflow problems depending on the optimization
|
|
||||||
level. */
|
|
||||||
|
|
||||||
bitmap
|
|
||||||
df_get_live_in (basic_block bb)
|
|
||||||
{
|
|
||||||
gcc_assert (df_lr);
|
|
||||||
|
|
||||||
if (df_live)
|
|
||||||
return DF_LIVE_IN (bb);
|
|
||||||
else
|
|
||||||
return DF_LR_IN (bb);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Utility functions.
|
Utility functions.
|
||||||
----------------------------------------------------------------------------*/
|
----------------------------------------------------------------------------*/
|
||||||
|
|
|
||||||
40
gcc/df.h
40
gcc/df.h
|
|
@ -951,8 +951,6 @@ extern void debug_df_chain (struct df_link *);
|
||||||
extern struct df_link *df_chain_create (df_ref, df_ref);
|
extern struct df_link *df_chain_create (df_ref, df_ref);
|
||||||
extern void df_chain_unlink (df_ref);
|
extern void df_chain_unlink (df_ref);
|
||||||
extern void df_chain_copy (df_ref, struct df_link *);
|
extern void df_chain_copy (df_ref, struct df_link *);
|
||||||
extern bitmap df_get_live_in (basic_block);
|
|
||||||
extern bitmap df_get_live_out (basic_block);
|
|
||||||
extern void df_grow_bb_info (struct dataflow *);
|
extern void df_grow_bb_info (struct dataflow *);
|
||||||
extern void df_chain_dump (struct df_link *, FILE *);
|
extern void df_chain_dump (struct df_link *, FILE *);
|
||||||
extern void df_print_bb_index (basic_block bb, FILE *file);
|
extern void df_print_bb_index (basic_block bb, FILE *file);
|
||||||
|
|
@ -1023,7 +1021,10 @@ extern void df_compute_regs_ever_live (bool);
|
||||||
extern bool df_read_modify_subreg_p (rtx);
|
extern bool df_read_modify_subreg_p (rtx);
|
||||||
extern void df_scan_verify (void);
|
extern void df_scan_verify (void);
|
||||||
|
|
||||||
/* Get basic block info. */
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Public functions access functions for the dataflow problems.
|
||||||
|
----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static inline struct df_scan_bb_info *
|
static inline struct df_scan_bb_info *
|
||||||
df_scan_get_bb_info (unsigned int index)
|
df_scan_get_bb_info (unsigned int index)
|
||||||
|
|
@ -1079,6 +1080,39 @@ df_word_lr_get_bb_info (unsigned int index)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the live at out set for BB no matter what problem happens to be
|
||||||
|
defined. This function is used by the register allocators who
|
||||||
|
choose different dataflow problems depending on the optimization
|
||||||
|
level. */
|
||||||
|
|
||||||
|
static inline bitmap
|
||||||
|
df_get_live_out (basic_block bb)
|
||||||
|
{
|
||||||
|
gcc_checking_assert (df_lr);
|
||||||
|
|
||||||
|
if (df_live)
|
||||||
|
return DF_LIVE_OUT (bb);
|
||||||
|
else
|
||||||
|
return DF_LR_OUT (bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the live at in set for BB no matter what problem happens to be
|
||||||
|
defined. This function is used by the register allocators who
|
||||||
|
choose different dataflow problems depending on the optimization
|
||||||
|
level. */
|
||||||
|
|
||||||
|
static inline bitmap
|
||||||
|
df_get_live_in (basic_block bb)
|
||||||
|
{
|
||||||
|
gcc_checking_assert (df_lr);
|
||||||
|
|
||||||
|
if (df_live)
|
||||||
|
return DF_LIVE_IN (bb);
|
||||||
|
else
|
||||||
|
return DF_LR_IN (bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get basic block info. */
|
||||||
/* Get the artificial defs for a basic block. */
|
/* Get the artificial defs for a basic block. */
|
||||||
|
|
||||||
static inline df_ref *
|
static inline df_ref *
|
||||||
|
|
|
||||||
|
|
@ -1715,7 +1715,7 @@ create_bb_allocnos (ira_loop_tree_node_t bb_node)
|
||||||
create_insn_allocnos (PATTERN (insn), false);
|
create_insn_allocnos (PATTERN (insn), false);
|
||||||
/* It might be a allocno living through from one subloop to
|
/* It might be a allocno living through from one subloop to
|
||||||
another. */
|
another. */
|
||||||
EXECUTE_IF_SET_IN_REG_SET (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, i, bi)
|
EXECUTE_IF_SET_IN_REG_SET (df_get_live_in (bb), FIRST_PSEUDO_REGISTER, i, bi)
|
||||||
if (ira_curr_regno_allocno_map[i] == NULL)
|
if (ira_curr_regno_allocno_map[i] == NULL)
|
||||||
ira_create_allocno (i, false, ira_curr_loop_tree_node);
|
ira_create_allocno (i, false, ira_curr_loop_tree_node);
|
||||||
}
|
}
|
||||||
|
|
@ -1731,9 +1731,9 @@ create_loop_allocnos (edge e)
|
||||||
bitmap_iterator bi;
|
bitmap_iterator bi;
|
||||||
ira_loop_tree_node_t parent;
|
ira_loop_tree_node_t parent;
|
||||||
|
|
||||||
live_in_regs = DF_LR_IN (e->dest);
|
live_in_regs = df_get_live_in (e->dest);
|
||||||
border_allocnos = ira_curr_loop_tree_node->border_allocnos;
|
border_allocnos = ira_curr_loop_tree_node->border_allocnos;
|
||||||
EXECUTE_IF_SET_IN_REG_SET (DF_LR_OUT (e->src),
|
EXECUTE_IF_SET_IN_REG_SET (df_get_live_out (e->src),
|
||||||
FIRST_PSEUDO_REGISTER, i, bi)
|
FIRST_PSEUDO_REGISTER, i, bi)
|
||||||
if (bitmap_bit_p (live_in_regs, i))
|
if (bitmap_bit_p (live_in_regs, i))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2014,8 +2014,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
|
||||||
FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds)
|
FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds)
|
||||||
if (e->src != loop_node->loop->latch
|
if (e->src != loop_node->loop->latch
|
||||||
&& (regno < 0
|
&& (regno < 0
|
||||||
|| (bitmap_bit_p (DF_LR_OUT (e->src), regno)
|
|| (bitmap_bit_p (df_get_live_out (e->src), regno)
|
||||||
&& bitmap_bit_p (DF_LR_IN (e->dest), regno))))
|
&& bitmap_bit_p (df_get_live_in (e->dest), regno))))
|
||||||
freq += EDGE_FREQUENCY (e);
|
freq += EDGE_FREQUENCY (e);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2023,8 +2023,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
|
||||||
edges = get_loop_exit_edges (loop_node->loop);
|
edges = get_loop_exit_edges (loop_node->loop);
|
||||||
FOR_EACH_VEC_ELT (edge, edges, i, e)
|
FOR_EACH_VEC_ELT (edge, edges, i, e)
|
||||||
if (regno < 0
|
if (regno < 0
|
||||||
|| (bitmap_bit_p (DF_LR_OUT (e->src), regno)
|
|| (bitmap_bit_p (df_get_live_out (e->src), regno)
|
||||||
&& bitmap_bit_p (DF_LR_IN (e->dest), regno)))
|
&& bitmap_bit_p (df_get_live_in (e->dest), regno)))
|
||||||
freq += EDGE_FREQUENCY (e);
|
freq += EDGE_FREQUENCY (e);
|
||||||
VEC_free (edge, heap, edges);
|
VEC_free (edge, heap, edges);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,7 @@ generate_edge_moves (edge e)
|
||||||
bitmap_iterator bi;
|
bitmap_iterator bi;
|
||||||
ira_allocno_t src_allocno, dest_allocno, *src_map, *dest_map;
|
ira_allocno_t src_allocno, dest_allocno, *src_map, *dest_map;
|
||||||
move_t move;
|
move_t move;
|
||||||
|
bitmap regs_live_in_dest, regs_live_out_src;
|
||||||
|
|
||||||
src_loop_node = IRA_BB_NODE (e->src)->parent;
|
src_loop_node = IRA_BB_NODE (e->src)->parent;
|
||||||
dest_loop_node = IRA_BB_NODE (e->dest)->parent;
|
dest_loop_node = IRA_BB_NODE (e->dest)->parent;
|
||||||
|
|
@ -503,9 +504,11 @@ generate_edge_moves (edge e)
|
||||||
return;
|
return;
|
||||||
src_map = src_loop_node->regno_allocno_map;
|
src_map = src_loop_node->regno_allocno_map;
|
||||||
dest_map = dest_loop_node->regno_allocno_map;
|
dest_map = dest_loop_node->regno_allocno_map;
|
||||||
EXECUTE_IF_SET_IN_REG_SET (DF_LR_IN (e->dest),
|
regs_live_in_dest = df_get_live_in (e->dest);
|
||||||
|
regs_live_out_src = df_get_live_out (e->src);
|
||||||
|
EXECUTE_IF_SET_IN_REG_SET (regs_live_in_dest,
|
||||||
FIRST_PSEUDO_REGISTER, regno, bi)
|
FIRST_PSEUDO_REGISTER, regno, bi)
|
||||||
if (bitmap_bit_p (DF_LR_OUT (e->src), regno))
|
if (bitmap_bit_p (regs_live_out_src, regno))
|
||||||
{
|
{
|
||||||
src_allocno = src_map[regno];
|
src_allocno = src_map[regno];
|
||||||
dest_allocno = dest_map[regno];
|
dest_allocno = dest_map[regno];
|
||||||
|
|
@ -1206,15 +1209,16 @@ add_ranges_and_copies (void)
|
||||||
destination block) to use for searching allocnos by their
|
destination block) to use for searching allocnos by their
|
||||||
regnos because of subsequent IR flattening. */
|
regnos because of subsequent IR flattening. */
|
||||||
node = IRA_BB_NODE (bb)->parent;
|
node = IRA_BB_NODE (bb)->parent;
|
||||||
bitmap_copy (live_through, DF_LR_IN (bb));
|
bitmap_copy (live_through, df_get_live_in (bb));
|
||||||
add_range_and_copies_from_move_list
|
add_range_and_copies_from_move_list
|
||||||
(at_bb_start[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
|
(at_bb_start[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
|
||||||
bitmap_copy (live_through, DF_LR_OUT (bb));
|
bitmap_copy (live_through, df_get_live_out (bb));
|
||||||
add_range_and_copies_from_move_list
|
add_range_and_copies_from_move_list
|
||||||
(at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
|
(at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
|
||||||
FOR_EACH_EDGE (e, ei, bb->succs)
|
FOR_EACH_EDGE (e, ei, bb->succs)
|
||||||
{
|
{
|
||||||
bitmap_and (live_through, DF_LR_IN (e->dest), DF_LR_OUT (bb));
|
bitmap_and (live_through,
|
||||||
|
df_get_live_in (e->dest), df_get_live_out (bb));
|
||||||
add_range_and_copies_from_move_list
|
add_range_and_copies_from_move_list
|
||||||
((move_t) e->aux, node, live_through,
|
((move_t) e->aux, node, live_through,
|
||||||
REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e)));
|
REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e)));
|
||||||
|
|
|
||||||
|
|
@ -1148,7 +1148,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
|
||||||
high_pressure_start_point[ira_pressure_classes[i]] = -1;
|
high_pressure_start_point[ira_pressure_classes[i]] = -1;
|
||||||
}
|
}
|
||||||
curr_bb_node = loop_tree_node;
|
curr_bb_node = loop_tree_node;
|
||||||
reg_live_out = DF_LR_OUT (bb);
|
reg_live_out = df_get_live_out (bb);
|
||||||
sparseset_clear (objects_live);
|
sparseset_clear (objects_live);
|
||||||
REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
|
REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
|
||||||
AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset);
|
AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset);
|
||||||
|
|
|
||||||
37
gcc/ira.c
37
gcc/ira.c
|
|
@ -2337,16 +2337,23 @@ void
|
||||||
mark_elimination (int from, int to)
|
mark_elimination (int from, int to)
|
||||||
{
|
{
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
|
bitmap r;
|
||||||
|
|
||||||
FOR_EACH_BB (bb)
|
FOR_EACH_BB (bb)
|
||||||
{
|
{
|
||||||
/* We don't use LIVE info in IRA. */
|
r = DF_LR_IN (bb);
|
||||||
bitmap r = DF_LR_IN (bb);
|
if (bitmap_bit_p (r, from))
|
||||||
|
|
||||||
if (REGNO_REG_SET_P (r, from))
|
|
||||||
{
|
{
|
||||||
CLEAR_REGNO_REG_SET (r, from);
|
bitmap_clear_bit (r, from);
|
||||||
SET_REGNO_REG_SET (r, to);
|
bitmap_set_bit (r, to);
|
||||||
|
}
|
||||||
|
if (! df_live)
|
||||||
|
continue;
|
||||||
|
r = DF_LIVE_IN (bb);
|
||||||
|
if (bitmap_bit_p (r, from))
|
||||||
|
{
|
||||||
|
bitmap_clear_bit (r, from);
|
||||||
|
bitmap_set_bit (r, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3194,10 +3201,12 @@ update_equiv_regs (void)
|
||||||
{
|
{
|
||||||
FOR_EACH_BB (bb)
|
FOR_EACH_BB (bb)
|
||||||
{
|
{
|
||||||
bitmap_and_compl_into (DF_LIVE_IN (bb), cleared_regs);
|
|
||||||
bitmap_and_compl_into (DF_LIVE_OUT (bb), cleared_regs);
|
|
||||||
bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs);
|
bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs);
|
||||||
bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs);
|
bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs);
|
||||||
|
if (! df_live)
|
||||||
|
continue;
|
||||||
|
bitmap_and_compl_into (DF_LIVE_IN (bb), cleared_regs);
|
||||||
|
bitmap_and_compl_into (DF_LIVE_OUT (bb), cleared_regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Last pass - adjust debug insns referencing cleared regs. */
|
/* Last pass - adjust debug insns referencing cleared regs. */
|
||||||
|
|
@ -3319,14 +3328,14 @@ build_insn_chain (void)
|
||||||
CLEAR_REG_SET (live_relevant_regs);
|
CLEAR_REG_SET (live_relevant_regs);
|
||||||
bitmap_clear (live_subregs_used);
|
bitmap_clear (live_subregs_used);
|
||||||
|
|
||||||
EXECUTE_IF_SET_IN_BITMAP (DF_LR_OUT (bb), 0, i, bi)
|
EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), 0, i, bi)
|
||||||
{
|
{
|
||||||
if (i >= FIRST_PSEUDO_REGISTER)
|
if (i >= FIRST_PSEUDO_REGISTER)
|
||||||
break;
|
break;
|
||||||
bitmap_set_bit (live_relevant_regs, i);
|
bitmap_set_bit (live_relevant_regs, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXECUTE_IF_SET_IN_BITMAP (DF_LR_OUT (bb),
|
EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb),
|
||||||
FIRST_PSEUDO_REGISTER, i, bi)
|
FIRST_PSEUDO_REGISTER, i, bi)
|
||||||
{
|
{
|
||||||
if (pseudo_for_reload_consideration_p (i))
|
if (pseudo_for_reload_consideration_p (i))
|
||||||
|
|
@ -4157,12 +4166,6 @@ ira (FILE *f)
|
||||||
setup_prohibited_mode_move_regs ();
|
setup_prohibited_mode_move_regs ();
|
||||||
|
|
||||||
df_note_add_problem ();
|
df_note_add_problem ();
|
||||||
|
|
||||||
if (optimize == 1)
|
|
||||||
{
|
|
||||||
df_live_add_problem ();
|
|
||||||
df_live_set_all_dirty ();
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_CHECKING
|
#ifdef ENABLE_CHECKING
|
||||||
df->changeable_flags |= DF_VERIFY_SCHEDULED;
|
df->changeable_flags |= DF_VERIFY_SCHEDULED;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -4397,8 +4400,6 @@ do_reload (void)
|
||||||
df_rescan_all_insns is not going to help here because it does not
|
df_rescan_all_insns is not going to help here because it does not
|
||||||
touch the artificial uses and defs. */
|
touch the artificial uses and defs. */
|
||||||
df_finish_pass (true);
|
df_finish_pass (true);
|
||||||
if (optimize > 1)
|
|
||||||
df_live_add_problem ();
|
|
||||||
df_scan_alloc (NULL);
|
df_scan_alloc (NULL);
|
||||||
df_scan_blocks ();
|
df_scan_blocks ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue