diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-06 19:29:01 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-06 19:29:01 +0000 |
commit | 4b5a4301e03317c1925f733c0395b03e8f16b03b (patch) | |
tree | 33762169b920df538a949d4040921754532aa165 /gcc/df-scan.c | |
parent | a8891ab12879a8d2f8421492c85a1b409144cea4 (diff) | |
download | gcc-4b5a4301e03317c1925f733c0395b03e8f16b03b.tar.gz |
* df-core.c (df_set_blocks): Use bitmap_head instead of bitmap.
(df_compact_blocks): Likewise.
* df.h (struct df): Turn hardware_regs_used,
regular_block_artificial_uses, eh_block_artificial_uses,
insns_to_delete, insns_to_rescan, insns_to_notes_rescan into
bitmap_head.
* df-problems.c (df_lr_local_compute, df_lr_confluence_0,
df_byte_lr_alloc, df_simulate_fixup_sets): Update.
* df-scan.c (df_scan_free_internal, df_scan_alloc, df_scan_start_dump,
df_scan_blocks, df_insn_delete, df_insn_rescan,
df_insn_rescan_debug_internal, df_insn_rescan_all,
df_process_deferred_rescans, df_process_deferred_rescans,
df_notes_rescan, df_get_call_refs, df_get_call_refs,
regs_invalidated_by_call_regset, df_get_call_refs, df_bb_refs_collect,
df_record_entry_block_defs, df_record_exit_block_uses,
df_update_exit_block_uses, df_bb_verify, df_entry_block_bitmap_verify,
df_scan_verify): Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df-scan.c')
-rw-r--r-- | gcc/df-scan.c | 212 |
1 files changed, 112 insertions, 100 deletions
diff --git a/gcc/df-scan.c b/gcc/df-scan.c index bf285a19287..8bb2ac06b1b 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -257,14 +257,14 @@ df_scan_free_internal (void) df_scan->block_info = NULL; df_scan->block_info_size = 0; - BITMAP_FREE (df->hardware_regs_used); - BITMAP_FREE (df->regular_block_artificial_uses); - BITMAP_FREE (df->eh_block_artificial_uses); + bitmap_clear (&df->hardware_regs_used); + bitmap_clear (&df->regular_block_artificial_uses); + bitmap_clear (&df->eh_block_artificial_uses); BITMAP_FREE (df->entry_block_defs); BITMAP_FREE (df->exit_block_uses); - BITMAP_FREE (df->insns_to_delete); - BITMAP_FREE (df->insns_to_rescan); - BITMAP_FREE (df->insns_to_notes_rescan); + bitmap_clear (&df->insns_to_delete); + bitmap_clear (&df->insns_to_rescan); + bitmap_clear (&df->insns_to_notes_rescan); free_alloc_pool (df_scan->block_pool); free_alloc_pool (problem_data->ref_base_pool); @@ -392,14 +392,14 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) bb_info->artificial_uses = NULL; } - df->hardware_regs_used = BITMAP_ALLOC (&problem_data->reg_bitmaps); - df->regular_block_artificial_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps); - df->eh_block_artificial_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps); + bitmap_initialize (&df->hardware_regs_used, &problem_data->reg_bitmaps); + bitmap_initialize (&df->regular_block_artificial_uses, &problem_data->reg_bitmaps); + bitmap_initialize (&df->eh_block_artificial_uses, &problem_data->reg_bitmaps); df->entry_block_defs = BITMAP_ALLOC (&problem_data->reg_bitmaps); df->exit_block_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps); - df->insns_to_delete = BITMAP_ALLOC (&problem_data->insn_bitmaps); - df->insns_to_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps); - df->insns_to_notes_rescan = BITMAP_ALLOC (&problem_data->insn_bitmaps); + bitmap_initialize (&df->insns_to_delete, &problem_data->insn_bitmaps); + bitmap_initialize (&df->insns_to_rescan, &problem_data->insn_bitmaps); + bitmap_initialize (&df->insns_to_notes_rescan, &problem_data->insn_bitmaps); df_scan->optional_p = false; } @@ -437,11 +437,11 @@ df_scan_start_dump (FILE *file ATTRIBUTE_UNUSED) fprintf (file, ";; invalidated by call \t"); df_print_regset (file, regs_invalidated_by_call_regset); fprintf (file, ";; hardware regs used \t"); - df_print_regset (file, df->hardware_regs_used); + df_print_regset (file, &df->hardware_regs_used); fprintf (file, ";; regular block artificial uses \t"); - df_print_regset (file, df->regular_block_artificial_uses); + df_print_regset (file, &df->regular_block_artificial_uses); fprintf (file, ";; eh block artificial uses \t"); - df_print_regset (file, df->eh_block_artificial_uses); + df_print_regset (file, &df->eh_block_artificial_uses); fprintf (file, ";; entry block defs \t"); df_print_regset (file, df->entry_block_defs); fprintf (file, ";; exit block uses \t"); @@ -682,11 +682,11 @@ df_scan_blocks (void) df->def_info.ref_order = DF_REF_ORDER_NO_TABLE; df->use_info.ref_order = DF_REF_ORDER_NO_TABLE; - df_get_regular_block_artificial_uses (df->regular_block_artificial_uses); - df_get_eh_block_artificial_uses (df->eh_block_artificial_uses); + df_get_regular_block_artificial_uses (&df->regular_block_artificial_uses); + df_get_eh_block_artificial_uses (&df->eh_block_artificial_uses); - bitmap_ior_into (df->eh_block_artificial_uses, - df->regular_block_artificial_uses); + bitmap_ior_into (&df->eh_block_artificial_uses, + &df->regular_block_artificial_uses); /* ENTRY and EXIT blocks have special defs/uses. */ df_get_entry_block_def_set (df->entry_block_defs); @@ -1140,9 +1140,9 @@ df_insn_delete (basic_block bb, unsigned int uid) { if (insn_info) { - bitmap_clear_bit (df->insns_to_rescan, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); - bitmap_set_bit (df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_rescan, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); + bitmap_set_bit (&df->insns_to_delete, uid); } if (dump_file) fprintf (dump_file, "deferring deletion of insn with uid = %d.\n", uid); @@ -1152,9 +1152,9 @@ df_insn_delete (basic_block bb, unsigned int uid) if (dump_file) fprintf (dump_file, "deleting insn with uid = %d.\n", uid); - bitmap_clear_bit (df->insns_to_delete, uid); - bitmap_clear_bit (df->insns_to_rescan, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); + bitmap_clear_bit (&df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_rescan, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); if (insn_info) { struct df_scan_problem_data *problem_data @@ -1257,9 +1257,9 @@ df_insn_rescan (rtx insn) if (dump_file) fprintf (dump_file, "deferring rescan insn with uid = %d.\n", uid); - bitmap_clear_bit (df->insns_to_delete, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); - bitmap_set_bit (df->insns_to_rescan, INSN_UID (insn)); + bitmap_clear_bit (&df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); + bitmap_set_bit (&df->insns_to_rescan, INSN_UID (insn)); return false; } @@ -1268,9 +1268,9 @@ df_insn_rescan (rtx insn) collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32); collection_rec.mw_vec = VEC_alloc (df_mw_hardreg_ptr, stack, 32); - bitmap_clear_bit (df->insns_to_delete, uid); - bitmap_clear_bit (df->insns_to_rescan, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); + bitmap_clear_bit (&df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_rescan, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); if (insn_info) { int luid; @@ -1337,9 +1337,9 @@ df_insn_rescan_debug_internal (rtx insn) if (dump_file) fprintf (dump_file, "deleting debug_insn with uid = %d.\n", uid); - bitmap_clear_bit (df->insns_to_delete, uid); - bitmap_clear_bit (df->insns_to_rescan, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); + bitmap_clear_bit (&df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_rescan, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); if (!insn_info->defs) return false; @@ -1384,7 +1384,9 @@ df_insn_rescan_all (void) basic_block bb; bitmap_iterator bi; unsigned int uid; - bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head tmp; + + bitmap_initialize (&tmp, &df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1398,18 +1400,18 @@ 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) + 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_delete (NULL, uid); } - BITMAP_FREE (tmp); - bitmap_clear (df->insns_to_delete); - bitmap_clear (df->insns_to_rescan); - bitmap_clear (df->insns_to_notes_rescan); + bitmap_clear (&tmp); + bitmap_clear (&df->insns_to_delete); + bitmap_clear (&df->insns_to_rescan); + bitmap_clear (&df->insns_to_notes_rescan); FOR_EACH_BB (bb) { @@ -1436,7 +1438,9 @@ df_process_deferred_rescans (void) bool defer_insn_rescan = false; bitmap_iterator bi; unsigned int uid; - bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head tmp; + + bitmap_initialize (&tmp, &df_bitmap_obstack); if (df->changeable_flags & DF_NO_INSN_RESCAN) { @@ -1453,24 +1457,24 @@ 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) + 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_delete (NULL, 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) @@ -1480,10 +1484,10 @@ df_process_deferred_rescans (void) if (dump_file) fprintf (dump_file, "ending the processing of deferred insns\n"); - BITMAP_FREE (tmp); - bitmap_clear (df->insns_to_delete); - bitmap_clear (df->insns_to_rescan); - bitmap_clear (df->insns_to_notes_rescan); + bitmap_clear (&tmp); + bitmap_clear (&df->insns_to_delete); + bitmap_clear (&df->insns_to_rescan); + bitmap_clear (&df->insns_to_notes_rescan); if (no_insn_rescan) df_set_flags (DF_NO_INSN_RESCAN); @@ -2194,16 +2198,16 @@ df_notes_rescan (rtx insn) insn_info->mw_hardregs = df_null_mw_rec; } - bitmap_clear_bit (df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_delete, uid); /* If the insn is set to be rescanned, it does not need to also be notes rescanned. */ - if (!bitmap_bit_p (df->insns_to_rescan, uid)) - bitmap_set_bit (df->insns_to_notes_rescan, INSN_UID (insn)); + if (!bitmap_bit_p (&df->insns_to_rescan, uid)) + bitmap_set_bit (&df->insns_to_notes_rescan, INSN_UID (insn)); return; } - bitmap_clear_bit (df->insns_to_delete, uid); - bitmap_clear_bit (df->insns_to_notes_rescan, uid); + bitmap_clear_bit (&df->insns_to_delete, uid); + bitmap_clear_bit (&df->insns_to_notes_rescan, uid); if (insn_info) { @@ -3452,13 +3456,15 @@ df_get_call_refs (struct df_collection_rec * collection_rec, bool is_sibling_call; unsigned int i; df_ref def; - bitmap defs_generated = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head defs_generated; + + bitmap_initialize (&defs_generated, &df_bitmap_obstack); /* Do not generate clobbers for registers that are the result of the call. This causes ordering problems in the chain building code depending on which def is seen first. */ for (i = 0; VEC_iterate (df_ref, collection_rec->def_vec, i, def); ++i) - bitmap_set_bit (defs_generated, DF_REF_REGNO (def)); + bitmap_set_bit (&defs_generated, DF_REF_REGNO (def)); /* Record the registers used to pass arguments, and explicitly noted as clobbered. */ @@ -3474,7 +3480,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, if (REG_P (XEXP (XEXP (note, 0), 0))) { unsigned int regno = REGNO (XEXP (XEXP (note, 0), 0)); - if (!bitmap_bit_p (defs_generated, regno)) + if (!bitmap_bit_p (&defs_generated, regno)) df_defs_record (collection_rec, XEXP (note, 0), bb, insn_info, flags); } @@ -3508,7 +3514,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, ui, bi) { if (!global_regs[ui] - && (!bitmap_bit_p (defs_generated, ui)) + && (!bitmap_bit_p (&defs_generated, ui)) && (!is_sibling_call || !bitmap_bit_p (df->exit_block_uses, ui) || refers_to_regno_p (ui, ui+1, @@ -3519,7 +3525,7 @@ df_get_call_refs (struct df_collection_rec * collection_rec, -1, -1, VOIDmode); } - BITMAP_FREE (defs_generated); + bitmap_clear (&defs_generated); return; } @@ -3670,8 +3676,8 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb) bitmap_iterator bi; unsigned int regno; bitmap au = bb_has_eh_pred (bb) - ? df->eh_block_artificial_uses - : df->regular_block_artificial_uses; + ? &df->eh_block_artificial_uses + : &df->regular_block_artificial_uses; EXECUTE_IF_SET_IN_BITMAP (au, 0, regno, bi) { @@ -3993,13 +3999,14 @@ df_record_entry_block_defs (bitmap entry_block_defs) void df_update_entry_block_defs (void) { - bitmap refs = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head refs; bool changed = false; - df_get_entry_block_def_set (refs); + bitmap_initialize (&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); @@ -4012,17 +4019,18 @@ df_update_entry_block_defs (void) { struct df_scan_problem_data *problem_data = (struct df_scan_problem_data *) df_scan->problem_data; + gcc_unreachable (); df->entry_block_defs = BITMAP_ALLOC (&problem_data->reg_bitmaps); changed = true; } 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 (ENTRY_BLOCK)); } - BITMAP_FREE (refs); + bitmap_clear (&refs); } @@ -4165,13 +4173,14 @@ df_record_exit_block_uses (bitmap exit_block_uses) void df_update_exit_block_uses (void) { - bitmap refs = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head refs; bool changed = false; - df_get_exit_block_use_set (refs); + bitmap_initialize (&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); @@ -4184,17 +4193,18 @@ df_update_exit_block_uses (void) { struct df_scan_problem_data *problem_data = (struct df_scan_problem_data *) df_scan->problem_data; + gcc_unreachable (); df->exit_block_uses = BITMAP_ALLOC (&problem_data->reg_bitmaps); changed = true; } 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 (EXIT_BLOCK)); } - BITMAP_FREE (refs); + bitmap_clear (&refs); } static bool initialized = false; @@ -4550,24 +4560,25 @@ df_bb_verify (basic_block bb) static bool df_entry_block_bitmap_verify (bool abort_if_fail) { - bitmap entry_block_defs = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head entry_block_defs; bool is_eq; - df_get_entry_block_def_set (entry_block_defs); + bitmap_initialize (&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) { print_current_pass (stderr); 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_FREE (entry_block_defs); + bitmap_clear (&entry_block_defs); return is_eq; } @@ -4579,24 +4590,25 @@ df_entry_block_bitmap_verify (bool abort_if_fail) static bool df_exit_block_bitmap_verify (bool abort_if_fail) { - bitmap exit_block_uses = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_head exit_block_uses; bool is_eq; - df_get_exit_block_use_set (exit_block_uses); + bitmap_initialize (&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) { print_current_pass (stderr); 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_FREE (exit_block_uses); + bitmap_clear (&exit_block_uses); return is_eq; } @@ -4610,8 +4622,8 @@ df_scan_verify (void) { unsigned int i; basic_block bb; - bitmap regular_block_artificial_uses; - bitmap eh_block_artificial_uses; + bitmap_head regular_block_artificial_uses; + bitmap_head eh_block_artificial_uses; if (!df) return; @@ -4632,23 +4644,23 @@ 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. */ - regular_block_artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack); - eh_block_artificial_uses = BITMAP_ALLOC (&df_bitmap_obstack); + bitmap_initialize (®ular_block_artificial_uses, &df_bitmap_obstack); + bitmap_initialize (&eh_block_artificial_uses, &df_bitmap_obstack); - df_get_regular_block_artificial_uses (regular_block_artificial_uses); - df_get_eh_block_artificial_uses (eh_block_artificial_uses); + df_get_regular_block_artificial_uses (®ular_block_artificial_uses); + df_get_eh_block_artificial_uses (&eh_block_artificial_uses); - bitmap_ior_into (eh_block_artificial_uses, - regular_block_artificial_uses); + bitmap_ior_into (&eh_block_artificial_uses, + ®ular_block_artificial_uses); /* Check artificial_uses bitmaps didn't change. */ - gcc_assert (bitmap_equal_p (regular_block_artificial_uses, - df->regular_block_artificial_uses)); - gcc_assert (bitmap_equal_p (eh_block_artificial_uses, - df->eh_block_artificial_uses)); + gcc_assert (bitmap_equal_p (®ular_block_artificial_uses, + &df->regular_block_artificial_uses)); + gcc_assert (bitmap_equal_p (&eh_block_artificial_uses, + &df->eh_block_artificial_uses)); - BITMAP_FREE (regular_block_artificial_uses); - BITMAP_FREE (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. */ |