diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/df-core.c | 8 | ||||
-rw-r--r-- | gcc/df-problems.c | 61 |
3 files changed, 46 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1b819a..3c9819e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2010-06-07 Jan Hubicka <jh@suse.cz> + * df-problems.c (df_lr_problem_data): Add lr_bitmaps. + (df_lr_alloc): Initialize problem data; move bitmaps to + lr_bitmaps obstack. + (df_lr_finalize): Free problem data; do not bother to free bitmaps. + (df_lr_verify_solution_start): Do not initialize problem data; + allocate bitmaps in lr_bitmaps. + (df_lr_verify_solution_end): Do not free problem data. + +2010-06-07 Jan Hubicka <jh@suse.cz> + * cgraph.c (cgraph_edge_cannot_lead_to_return): Also check if caller is noreturn. * ipa-reference.c (analyze_function): Use ipa_ref_cannot_lead_to_return diff --git a/gcc/df-core.c b/gcc/df-core.c index 8c4b79b..6c9f5c9 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -1084,15 +1084,15 @@ df_analyze_problem (struct dataflow *dflow, { timevar_push (dflow->problem->tv_id); + /* (Re)Allocate the datastructures necessary to solve the problem. */ + if (dflow->problem->alloc_fun) + dflow->problem->alloc_fun (blocks_to_consider); + #ifdef ENABLE_DF_CHECKING if (dflow->problem->verify_start_fun) dflow->problem->verify_start_fun (); #endif - /* (Re)Allocate the datastructures necessary to solve the problem. */ - if (dflow->problem->alloc_fun) - dflow->problem->alloc_fun (blocks_to_consider); - /* Set up the problem and compute the local information. */ if (dflow->problem->local_compute_fun) dflow->problem->local_compute_fun (blocks_to_consider); diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 2c76d01..f11b251 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -734,6 +734,8 @@ struct df_lr_problem_data { bitmap_head *in; bitmap_head *out; + /* An obstack for the bitmaps we need for this problem. */ + bitmap_obstack lr_bitmaps; }; @@ -775,12 +777,24 @@ df_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) { unsigned int bb_index; bitmap_iterator bi; + struct df_lr_problem_data *problem_data; if (!df_lr->block_pool) df_lr->block_pool = create_alloc_pool ("df_lr_block pool", sizeof (struct df_lr_bb_info), 50); df_grow_bb_info (df_lr); + if (df_lr->problem_data) + problem_data = (struct df_lr_problem_data *) df_lr->problem_data; + else + { + problem_data = XNEW (struct df_lr_problem_data); + df_lr->problem_data = problem_data; + + problem_data->out = NULL; + problem_data->in = NULL; + bitmap_obstack_initialize (&problem_data->lr_bitmaps); + } EXECUTE_IF_SET_IN_BITMAP (df_lr->out_of_date_transfer_functions, 0, bb_index, bi) { @@ -794,10 +808,10 @@ df_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED) { bb_info = (struct df_lr_bb_info *) pool_alloc (df_lr->block_pool); df_lr_set_bb_info (bb_index, bb_info); - bitmap_initialize (&bb_info->use, &bitmap_default_obstack); - bitmap_initialize (&bb_info->def, &bitmap_default_obstack); - bitmap_initialize (&bb_info->in, &bitmap_default_obstack); - bitmap_initialize (&bb_info->out, &bitmap_default_obstack); + bitmap_initialize (&bb_info->use, &problem_data->lr_bitmaps); + bitmap_initialize (&bb_info->def, &problem_data->lr_bitmaps); + bitmap_initialize (&bb_info->in, &problem_data->lr_bitmaps); + bitmap_initialize (&bb_info->out, &problem_data->lr_bitmaps); } } @@ -1073,24 +1087,17 @@ df_lr_finalize (bitmap all_blocks) static void df_lr_free (void) { + struct df_lr_problem_data *problem_data + = (struct df_lr_problem_data *) df_lr->problem_data; if (df_lr->block_info) { - unsigned int i; - for (i = 0; i < df_lr->block_info_size; i++) - { - struct df_lr_bb_info *bb_info = df_lr_get_bb_info (i); - if (bb_info) - { - bitmap_clear (&bb_info->use); - bitmap_clear (&bb_info->def); - bitmap_clear (&bb_info->in); - bitmap_clear (&bb_info->out); - } - } free_alloc_pool (df_lr->block_pool); df_lr->block_info_size = 0; free (df_lr->block_info); + bitmap_obstack_release (&problem_data->lr_bitmaps); + free (df_lr->problem_data); + df_lr->problem_data = NULL; } BITMAP_FREE (df_lr->out_of_date_transfer_functions); @@ -1153,23 +1160,19 @@ df_lr_verify_solution_start (void) basic_block bb; struct df_lr_problem_data *problem_data; if (df_lr->solutions_dirty) - { - df_lr->problem_data = NULL; - return; - } + return; /* Set it true so that the solution is recomputed. */ df_lr->solutions_dirty = true; - problem_data = XNEW (struct df_lr_problem_data); - df_lr->problem_data = problem_data; + problem_data = (struct df_lr_problem_data *)df_lr->problem_data; problem_data->in = XNEWVEC (bitmap_head, last_basic_block); problem_data->out = XNEWVEC (bitmap_head, last_basic_block); FOR_ALL_BB (bb) { - bitmap_initialize (&problem_data->in[bb->index], &bitmap_default_obstack); - bitmap_initialize (&problem_data->out[bb->index], &bitmap_default_obstack); + bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps); + bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps); bitmap_copy (&problem_data->in[bb->index], DF_LR_IN (bb)); bitmap_copy (&problem_data->out[bb->index], DF_LR_OUT (bb)); } @@ -1185,11 +1188,11 @@ df_lr_verify_solution_end (void) struct df_lr_problem_data *problem_data; basic_block bb; - if (df_lr->problem_data == NULL) - return; - problem_data = (struct df_lr_problem_data *)df_lr->problem_data; + if (!problem_data->out) + return; + if (df_lr->solutions_dirty) /* Do not check if the solution is still dirty. See the comment in df_lr_finalize for details. */ @@ -1215,8 +1218,8 @@ df_lr_verify_solution_end (void) free (problem_data->in); free (problem_data->out); - free (problem_data); - df_lr->problem_data = NULL; + problem_data->in = NULL; + problem_data->out = NULL; } |