diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-14 19:30:59 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-14 19:30:59 +0000 |
commit | 0841d2957f82d21f5a460cde89ab25398a5bb508 (patch) | |
tree | 3654fdb428a81ff03c682364de4dd6c378669f51 /gcc | |
parent | d022e236dcd5fbd1005cedfcdd47e23ac8609238 (diff) | |
download | gcc-0841d2957f82d21f5a460cde89ab25398a5bb508.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192440 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/df-problems.c | 36 | ||||
-rw-r--r-- | gcc/df.h | 40 | ||||
-rw-r--r-- | gcc/ira-build.c | 6 | ||||
-rw-r--r-- | gcc/ira-color.c | 8 | ||||
-rw-r--r-- | gcc/ira-emit.c | 14 | ||||
-rw-r--r-- | gcc/ira-lives.c | 2 | ||||
-rw-r--r-- | gcc/ira.c | 37 |
8 files changed, 92 insertions, 70 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d043064bdc6..2f72c5300d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,24 @@ 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> + PR rtl-optimization/54919 * loop-unroll.c (struct var_to_expand): Remove accum_pos field. (analyze_insn_to_expand_var): Do not record accum_pos. diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 53e77388f02..b4df2ba2a14 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -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_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. ----------------------------------------------------------------------------*/ @@ -951,8 +951,6 @@ extern void debug_df_chain (struct df_link *); extern struct df_link *df_chain_create (df_ref, df_ref); extern void df_chain_unlink (df_ref); 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_chain_dump (struct df_link *, 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 void df_scan_verify (void); -/* Get basic block info. */ + +/*---------------------------------------------------------------------------- + Public functions access functions for the dataflow problems. +----------------------------------------------------------------------------*/ static inline struct df_scan_bb_info * df_scan_get_bb_info (unsigned int index) @@ -1079,6 +1080,39 @@ df_word_lr_get_bb_info (unsigned int index) 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. */ static inline df_ref * diff --git a/gcc/ira-build.c b/gcc/ira-build.c index cc4ff34f707..986bb5e5f62 100644 --- a/gcc/ira-build.c +++ b/gcc/ira-build.c @@ -1715,7 +1715,7 @@ create_bb_allocnos (ira_loop_tree_node_t bb_node) create_insn_allocnos (PATTERN (insn), false); /* It might be a allocno living through from one subloop to 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) ira_create_allocno (i, false, ira_curr_loop_tree_node); } @@ -1731,9 +1731,9 @@ create_loop_allocnos (edge e) bitmap_iterator bi; 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; - 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) if (bitmap_bit_p (live_in_regs, i)) { diff --git a/gcc/ira-color.c b/gcc/ira-color.c index fc2e4e8b29b..bcf03216af8 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -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) if (e->src != loop_node->loop->latch && (regno < 0 - || (bitmap_bit_p (DF_LR_OUT (e->src), regno) - && bitmap_bit_p (DF_LR_IN (e->dest), regno)))) + || (bitmap_bit_p (df_get_live_out (e->src), regno) + && bitmap_bit_p (df_get_live_in (e->dest), regno)))) freq += EDGE_FREQUENCY (e); } 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); FOR_EACH_VEC_ELT (edge, edges, i, e) if (regno < 0 - || (bitmap_bit_p (DF_LR_OUT (e->src), regno) - && bitmap_bit_p (DF_LR_IN (e->dest), regno))) + || (bitmap_bit_p (df_get_live_out (e->src), regno) + && bitmap_bit_p (df_get_live_in (e->dest), regno))) freq += EDGE_FREQUENCY (e); VEC_free (edge, heap, edges); } diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c index dbab5374173..b0d9a825124 100644 --- a/gcc/ira-emit.c +++ b/gcc/ira-emit.c @@ -495,6 +495,7 @@ generate_edge_moves (edge e) bitmap_iterator bi; ira_allocno_t src_allocno, dest_allocno, *src_map, *dest_map; move_t move; + bitmap regs_live_in_dest, regs_live_out_src; src_loop_node = IRA_BB_NODE (e->src)->parent; dest_loop_node = IRA_BB_NODE (e->dest)->parent; @@ -503,9 +504,11 @@ generate_edge_moves (edge e) return; src_map = src_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) - if (bitmap_bit_p (DF_LR_OUT (e->src), regno)) + if (bitmap_bit_p (regs_live_out_src, regno)) { src_allocno = src_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 regnos because of subsequent IR flattening. */ 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 (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 (at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb)); 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 ((move_t) e->aux, node, live_through, REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e))); diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index 109e3c4c9f3..940cd681f2a 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -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; } 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); REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out); AND_COMPL_HARD_REG_SET (hard_regs_live, eliminable_regset); diff --git a/gcc/ira.c b/gcc/ira.c index 9a93297b0d4..a79a0dcdff3 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2337,16 +2337,23 @@ void mark_elimination (int from, int to) { basic_block bb; + bitmap r; FOR_EACH_BB (bb) { - /* We don't use LIVE info in IRA. */ - bitmap r = DF_LR_IN (bb); - - if (REGNO_REG_SET_P (r, from)) + r = DF_LR_IN (bb); + if (bitmap_bit_p (r, from)) + { + bitmap_clear_bit (r, from); + bitmap_set_bit (r, to); + } + if (! df_live) + continue; + r = DF_LIVE_IN (bb); + if (bitmap_bit_p (r, from)) { - CLEAR_REGNO_REG_SET (r, from); - SET_REGNO_REG_SET (r, to); + bitmap_clear_bit (r, from); + bitmap_set_bit (r, to); } } } @@ -3194,10 +3201,12 @@ update_equiv_regs (void) { 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_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. */ @@ -3319,14 +3328,14 @@ build_insn_chain (void) CLEAR_REG_SET (live_relevant_regs); 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) break; 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) { if (pseudo_for_reload_consideration_p (i)) @@ -4157,12 +4166,6 @@ ira (FILE *f) setup_prohibited_mode_move_regs (); df_note_add_problem (); - - if (optimize == 1) - { - df_live_add_problem (); - df_live_set_all_dirty (); - } #ifdef ENABLE_CHECKING df->changeable_flags |= DF_VERIFY_SCHEDULED; #endif @@ -4397,8 +4400,6 @@ do_reload (void) df_rescan_all_insns is not going to help here because it does not touch the artificial uses and defs. */ df_finish_pass (true); - if (optimize > 1) - df_live_add_problem (); df_scan_alloc (NULL); df_scan_blocks (); |