diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2013-12-26 09:19:38 -0500 |
---|---|---|
committer | Trevor Saunders <tsaunders@mozilla.com> | 2014-02-18 22:44:34 -0500 |
commit | d431ff3b93be64394ac9c95a3c49968c850c2809 (patch) | |
tree | 44a80fafe17b3fa90921ea4ced32b8e1a5762110 | |
parent | e00d7cc89798ff6e2e23776bdc5ff2209b0516be (diff) | |
download | gcc-d431ff3b93be64394ac9c95a3c49968c850c2809.tar.gz |
replace some use of bitmap_copy with a copy ctor
-rw-r--r-- | gcc/bitmap.h | 11 | ||||
-rw-r--r-- | gcc/dce.c | 6 | ||||
-rw-r--r-- | gcc/df-problems.c | 3 | ||||
-rw-r--r-- | gcc/df-scan.c | 6 | ||||
-rw-r--r-- | gcc/gcse.c | 3 | ||||
-rw-r--r-- | gcc/ipa-reference.c | 7 | ||||
-rw-r--r-- | gcc/ira.c | 3 | ||||
-rw-r--r-- | gcc/lower-subreg.c | 4 | ||||
-rw-r--r-- | gcc/lra-constraints.c | 6 | ||||
-rw-r--r-- | gcc/recog.c | 3 | ||||
-rw-r--r-- | gcc/tree-sra.c | 3 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 4 | ||||
-rw-r--r-- | gcc/tree-ssa-threadedge.c | 12 |
13 files changed, 28 insertions, 43 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h index fd27258655d..98da3c11f6d 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -184,11 +184,19 @@ extern void bitmap_clear (bitmap); static void bitmap_initialize_stat (bitmap head, bitmap_obstack *obstack MEM_STAT_DECL); +/* Copy a bitmap to another bitmap. */ +extern void bitmap_copy (bitmap, const_bitmap); + /* Head of bitmap linked list. The 'current' member points to something already pointed to by the chain started by first, so GTY((skip)) it. */ struct GTY(()) bitmap_head { bitmap_head (bitmap_obstack *o = &bitmap_default_obstack MEM_STAT_DECL) { bitmap_initialize_stat (this, o PASS_MEM_STAT); } + explicit bitmap_head (const bitmap_head &other MEM_STAT_DECL) + { + bitmap_initialize_stat (this, other.obstack PASS_MEM_STAT); + bitmap_copy (this, &other); + } ~bitmap_head () { bitmap_clear (this); } unsigned int indx; /* Index of last element looked at. */ @@ -202,9 +210,6 @@ struct GTY(()) bitmap_head { }; -/* Copy a bitmap to another bitmap. */ -extern void bitmap_copy (bitmap, const_bitmap); - /* True if two bitmaps are identical. */ extern bool bitmap_equal_p (const_bitmap, const_bitmap); diff --git a/gcc/dce.c b/gcc/dce.c index a470946f790..061e9742d02 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -837,7 +837,6 @@ static bool word_dce_process_block (basic_block bb, bool redo_out, struct dead_debug_global *global_debug) { - bitmap_head local_live (&dce_tmp_bitmap_obstack); rtx insn; bool block_changed; struct dead_debug_local debug; @@ -861,7 +860,7 @@ word_dce_process_block (basic_block bb, bool redo_out, df_print_word_regset (dump_file, DF_WORD_LR_OUT (bb)); } - bitmap_copy (&local_live, DF_WORD_LR_OUT (bb)); + bitmap_head local_live (*DF_WORD_LR_OUT (bb)); dead_debug_local_init (&debug, NULL, global_debug); FOR_BB_INSNS_REVERSE (bb, insn) @@ -934,7 +933,6 @@ static bool dce_process_block (basic_block bb, bool redo_out, bitmap au, struct dead_debug_global *global_debug) { - bitmap_head local_live (&dce_tmp_bitmap_obstack); rtx insn; bool block_changed; df_ref *def_rec; @@ -959,7 +957,7 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au, df_print_regset (dump_file, DF_LR_OUT (bb)); } - bitmap_copy (&local_live, DF_LR_OUT (bb)); + bitmap_head local_live (*DF_LR_OUT (bb)); df_simulate_initialize_backwards (bb, &local_live); dead_debug_local_init (&debug, NULL, global_debug); diff --git a/gcc/df-problems.c b/gcc/df-problems.c index e41a28fb5dd..9149eda6d34 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -2090,9 +2090,8 @@ df_chain_create_bb (unsigned int bb_index) basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index); rtx insn; - bitmap_head cpy; + bitmap_head cpy (bb_info->in); - bitmap_copy (&cpy, &bb_info->in); bitmap_set_bit (df_chain->out_of_date_transfer_functions, bb_index); /* Since we are going forwards, process the artificial uses first diff --git a/gcc/df-scan.c b/gcc/df-scan.c index b89672eec31..eaad9e1a3bf 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -1386,7 +1386,6 @@ df_insn_rescan_all (void) basic_block bb; bitmap_iterator bi; unsigned int uid; - bitmap_head tmp (&df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1400,7 +1399,7 @@ df_insn_rescan_all (void) defer_insn_rescan = true; } - bitmap_copy (&tmp, &df->insns_to_delete); + bitmap_head tmp (df->insns_to_delete); EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) { struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid); @@ -1437,7 +1436,6 @@ df_process_deferred_rescans (void) bool defer_insn_rescan = false; bitmap_iterator bi; unsigned int uid; - bitmap_head tmp (&df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1454,7 +1452,7 @@ df_process_deferred_rescans (void) if (dump_file) fprintf (dump_file, "starting the processing of deferred insns\n"); - bitmap_copy (&tmp, &df->insns_to_delete); + bitmap_head tmp (df->insns_to_delete); EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) { struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid); diff --git a/gcc/gcse.c b/gcc/gcse.c index 700e497388a..ee699a1c5f6 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -3513,14 +3513,13 @@ calculate_bb_reg_pressure (void) ira_setup_eliminable_regset (); - bitmap_head curr_regs_live (®_obstack); FOR_EACH_BB_FN (bb, cfun) { curr_bb = bb; BB_DATA (bb)->live_in = BITMAP_ALLOC (NULL); BB_DATA (bb)->backup = BITMAP_ALLOC (NULL); bitmap_copy (BB_DATA (bb)->live_in, df_get_live_in (bb)); - bitmap_copy (&curr_regs_live, df_get_live_out (bb)); + bitmap_head curr_regs_live (*df_get_live_out (bb)); for (i = 0; i < ira_pressure_classes_num; i++) curr_reg_pressure[ira_pressure_classes[i]] = 0; EXECUTE_IF_SET_IN_BITMAP (&curr_regs_live, 0, j, bi) diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index ca36f5b06a7..837e9e7627b 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -340,11 +340,8 @@ copy_static_var_set (bitmap set) { if (set == NULL || set == all_module_statics) return set; - bitmap_obstack *o = set->obstack; - gcc_checking_assert (o); - bitmap copy = BITMAP_ALLOC (o); - bitmap_copy (copy, set); - return copy; + gcc_checking_assert (set->obstack); + return new bitmap_head (*set); } /* Compute the union all of the statics read and written by every callee of X diff --git a/gcc/ira.c b/gcc/ira.c index 040c9d029d2..32134b8e23a 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -4527,8 +4527,7 @@ find_moveable_pseudos (void) bitmap transp = bb_transp_live + bb->index; bitmap moveable = bb_moveable_reg_sets + bb->index; - bitmap_head live; - bitmap_copy (&live, df_get_live_out (bb)); + bitmap_head live (*df_get_live_out (bb)); bitmap_and_into (&live, df_get_live_in (bb)); bitmap_copy (transp, &live); bitmap_head set; diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index caec3f97cd5..4a5cb5a1cf1 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -412,9 +412,7 @@ find_pseudo_copy (rtx set) static void propagate_pseudo_copies (void) { - bitmap_head queue; - - bitmap_copy (&queue, decomposable_context); + bitmap_head queue (*decomposable_context); do { bitmap_head propagate; diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 5c9f4f8744a..4227350837c 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5720,9 +5720,8 @@ undo_optional_reloads (void) unsigned int regno, uid; bitmap_iterator bi, bi2; rtx insn, set, src, dest; - bitmap_head removed_optional_reload_pseudos (®_obstack); - bitmap_copy (&removed_optional_reload_pseudos, &lra_optional_reload_pseudos); + bitmap_head removed_optional_reload_pseudos (lra_optional_reload_pseudos); EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi) { keep_p = false; @@ -5763,12 +5762,11 @@ undo_optional_reloads (void) } } change_p = ! bitmap_empty_p (&removed_optional_reload_pseudos); - bitmap_head insn_bitmap (®_obstack); EXECUTE_IF_SET_IN_BITMAP (&removed_optional_reload_pseudos, 0, regno, bi) { if (lra_dump_file != NULL) fprintf (lra_dump_file, "Remove optional reload reg %d\n", regno); - bitmap_copy (&insn_bitmap, &lra_reg_info[regno].insn_bitmap); + bitmap_head insn_bitmap (lra_reg_info[regno].insn_bitmap); EXECUTE_IF_SET_IN_BITMAP (&insn_bitmap, 0, uid, bi2) { insn = lra_insn_recog_data[uid]->insn; diff --git a/gcc/recog.c b/gcc/recog.c index 5c550752223..84819706e85 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3630,7 +3630,6 @@ peephole2_optimize (void) for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) peep2_insn_data[i].live_before = BITMAP_ALLOC (®_obstack); search_ofs = 0; - bitmap_head live; FOR_EACH_BB_REVERSE_FN (bb, cfun) { @@ -3640,7 +3639,7 @@ peephole2_optimize (void) rtl_profile_for_bb (bb); /* Start up propagation. */ - bitmap_copy (&live, DF_LR_IN (bb)); + bitmap_head live (*DF_LR_IN (bb)); df_simulate_initialize_forwards (bb, &live); peep2_reinit_state (&live); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index bae615cecd9..c1a1f0373c9 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2481,7 +2481,6 @@ static bool analyze_all_variable_accesses (void) { int res = 0; - bitmap_head tmp; bitmap_iterator bi; unsigned i, max_total_scalarization_size; @@ -2517,7 +2516,7 @@ analyze_all_variable_accesses (void) } } - bitmap_copy (&tmp, candidate_bitmap); + bitmap_head tmp (*candidate_bitmap); EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, i, bi) { tree var = candidate (i); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 41781ad243b..bdaf9f43976 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -3043,7 +3043,7 @@ eliminate_degenerate_phis (void) Experiments have show we generally get better compilation time behavior with bitmaps rather than sbitmaps. */ - bitmap_head interesting_names, interesting_names1; + bitmap_head interesting_names; calculate_dominance_info (CDI_DOMINATORS); cfg_altered = false; @@ -3071,7 +3071,7 @@ eliminate_degenerate_phis (void) /* EXECUTE_IF_SET_IN_BITMAP does not like its bitmap changed during the loop. Copy it to another bitmap and use that. */ - bitmap_copy (&interesting_names1, &interesting_names); + bitmap_head interesting_names1 (interesting_names); EXECUTE_IF_SET_IN_BITMAP (&interesting_names1, 0, i, bi) { diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index c447b72c32f..04f305b7801 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -1136,10 +1136,8 @@ thread_across_edge (gimple dummy_cond, /* We need to restore the state of the maps to this point each loop iteration. */ - bitmap src_map_copy = BITMAP_ALLOC (NULL); - bitmap dst_map_copy = BITMAP_ALLOC (NULL); - bitmap_copy (src_map_copy, src_map); - bitmap_copy (dst_map_copy, dst_map); + bitmap_head src_map_copy (*src_map); + bitmap_head dst_map_copy (*dst_map); /* Look at each successor of E->dest to see if we can thread through it. */ FOR_EACH_EDGE (taken_edge, ei, e->dest->succs) @@ -1147,8 +1145,8 @@ thread_across_edge (gimple dummy_cond, /* Push a fresh marker so we can unwind the equivalences created for each of E->dest's successors. */ stack->safe_push (NULL_TREE); - bitmap_copy (src_map, src_map_copy); - bitmap_copy (dst_map, dst_map_copy); + bitmap_copy (src_map, &src_map_copy); + bitmap_copy (dst_map, &dst_map_copy); /* Avoid threading to any block we have already visited. */ bitmap_clear (visited); @@ -1206,8 +1204,6 @@ thread_across_edge (gimple dummy_cond, BITMAP_FREE (visited); BITMAP_FREE (src_map); BITMAP_FREE (dst_map); - BITMAP_FREE (src_map_copy); - BITMAP_FREE (dst_map_copy); } remove_temporary_equivalences (stack); |