From d648b5ff3cb2bf7aec320312e79c90e49cd9b39b Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Sun, 14 May 2017 00:38:59 +0000 Subject: [PATCH] use auto_bitmap more with alternate obstacks gcc/ChangeLog: 2017-05-13 Trevor Saunders * df-core.c (df_set_blocks): Start using auto_bitmap. (df_compact_blocks): Likewise. * df-problems.c (df_rd_confluence_n): Likewise. * df-scan.c (df_insn_rescan_all): Likewise. (df_process_deferred_rescans): Likewise. (df_update_entry_block_defs): Likewise. (df_update_exit_block_uses): Likewise. (df_entry_block_bitmap_verify): Likewise. (df_exit_block_bitmap_verify): Likewise. (df_scan_verify): Likewise. * lra-constraints.c (lra_constraints): Likewise. (undo_optional_reloads): Likewise. (lra_undo_inheritance): Likewise. * lra-remat.c (calculate_gen_cands): Likewise. (do_remat): Likewise. * lra-spills.c (assign_spill_hard_regs): Likewise. (spill_pseudos): Likewise. * tree-ssa-pre.c (bitmap_set_and): Likewise. (bitmap_set_subtract_values): Likewise. From-SVN: r248023 --- gcc/ChangeLog | 22 ++++++++++ gcc/df-core.c | 30 ++++++-------- gcc/df-problems.c | 10 ++--- gcc/df-scan.c | 93 +++++++++++++++++-------------------------- gcc/lra-constraints.c | 42 +++++++++---------- gcc/lra-remat.c | 43 +++++++++----------- gcc/lra-spills.c | 25 +++++------- 7 files changed, 120 insertions(+), 145 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d73ea2e393c..aeb0a3908a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2017-05-13 Trevor Saunders + + * df-core.c (df_set_blocks): Start using auto_bitmap. + (df_compact_blocks): Likewise. + * df-problems.c (df_rd_confluence_n): Likewise. + * df-scan.c (df_insn_rescan_all): Likewise. + (df_process_deferred_rescans): Likewise. + (df_update_entry_block_defs): Likewise. + (df_update_exit_block_uses): Likewise. + (df_entry_block_bitmap_verify): Likewise. + (df_exit_block_bitmap_verify): Likewise. + (df_scan_verify): Likewise. + * lra-constraints.c (lra_constraints): Likewise. + (undo_optional_reloads): Likewise. + (lra_undo_inheritance): Likewise. + * lra-remat.c (calculate_gen_cands): Likewise. + (do_remat): Likewise. + * lra-spills.c (assign_spill_hard_regs): Likewise. + (spill_pseudos): Likewise. + * tree-ssa-pre.c (bitmap_set_and): Likewise. + (bitmap_set_subtract_values): Likewise. + 2017-05-13 Trevor Saunders * haifa-sched.c (estimate_shadow_tick): Replace manual bitmap diff --git a/gcc/df-core.c b/gcc/df-core.c index 98787a768c6..1b270d417aa 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -497,9 +497,8 @@ df_set_blocks (bitmap blocks) /* This block is called to change the focus from one subset to another. */ int p; - bitmap_head diff; - bitmap_initialize (&diff, &df_bitmap_obstack); - bitmap_and_compl (&diff, df->blocks_to_analyze, blocks); + auto_bitmap diff (&df_bitmap_obstack); + bitmap_and_compl (diff, df->blocks_to_analyze, blocks); for (p = 0; p < df->num_problems_defined; p++) { struct dataflow *dflow = df->problems_in_order[p]; @@ -510,7 +509,7 @@ df_set_blocks (bitmap blocks) bitmap_iterator bi; unsigned int bb_index; - EXECUTE_IF_SET_IN_BITMAP (&diff, 0, bb_index, bi) + EXECUTE_IF_SET_IN_BITMAP (diff, 0, bb_index, bi) { basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index); if (bb) @@ -522,8 +521,6 @@ df_set_blocks (bitmap blocks) } } } - - bitmap_clear (&diff); } else { @@ -1652,9 +1649,8 @@ df_compact_blocks (void) int i, p; basic_block bb; void *problem_temps; - bitmap_head tmp; - bitmap_initialize (&tmp, &df_bitmap_obstack); + auto_bitmap tmp (&df_bitmap_obstack); for (p = 0; p < df->num_problems_defined; p++) { struct dataflow *dflow = df->problems_in_order[p]; @@ -1663,17 +1659,17 @@ df_compact_blocks (void) dflow problem. */ if (dflow->out_of_date_transfer_functions) { - bitmap_copy (&tmp, dflow->out_of_date_transfer_functions); + bitmap_copy (tmp, dflow->out_of_date_transfer_functions); bitmap_clear (dflow->out_of_date_transfer_functions); - if (bitmap_bit_p (&tmp, ENTRY_BLOCK)) + if (bitmap_bit_p (tmp, ENTRY_BLOCK)) bitmap_set_bit (dflow->out_of_date_transfer_functions, ENTRY_BLOCK); - if (bitmap_bit_p (&tmp, EXIT_BLOCK)) + if (bitmap_bit_p (tmp, EXIT_BLOCK)) bitmap_set_bit (dflow->out_of_date_transfer_functions, EXIT_BLOCK); i = NUM_FIXED_BLOCKS; FOR_EACH_BB_FN (bb, cfun) { - if (bitmap_bit_p (&tmp, bb->index)) + if (bitmap_bit_p (tmp, bb->index)) bitmap_set_bit (dflow->out_of_date_transfer_functions, i); i++; } @@ -1711,23 +1707,21 @@ df_compact_blocks (void) if (df->blocks_to_analyze) { - if (bitmap_bit_p (&tmp, ENTRY_BLOCK)) + if (bitmap_bit_p (tmp, ENTRY_BLOCK)) bitmap_set_bit (df->blocks_to_analyze, ENTRY_BLOCK); - if (bitmap_bit_p (&tmp, EXIT_BLOCK)) + if (bitmap_bit_p (tmp, EXIT_BLOCK)) bitmap_set_bit (df->blocks_to_analyze, EXIT_BLOCK); - bitmap_copy (&tmp, df->blocks_to_analyze); + bitmap_copy (tmp, df->blocks_to_analyze); bitmap_clear (df->blocks_to_analyze); i = NUM_FIXED_BLOCKS; FOR_EACH_BB_FN (bb, cfun) { - if (bitmap_bit_p (&tmp, bb->index)) + if (bitmap_bit_p (tmp, bb->index)) bitmap_set_bit (df->blocks_to_analyze, i); i++; } } - bitmap_clear (&tmp); - i = NUM_FIXED_BLOCKS; FOR_EACH_BB_FN (bb, cfun) { diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 92323a39d8a..755aecf46df 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -461,19 +461,17 @@ df_rd_confluence_n (edge e) bitmap dense_invalidated = &problem_data->dense_invalidated_by_call; bitmap_iterator bi; unsigned int regno; - bitmap_head tmp; - bitmap_initialize (&tmp, &df_bitmap_obstack); - bitmap_and_compl (&tmp, op2, dense_invalidated); + auto_bitmap tmp (&df_bitmap_obstack); + bitmap_and_compl (tmp, op2, dense_invalidated); EXECUTE_IF_SET_IN_BITMAP (sparse_invalidated, 0, regno, bi) { - bitmap_clear_range (&tmp, + bitmap_clear_range (tmp, DF_DEFS_BEGIN (regno), DF_DEFS_COUNT (regno)); } - changed |= bitmap_ior_into (op1, &tmp); - bitmap_clear (&tmp); + changed |= bitmap_ior_into (op1, tmp); return changed; } else diff --git a/gcc/df-scan.c b/gcc/df-scan.c index f75098c2bec..4884608b167 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -1161,9 +1161,6 @@ df_insn_rescan_all (void) basic_block bb; bitmap_iterator bi; unsigned int uid; - bitmap_head tmp; - - bitmap_initialize (&tmp, &df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1177,15 +1174,15 @@ df_insn_rescan_all (void) defer_insn_rescan = true; } - bitmap_copy (&tmp, &df->insns_to_delete); - EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) + auto_bitmap tmp (&df_bitmap_obstack); + bitmap_copy (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); if (insn_info) df_insn_info_delete (uid); } - bitmap_clear (&tmp); bitmap_clear (&df->insns_to_delete); bitmap_clear (&df->insns_to_rescan); bitmap_clear (&df->insns_to_notes_rescan); @@ -1215,9 +1212,6 @@ df_process_deferred_rescans (void) bool defer_insn_rescan = false; bitmap_iterator bi; unsigned int uid; - bitmap_head tmp; - - bitmap_initialize (&tmp, &df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1234,24 +1228,25 @@ 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); - EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) + auto_bitmap tmp (&df_bitmap_obstack); + bitmap_copy (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); if (insn_info) df_insn_info_delete (uid); } - bitmap_copy (&tmp, &df->insns_to_rescan); - EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) + bitmap_copy (tmp, &df->insns_to_rescan); + EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi) { struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid); if (insn_info) df_insn_rescan (insn_info->insn); } - bitmap_copy (&tmp, &df->insns_to_notes_rescan); - EXECUTE_IF_SET_IN_BITMAP (&tmp, 0, uid, bi) + bitmap_copy (tmp, &df->insns_to_notes_rescan); + EXECUTE_IF_SET_IN_BITMAP (tmp, 0, uid, bi) { struct df_insn_info *insn_info = DF_INSN_UID_SAFE_GET (uid); if (insn_info) @@ -1261,7 +1256,6 @@ df_process_deferred_rescans (void) if (dump_file) fprintf (dump_file, "ending the processing of deferred insns\n"); - bitmap_clear (&tmp); bitmap_clear (&df->insns_to_delete); bitmap_clear (&df->insns_to_rescan); bitmap_clear (&df->insns_to_notes_rescan); @@ -3628,14 +3622,13 @@ df_record_entry_block_defs (bitmap entry_block_defs) void df_update_entry_block_defs (void) { - bitmap_head refs; bool changed = false; - bitmap_initialize (&refs, &df_bitmap_obstack); - df_get_entry_block_def_set (&refs); + auto_bitmap refs (&df_bitmap_obstack); + df_get_entry_block_def_set (refs); if (df->entry_block_defs) { - if (!bitmap_equal_p (df->entry_block_defs, &refs)) + if (!bitmap_equal_p (df->entry_block_defs, refs)) { struct df_scan_bb_info *bb_info = df_scan_get_bb_info (ENTRY_BLOCK); df_ref_chain_delete_du_chain (bb_info->artificial_defs); @@ -3655,11 +3648,10 @@ df_update_entry_block_defs (void) if (changed) { - df_record_entry_block_defs (&refs); - bitmap_copy (df->entry_block_defs, &refs); + df_record_entry_block_defs (refs); + bitmap_copy (df->entry_block_defs, refs); df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK)); } - bitmap_clear (&refs); } @@ -3804,14 +3796,13 @@ df_record_exit_block_uses (bitmap exit_block_uses) void df_update_exit_block_uses (void) { - bitmap_head refs; bool changed = false; - bitmap_initialize (&refs, &df_bitmap_obstack); - df_get_exit_block_use_set (&refs); + auto_bitmap refs (&df_bitmap_obstack); + df_get_exit_block_use_set (refs); if (df->exit_block_uses) { - if (!bitmap_equal_p (df->exit_block_uses, &refs)) + if (!bitmap_equal_p (df->exit_block_uses, refs)) { struct df_scan_bb_info *bb_info = df_scan_get_bb_info (EXIT_BLOCK); df_ref_chain_delete_du_chain (bb_info->artificial_uses); @@ -3831,11 +3822,10 @@ df_update_exit_block_uses (void) if (changed) { - df_record_exit_block_uses (&refs); - bitmap_copy (df->exit_block_uses,& refs); + df_record_exit_block_uses (refs); + bitmap_copy (df->exit_block_uses, refs); df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK)); } - bitmap_clear (&refs); } static bool initialized = false; @@ -4171,25 +4161,22 @@ df_bb_verify (basic_block bb) static bool df_entry_block_bitmap_verify (bool abort_if_fail) { - bitmap_head entry_block_defs; bool is_eq; - bitmap_initialize (&entry_block_defs, &df_bitmap_obstack); - df_get_entry_block_def_set (&entry_block_defs); + auto_bitmap entry_block_defs (&df_bitmap_obstack); + df_get_entry_block_def_set (entry_block_defs); - is_eq = bitmap_equal_p (&entry_block_defs, df->entry_block_defs); + is_eq = bitmap_equal_p (entry_block_defs, df->entry_block_defs); if (!is_eq && abort_if_fail) { fprintf (stderr, "entry_block_defs = "); - df_print_regset (stderr, &entry_block_defs); + df_print_regset (stderr, entry_block_defs); fprintf (stderr, "df->entry_block_defs = "); df_print_regset (stderr, df->entry_block_defs); gcc_assert (0); } - bitmap_clear (&entry_block_defs); - return is_eq; } @@ -4200,25 +4187,22 @@ df_entry_block_bitmap_verify (bool abort_if_fail) static bool df_exit_block_bitmap_verify (bool abort_if_fail) { - bitmap_head exit_block_uses; bool is_eq; - bitmap_initialize (&exit_block_uses, &df_bitmap_obstack); - df_get_exit_block_use_set (&exit_block_uses); + auto_bitmap exit_block_uses (&df_bitmap_obstack); + df_get_exit_block_use_set (exit_block_uses); - is_eq = bitmap_equal_p (&exit_block_uses, df->exit_block_uses); + is_eq = bitmap_equal_p (exit_block_uses, df->exit_block_uses); if (!is_eq && abort_if_fail) { fprintf (stderr, "exit_block_uses = "); - df_print_regset (stderr, &exit_block_uses); + df_print_regset (stderr, exit_block_uses); fprintf (stderr, "df->exit_block_uses = "); df_print_regset (stderr, df->exit_block_uses); gcc_assert (0); } - bitmap_clear (&exit_block_uses); - return is_eq; } @@ -4231,8 +4215,6 @@ df_scan_verify (void) { unsigned int i; basic_block bb; - bitmap_head regular_block_artificial_uses; - bitmap_head eh_block_artificial_uses; if (!df) return; @@ -4253,24 +4235,21 @@ df_scan_verify (void) /* (2) There are various bitmaps whose value may change over the course of the compilation. This step recomputes them to make sure that they have not slipped out of date. */ - bitmap_initialize (®ular_block_artificial_uses, &df_bitmap_obstack); - bitmap_initialize (&eh_block_artificial_uses, &df_bitmap_obstack); + auto_bitmap regular_block_artificial_uses (&df_bitmap_obstack); + auto_bitmap eh_block_artificial_uses (&df_bitmap_obstack); - df_get_regular_block_artificial_uses (®ular_block_artificial_uses); - df_get_eh_block_artificial_uses (&eh_block_artificial_uses); + df_get_regular_block_artificial_uses (regular_block_artificial_uses); + df_get_eh_block_artificial_uses (eh_block_artificial_uses); - bitmap_ior_into (&eh_block_artificial_uses, - ®ular_block_artificial_uses); + bitmap_ior_into (eh_block_artificial_uses, + regular_block_artificial_uses); /* Check artificial_uses bitmaps didn't change. */ - gcc_assert (bitmap_equal_p (®ular_block_artificial_uses, + gcc_assert (bitmap_equal_p (regular_block_artificial_uses, &df->regular_block_artificial_uses)); - gcc_assert (bitmap_equal_p (&eh_block_artificial_uses, + gcc_assert (bitmap_equal_p (eh_block_artificial_uses, &df->eh_block_artificial_uses)); - bitmap_clear (®ular_block_artificial_uses); - bitmap_clear (&eh_block_artificial_uses); - /* Verify entry block and exit block. These only verify the bitmaps, the refs are verified in df_bb_verify. */ df_entry_block_bitmap_verify (true); diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index b0ae0fe3d9a..c6465c75523 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4644,7 +4644,6 @@ lra_constraints (bool first_p) unsigned int min_len, new_min_len, uid; rtx set, x, reg, dest_reg; basic_block last_bb; - bitmap_head equiv_insn_bitmap; bitmap_iterator bi; lra_constraint_iter++; @@ -4676,7 +4675,7 @@ lra_constraints (bool first_p) /* Do elimination before the equivalence processing as we can spill some pseudos during elimination. */ lra_eliminate (false, first_p); - bitmap_initialize (&equiv_insn_bitmap, ®_obstack); + auto_bitmap equiv_insn_bitmap (®_obstack); for (i = FIRST_PSEUDO_REGISTER; i < new_regno_start; i++) if (lra_reg_info[i].nrefs != 0) { @@ -4737,14 +4736,14 @@ lra_constraints (bool first_p) if (contains_reg_p (x, false, true)) ira_reg_equiv[i].profitable_p = false; if (get_equiv (reg) != reg) - bitmap_ior_into (&equiv_insn_bitmap, &lra_reg_info[i].insn_bitmap); + bitmap_ior_into (equiv_insn_bitmap, &lra_reg_info[i].insn_bitmap); } } for (i = FIRST_PSEUDO_REGISTER; i < new_regno_start; i++) update_equiv (i); /* We should add all insns containing pseudos which should be substituted by their equivalences. */ - EXECUTE_IF_SET_IN_BITMAP (&equiv_insn_bitmap, 0, uid, bi) + EXECUTE_IF_SET_IN_BITMAP (equiv_insn_bitmap, 0, uid, bi) lra_push_insn_by_uid (uid); min_len = lra_insn_stack_length (); new_insns_num = 0; @@ -4775,7 +4774,7 @@ lra_constraints (bool first_p) /* We need to check equivalence in debug insn and change pseudo to the equivalent value if necessary. */ curr_id = lra_get_insn_recog_data (curr_insn); - if (bitmap_bit_p (&equiv_insn_bitmap, INSN_UID (curr_insn))) + if (bitmap_bit_p (equiv_insn_bitmap, INSN_UID (curr_insn))) { rtx old = *curr_id->operand_loc[0]; *curr_id->operand_loc[0] @@ -4849,7 +4848,7 @@ lra_constraints (bool first_p) /* Check non-transformed insns too for equiv change as USE or CLOBBER don't need reloads but can contain pseudos being changed on their equivalences. */ - else if (bitmap_bit_p (&equiv_insn_bitmap, INSN_UID (curr_insn)) + else if (bitmap_bit_p (equiv_insn_bitmap, INSN_UID (curr_insn)) && loc_equivalence_change_p (&PATTERN (curr_insn))) { lra_update_insn_regno_info (curr_insn); @@ -4857,7 +4856,7 @@ lra_constraints (bool first_p) } } } - bitmap_clear (&equiv_insn_bitmap); + /* If we used a new hard regno, changed_p should be true because the hard reg is assigned to a new pseudo. */ if (flag_checking && !changed_p) @@ -6791,10 +6790,9 @@ undo_optional_reloads (void) bitmap_iterator bi, bi2; rtx_insn *insn; rtx set, src, dest; - bitmap_head removed_optional_reload_pseudos, insn_bitmap; + auto_bitmap removed_optional_reload_pseudos (®_obstack); - bitmap_initialize (&removed_optional_reload_pseudos, ®_obstack); - bitmap_copy (&removed_optional_reload_pseudos, &lra_optional_reload_pseudos); + bitmap_copy (removed_optional_reload_pseudos, &lra_optional_reload_pseudos); EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi) { keep_p = false; @@ -6829,19 +6827,19 @@ undo_optional_reloads (void) } if (keep_p) { - bitmap_clear_bit (&removed_optional_reload_pseudos, regno); + bitmap_clear_bit (removed_optional_reload_pseudos, regno); if (lra_dump_file != NULL) fprintf (lra_dump_file, "Keep optional reload reg %d\n", regno); } } - change_p = ! bitmap_empty_p (&removed_optional_reload_pseudos); - bitmap_initialize (&insn_bitmap, ®_obstack); - EXECUTE_IF_SET_IN_BITMAP (&removed_optional_reload_pseudos, 0, regno, bi) + change_p = ! bitmap_empty_p (removed_optional_reload_pseudos); + auto_bitmap 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); - EXECUTE_IF_SET_IN_BITMAP (&insn_bitmap, 0, uid, bi2) + bitmap_copy (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; if ((set = single_set (insn)) != NULL_RTX) @@ -6885,8 +6883,6 @@ undo_optional_reloads (void) /* Clear restore_regnos. */ EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi) lra_reg_info[regno].restore_rtx = NULL_RTX; - bitmap_clear (&insn_bitmap); - bitmap_clear (&removed_optional_reload_pseudos); return change_p; } @@ -6899,7 +6895,6 @@ lra_undo_inheritance (void) int hard_regno; int n_all_inherit, n_inherit, n_all_split, n_split; rtx restore_rtx; - bitmap_head remove_pseudos; bitmap_iterator bi; bool change_p; @@ -6910,7 +6905,7 @@ lra_undo_inheritance (void) fprintf (lra_dump_file, "\n********** Undoing inheritance #%d: **********\n\n", lra_undo_inheritance_iter); - bitmap_initialize (&remove_pseudos, ®_obstack); + auto_bitmap remove_pseudos (®_obstack); n_inherit = n_all_inherit = 0; EXECUTE_IF_SET_IN_BITMAP (&lra_inheritance_pseudos, 0, regno, bi) if (lra_reg_info[regno].restore_rtx != NULL_RTX) @@ -6922,7 +6917,7 @@ lra_undo_inheritance (void) allocation we used shorter live-ranges. */ && (! REG_P (lra_reg_info[regno].restore_rtx) || reg_renumber[REGNO (lra_reg_info[regno].restore_rtx)] < 0)) - bitmap_set_bit (&remove_pseudos, regno); + bitmap_set_bit (remove_pseudos, regno); else n_inherit++; } @@ -6940,7 +6935,7 @@ lra_undo_inheritance (void) hard_regno = (restore_regno >= FIRST_PSEUDO_REGISTER ? reg_renumber[restore_regno] : restore_regno); if (hard_regno < 0 || reg_renumber[regno] == hard_regno) - bitmap_set_bit (&remove_pseudos, regno); + bitmap_set_bit (remove_pseudos, regno); else { n_split++; @@ -6953,8 +6948,7 @@ lra_undo_inheritance (void) fprintf (lra_dump_file, "Split %d out of %d (%.2f%%)\n", n_split, n_all_split, (double) n_split / n_all_split * 100); - change_p = remove_inheritance_pseudos (&remove_pseudos); - bitmap_clear (&remove_pseudos); + change_p = remove_inheritance_pseudos (remove_pseudos); /* Clear restore_regnos. */ EXECUTE_IF_SET_IN_BITMAP (&lra_inheritance_pseudos, 0, regno, bi) lra_reg_info[regno].restore_rtx = NULL_RTX; diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index 2c51481374a..fb294edf368 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -746,14 +746,12 @@ calculate_gen_cands (void) { basic_block bb; bitmap gen_cands; - bitmap_head gen_insns; rtx_insn *insn; - bitmap_initialize (&gen_insns, ®_obstack); FOR_EACH_BB_FN (bb, cfun) { gen_cands = &get_remat_bb_data (bb)->gen_cands; - bitmap_clear (&gen_insns); + auto_bitmap gen_insns (®_obstack); FOR_BB_INSNS (bb, insn) if (INSN_P (insn)) { @@ -782,7 +780,7 @@ calculate_gen_cands (void) reg = reg->next) if (reg->type != OP_IN || find_regno_note (insn, REG_DEAD, reg->regno) != NULL) - EXECUTE_IF_SET_IN_BITMAP (&gen_insns, 0, uid, bi) + EXECUTE_IF_SET_IN_BITMAP (gen_insns, 0, uid, bi) { rtx_insn *insn2 = lra_insn_recog_data[uid]->insn; @@ -801,7 +799,7 @@ calculate_gen_cands (void) } if (CALL_P (insn)) - EXECUTE_IF_SET_IN_BITMAP (&gen_insns, 0, uid, bi) + EXECUTE_IF_SET_IN_BITMAP (gen_insns, 0, uid, bi) { rtx_insn *insn2 = lra_insn_recog_data[uid]->insn; @@ -813,17 +811,16 @@ calculate_gen_cands (void) bitmap_set_bit (&temp_bitmap, uid); } } - bitmap_and_compl_into (&gen_insns, &temp_bitmap); + bitmap_and_compl_into (gen_insns, &temp_bitmap); cand = insn_to_cand[INSN_UID (insn)]; if (cand != NULL) { bitmap_set_bit (gen_cands, cand->index); - bitmap_set_bit (&gen_insns, INSN_UID (insn)); + bitmap_set_bit (gen_insns, INSN_UID (insn)); } } } - bitmap_clear (&gen_insns); } @@ -1059,15 +1056,13 @@ do_remat (void) unsigned regno; rtx_insn *insn; basic_block bb; - bitmap_head avail_cands; - bitmap_head active_cands; bool changed_p = false; /* Living hard regs and hard registers of living pseudos. */ HARD_REG_SET live_hard_regs; bitmap_iterator bi; - bitmap_initialize (&avail_cands, ®_obstack); - bitmap_initialize (&active_cands, ®_obstack); + auto_bitmap avail_cands (®_obstack); + auto_bitmap active_cands (®_obstack); FOR_EACH_BB_FN (bb, cfun) { CLEAR_HARD_REG_SET (live_hard_regs); @@ -1079,11 +1074,11 @@ do_remat (void) if (hard_regno >= 0) SET_HARD_REG_BIT (live_hard_regs, hard_regno); } - bitmap_and (&avail_cands, &get_remat_bb_data (bb)->avin_cands, + bitmap_and (avail_cands, &get_remat_bb_data (bb)->avin_cands, &get_remat_bb_data (bb)->livein_cands); /* Activating insns are always in the same block as their corresponding remat insn, so at the start of a block the two bitsets are equal. */ - bitmap_copy (&active_cands, &avail_cands); + bitmap_copy (active_cands, avail_cands); FOR_BB_INSNS (bb, insn) { if (!NONDEBUG_INSN_P (insn)) @@ -1117,8 +1112,8 @@ do_remat (void) for (cand = regno_cands[src_regno]; cand != NULL; cand = cand->next_regno_cand) - if (bitmap_bit_p (&avail_cands, cand->index) - && bitmap_bit_p (&active_cands, cand->index)) + if (bitmap_bit_p (avail_cands, cand->index) + && bitmap_bit_p (active_cands, cand->index)) break; } int i, hard_regno, nregs; @@ -1189,7 +1184,7 @@ do_remat (void) reg = reg->next) if (reg->type != OP_IN || find_regno_note (insn, REG_DEAD, reg->regno) != NULL) - EXECUTE_IF_SET_IN_BITMAP (&avail_cands, 0, cid, bi) + EXECUTE_IF_SET_IN_BITMAP (avail_cands, 0, cid, bi) { cand = all_cands[cid]; @@ -1203,7 +1198,7 @@ do_remat (void) } if (CALL_P (insn)) - EXECUTE_IF_SET_IN_BITMAP (&avail_cands, 0, cid, bi) + EXECUTE_IF_SET_IN_BITMAP (avail_cands, 0, cid, bi) { cand = all_cands[cid]; @@ -1211,22 +1206,22 @@ do_remat (void) bitmap_set_bit (&temp_bitmap, cand->index); } - bitmap_and_compl_into (&avail_cands, &temp_bitmap); + bitmap_and_compl_into (avail_cands, &temp_bitmap); /* Now see whether a candidate is made active or available by this insn. */ cand = insn_to_cand_activation[INSN_UID (insn)]; if (cand) - bitmap_set_bit (&active_cands, cand->index); + bitmap_set_bit (active_cands, cand->index); cand = insn_to_cand[INSN_UID (insn)]; if (cand != NULL) { - bitmap_set_bit (&avail_cands, cand->index); + bitmap_set_bit (avail_cands, cand->index); if (cand->reload_regno == -1) - bitmap_set_bit (&active_cands, cand->index); + bitmap_set_bit (active_cands, cand->index); else - bitmap_clear_bit (&active_cands, cand->index); + bitmap_clear_bit (active_cands, cand->index); } if (remat_insn != NULL) @@ -1274,8 +1269,6 @@ do_remat (void) SET_HARD_REG_BIT (live_hard_regs, reg->regno); } } - bitmap_clear (&avail_cands); - bitmap_clear (&active_cands); return changed_p; } diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 492fc182cf0..3df6f6786a3 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -223,7 +223,6 @@ assign_spill_hard_regs (int *pseudo_regnos, int n) rtx set; basic_block bb; HARD_REG_SET conflict_hard_regs; - bitmap_head ok_insn_bitmap; bitmap setjump_crosses = regstat_get_setjmp_crosses (); /* Hard registers which can not be used for any purpose at given program point because they are unallocatable or already allocated @@ -243,13 +242,13 @@ assign_spill_hard_regs (int *pseudo_regnos, int n) for (p = r->start; p <= r->finish; p++) add_to_hard_reg_set (&reserved_hard_regs[p], lra_reg_info[i].biggest_mode, hard_regno); - bitmap_initialize (&ok_insn_bitmap, ®_obstack); + auto_bitmap ok_insn_bitmap (®_obstack); FOR_EACH_BB_FN (bb, cfun) FOR_BB_INSNS (bb, insn) if (DEBUG_INSN_P (insn) || ((set = single_set (insn)) != NULL_RTX && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)))) - bitmap_set_bit (&ok_insn_bitmap, INSN_UID (insn)); + bitmap_set_bit (ok_insn_bitmap, INSN_UID (insn)); for (res = i = 0; i < n; i++) { regno = pseudo_regnos[i]; @@ -260,7 +259,7 @@ assign_spill_hard_regs (int *pseudo_regnos, int n) targetm.spill_class ((reg_class_t) rclass, PSEUDO_REGNO_MODE (regno)))) == NO_REGS || bitmap_intersect_compl_p (&lra_reg_info[regno].insn_bitmap, - &ok_insn_bitmap)) + ok_insn_bitmap)) { pseudo_regnos[res++] = regno; continue; @@ -300,7 +299,6 @@ assign_spill_hard_regs (int *pseudo_regnos, int n) /* Just loop. */ df_set_regs_ever_live (hard_regno + nr, true); } - bitmap_clear (&ok_insn_bitmap); free (reserved_hard_regs); return res; } @@ -449,17 +447,16 @@ spill_pseudos (void) basic_block bb; rtx_insn *insn, *curr; int i; - bitmap_head spilled_pseudos, changed_insns; - bitmap_initialize (&spilled_pseudos, ®_obstack); - bitmap_initialize (&changed_insns, ®_obstack); + auto_bitmap spilled_pseudos (®_obstack); + auto_bitmap changed_insns (®_obstack); for (i = FIRST_PSEUDO_REGISTER; i < regs_num; i++) { if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0 && ! lra_former_scratch_p (i)) { - bitmap_set_bit (&spilled_pseudos, i); - bitmap_ior_into (&changed_insns, &lra_reg_info[i].insn_bitmap); + bitmap_set_bit (spilled_pseudos, i); + bitmap_ior_into (changed_insns, &lra_reg_info[i].insn_bitmap); } } FOR_EACH_BB_FN (bb, cfun) @@ -468,7 +465,7 @@ spill_pseudos (void) { bool removed_pseudo_p = false; - if (bitmap_bit_p (&changed_insns, INSN_UID (insn))) + if (bitmap_bit_p (changed_insns, INSN_UID (insn))) { rtx *link_loc, link; @@ -526,12 +523,10 @@ spill_pseudos (void) "Debug insn #%u is reset because it referenced " "removed pseudo\n", INSN_UID (insn)); } - bitmap_and_compl_into (df_get_live_in (bb), &spilled_pseudos); - bitmap_and_compl_into (df_get_live_out (bb), &spilled_pseudos); + bitmap_and_compl_into (df_get_live_in (bb), spilled_pseudos); + bitmap_and_compl_into (df_get_live_out (bb), spilled_pseudos); } } - bitmap_clear (&spilled_pseudos); - bitmap_clear (&changed_insns); } /* Return true if we need to change some pseudos into memory. */ -- 2.30.2