summaryrefslogtreecommitdiff
path: root/gcc/df-core.c
diff options
context:
space:
mode:
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-19 19:04:52 +0000
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-19 19:04:52 +0000
commitdeb2741b38fe5c3702de0139b72df56eb72ebe35 (patch)
treefa9997fc4e323fc1d4610bbda7d845966152ff14 /gcc/df-core.c
parenta650636a6229f762a28f3316815082c269a10e7e (diff)
downloadgcc-deb2741b38fe5c3702de0139b72df56eb72ebe35.tar.gz
2007-06-15 Kenneth Zadeck <zadeck@naturalbridge.com>
* df.h (DF_FIRST_OPTIONAL_PROBLEM): Removed. (struct df_problem.free_blocks_on_set_blocks): New field. (struct dataflow.optional_p): New field. (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed. (df_live_set_all_dirty): New function. * df-scan.c (df_scan_alloc): Initialize optional_p. (problem_SCAN): Initialize free_blocks_on_set_blocks. * df-core.c (df_set_blocks): Removed use of DF_FIRST_OPTIONAL_PROBLEM. Now uses df_problem.free_blocks_on_set_blocks to determine which blocks are recycled. (df_remove_problem): Removed use of DF_FIRST_OPTIONAL_PROBLEM. (df_finish_pass): Removed use of DF_FIRST_OPTIONAL_PROBLEM. Now uses dataflow.optional_p to determine if problem should be deleted. (rest_of_handle_df_initialize): Only start live problem if -02 or above. (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed. * df-problems.c (df_ru_alloc, df_rd_alloc, df_lr_alloc, df_live_alloc, df_urec_alloc, df_note_alloc): set optional_p. (problem_RU, problem_RD, problem_LR, problem_UREC, problem_CHAIN, problem_NOTE): Initialize free_blocks_on_set_blocks. (df_lr_bb_local_compute): Recompute luids if df_live problem is not active. (df_live_set_all_dirty, df_note_alloc): New function. * regrename.c (merge_overlapping_regs): Change DF_LIVE_* to df_get_live_*. * sched_ebb.c (compute_jump_reg_dependencies): Ditto. * postreload.c (reload_combine): Ditto. * cse.c (cse_extended_basic_block): Ditto. * regmove.c (mark_flags_life_zones): Ditto. * rtlfactoring.c (split_blocks_after_seqs, split_pattern_seq, erase_matching_seqs): Ditto. * bt-load.c (compute_defs_uses_and_gen): Ditto. * integrate (allocate_initial_values): Ditto. * combine.c (reg_dead_at_p): Ditto. * resource.c (mark_target_live_regs): Ditto. * sched-rgn.c (check_live_1, update_live_1): Ditto. * config/sh/sh.c (find_r0_life_regions): Ditto. * global.c (rest_of_handle_global_alloc): Only add back df_live for -O > 1. * local-alloc.c (rest_of_handle_local_alloc): Only remove df_live for -O > 1. * ifcvt.c (dead_or_predicable): Change DF_LIVE_* to df_get_live_*. (if_convert): Make sure df_live is there at -O == 1. (pass_if_after_combine): Cleanup flags. * init-regs.c (initialize_uninitialized_regs): Make sure df_live is there at -O == 1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125857 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df-core.c')
-rw-r--r--gcc/df-core.c129
1 files changed, 37 insertions, 92 deletions
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 67a4040d50e..deca8758530 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -506,15 +506,17 @@ df_set_blocks (bitmap blocks)
bitmap_print (dump_file, blocks, "setting blocks to analyze ", "\n");
if (df->blocks_to_analyze)
{
+ /* This block is called to change the focus from one subset
+ to another. */
int p;
bitmap diff = BITMAP_ALLOC (&df_bitmap_obstack);
bitmap_and_compl (diff, df->blocks_to_analyze, blocks);
- for (p = df->num_problems_defined - 1; p >= DF_FIRST_OPTIONAL_PROBLEM ;p--)
+ for (p = 0; p < df->num_problems_defined; p++)
{
struct dataflow *dflow = df->problems_in_order[p];
- if (dflow->problem->reset_fun)
+ if (dflow->optional_p && dflow->problem->reset_fun)
dflow->problem->reset_fun (df->blocks_to_analyze);
- else if (dflow->problem->free_bb_fun)
+ else if (dflow->problem->free_blocks_on_set_blocks)
{
bitmap_iterator bi;
unsigned int bb_index;
@@ -539,33 +541,31 @@ df_set_blocks (bitmap blocks)
}
else
{
- /* If we have not actually run scanning before, do not try
- to clear anything. */
- if (df_scan->problem_data)
+ /* This block of code is executed to change the focus from
+ the entire function to a subset. */
+ bitmap blocks_to_reset = NULL;
+ int p;
+ for (p = 0; p < df->num_problems_defined; p++)
{
- bitmap blocks_to_reset = NULL;
- int p;
- for (p = df->num_problems_defined - 1; p >= DF_FIRST_OPTIONAL_PROBLEM ;p--)
+ struct dataflow *dflow = df->problems_in_order[p];
+ if (dflow->optional_p && dflow->problem->reset_fun)
{
- struct dataflow *dflow = df->problems_in_order[p];
- if (dflow->problem->reset_fun)
+ if (!blocks_to_reset)
{
- if (!blocks_to_reset)
+ basic_block bb;
+ blocks_to_reset =
+ BITMAP_ALLOC (&df_bitmap_obstack);
+ FOR_ALL_BB(bb)
{
- basic_block bb;
- blocks_to_reset =
- BITMAP_ALLOC (&df_bitmap_obstack);
- FOR_ALL_BB(bb)
- {
- bitmap_set_bit (blocks_to_reset, bb->index);
- }
+ bitmap_set_bit (blocks_to_reset, bb->index);
}
- dflow->problem->reset_fun (blocks_to_reset);
}
+ dflow->problem->reset_fun (blocks_to_reset);
}
- if (blocks_to_reset)
- BITMAP_FREE (blocks_to_reset);
}
+ if (blocks_to_reset)
+ BITMAP_FREE (blocks_to_reset);
+
df->blocks_to_analyze = BITMAP_ALLOC (&df_bitmap_obstack);
}
bitmap_copy (df->blocks_to_analyze, blocks);
@@ -573,8 +573,10 @@ df_set_blocks (bitmap blocks)
}
else
{
+ /* This block is executed to reset the focus to the entire
+ function. */
if (dump_file)
- fprintf (dump_file, "clearing blocks to analyze\n");
+ fprintf (dump_file, "clearing blocks_to_analyze\n");
if (df->blocks_to_analyze)
{
BITMAP_FREE (df->blocks_to_analyze);
@@ -599,7 +601,6 @@ df_remove_problem (struct dataflow *dflow)
{
struct df_problem *problem;
int i;
- int start = 0;
if (!dflow)
return;
@@ -607,18 +608,13 @@ df_remove_problem (struct dataflow *dflow)
problem = dflow->problem;
gcc_assert (problem->remove_problem_fun);
- /* Normally only optional problems are removed, but during global,
- we remove ur and live and replace it with urec. */
- if (problem->id >= DF_FIRST_OPTIONAL_PROBLEM)
- start = DF_FIRST_OPTIONAL_PROBLEM;
-
/* Delete any problems that depended on this problem first. */
- for (i = start; i < df->num_problems_defined; i++)
+ for (i = 0; i < df->num_problems_defined; i++)
if (df->problems_in_order[i]->problem->dependent_problem == problem)
df_remove_problem (df->problems_in_order[i]);
/* Now remove this problem. */
- for (i = start; i < df->num_problems_defined; i++)
+ for (i = 0; i < df->num_problems_defined; i++)
if (df->problems_in_order[i] == dflow)
{
int j;
@@ -658,16 +654,19 @@ df_finish_pass (void)
saved_flags = df->changeable_flags;
#endif
- for (i = DF_FIRST_OPTIONAL_PROBLEM; i < df->num_problems_defined; i++)
+ for (i = 0; i < df->num_problems_defined; i++)
{
struct dataflow *dflow = df->problems_in_order[i];
struct df_problem *problem = dflow->problem;
- gcc_assert (problem->remove_problem_fun);
- (problem->remove_problem_fun) ();
- df->problems_in_order[i] = NULL;
- df->problems_by_index[problem->id] = NULL;
- removed++;
+ if (dflow->optional_p)
+ {
+ gcc_assert (problem->remove_problem_fun);
+ (problem->remove_problem_fun) ();
+ df->problems_in_order[i] = NULL;
+ df->problems_by_index[problem->id] = NULL;
+ removed++;
+ }
}
df->num_problems_defined -= removed;
@@ -720,7 +719,7 @@ rest_of_handle_df_initialize (void)
/* These three problems are permanent. */
df_lr_add_problem ();
- if (optimize)
+ if (optimize > 1)
df_live_add_problem ();
df->postorder = XNEWVEC (int, last_basic_block);
@@ -1600,40 +1599,6 @@ df_set_clean_cfg (void)
----------------------------------------------------------------------------*/
-/* Return last use of REGNO within BB. */
-
-struct df_ref *
-df_bb_regno_last_use_find (basic_block bb, unsigned int regno)
-{
- rtx insn;
- struct df_ref **use_rec;
- unsigned int uid;
-
- FOR_BB_INSNS_REVERSE (bb, insn)
- {
- if (!INSN_P (insn))
- continue;
-
- uid = INSN_UID (insn);
- for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
- {
- struct df_ref *use = *use_rec;
- if (DF_REF_REGNO (use) == regno)
- return use;
- }
-
- if (df->changeable_flags & DF_EQ_NOTES)
- for (use_rec = DF_INSN_UID_EQ_USES (uid); *use_rec; use_rec++)
- {
- struct df_ref *use = *use_rec;
- if (DF_REF_REGNO (use) == regno)
- return use;
- }
- }
- return NULL;
-}
-
-
/* Return first def of REGNO within BB. */
struct df_ref *
@@ -1686,26 +1651,6 @@ df_bb_regno_last_def_find (basic_block bb, unsigned int regno)
return NULL;
}
-/* Return true if INSN defines REGNO. */
-
-bool
-df_insn_regno_def_p (rtx insn, unsigned int regno)
-{
- unsigned int uid;
- struct df_ref **def_rec;
-
- uid = INSN_UID (insn);
- for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
- {
- struct df_ref *def = *def_rec;
- if (DF_REF_REGNO (def) == regno)
- return true;
- }
-
- return false;
-}
-
-
/* Finds the reference corresponding to the definition of REG in INSN.
DF is the dataflow object. */