Commit e45dcf9c by Eric Botcazou

df-core.c (df_set_blocks): Do not dereference function pointers.

	* df-core.c (df_set_blocks): Do not dereference function pointers.
	(df_finish1): Likewise.
	(df_hybrid_search_forward): Likewise.
	(df_hybrid_search_backward): Likewise.
	(df_iterative_dataflow): Likewise.
	(df_analyze_problem): Likewise.
	(df_compact_blocks): Likewise.
	(df_dump): Likewise.
	* df-scan.c (df_rescan_blocks): Likewise.
	(df_record_entry_block_defs): Likewise.

	* genconditions.c (write_conditions): Guard the definition of
	'insn_conditions' with the check on GCC version.
	(write_writer): Guard the traversal 'insn_conditions' with
	the check on GCC version.

From-SVN: r110702
parent 0e5264e8
...@@ -369,9 +369,9 @@ df_set_blocks (struct df *df, bitmap blocks) ...@@ -369,9 +369,9 @@ df_set_blocks (struct df *df, bitmap blocks)
for (p = df->num_problems_defined - 1; p >= 0 ;p--) for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{ {
struct dataflow *dflow = df->problems_in_order[p]; struct dataflow *dflow = df->problems_in_order[p];
if (*dflow->problem->reset_fun) if (dflow->problem->reset_fun)
(*dflow->problem->reset_fun) (dflow, df->blocks_to_analyze); dflow->problem->reset_fun (dflow, df->blocks_to_analyze);
else if (*dflow->problem->free_bb_fun) else if (dflow->problem->free_bb_fun)
{ {
bitmap_iterator bi; bitmap_iterator bi;
unsigned int bb_index; unsigned int bb_index;
...@@ -381,7 +381,7 @@ df_set_blocks (struct df *df, bitmap blocks) ...@@ -381,7 +381,7 @@ df_set_blocks (struct df *df, bitmap blocks)
basic_block bb = BASIC_BLOCK (bb_index); basic_block bb = BASIC_BLOCK (bb_index);
if (bb) if (bb)
{ {
(*dflow->problem->free_bb_fun) dflow->problem->free_bb_fun
(dflow, bb, df_get_bb_info (dflow, bb_index)); (dflow, bb, df_get_bb_info (dflow, bb_index));
df_set_bb_info (dflow, bb_index, NULL); df_set_bb_info (dflow, bb_index, NULL);
} }
...@@ -403,7 +403,7 @@ df_set_blocks (struct df *df, bitmap blocks) ...@@ -403,7 +403,7 @@ df_set_blocks (struct df *df, bitmap blocks)
for (p = df->num_problems_defined - 1; p >= 0 ;p--) for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{ {
struct dataflow *dflow = df->problems_in_order[p]; struct dataflow *dflow = df->problems_in_order[p];
if (*dflow->problem->reset_fun) if (dflow->problem->reset_fun)
{ {
if (!blocks_to_reset) if (!blocks_to_reset)
{ {
...@@ -414,7 +414,7 @@ df_set_blocks (struct df *df, bitmap blocks) ...@@ -414,7 +414,7 @@ df_set_blocks (struct df *df, bitmap blocks)
bitmap_set_bit (blocks_to_reset, bb->index); bitmap_set_bit (blocks_to_reset, bb->index);
} }
} }
(*dflow->problem->reset_fun) (dflow, blocks_to_reset); dflow->problem->reset_fun (dflow, blocks_to_reset);
} }
} }
if (blocks_to_reset) if (blocks_to_reset)
...@@ -444,7 +444,7 @@ df_finish1 (struct df *df) ...@@ -444,7 +444,7 @@ df_finish1 (struct df *df)
int i; int i;
for (i = 0; i < df->num_problems_defined; i++) for (i = 0; i < df->num_problems_defined; i++)
(*df->problems_in_order[i]->problem->free_fun) (df->problems_in_order[i]); df->problems_in_order[i]->problem->free_fun (df->problems_in_order[i]);
free (df); free (df);
} }
...@@ -479,12 +479,12 @@ df_hybrid_search_forward (basic_block bb, ...@@ -479,12 +479,12 @@ df_hybrid_search_forward (basic_block bb,
if (!TEST_BIT (dataflow->considered, e->src->index)) if (!TEST_BIT (dataflow->considered, e->src->index))
continue; continue;
(*dataflow->problem->con_fun_n) (dataflow, e); dataflow->problem->con_fun_n (dataflow, e);
} }
else if (*dataflow->problem->con_fun_0) else if (dataflow->problem->con_fun_0)
(*dataflow->problem->con_fun_0) (dataflow, bb); dataflow->problem->con_fun_0 (dataflow, bb);
result_changed = (*dataflow->problem->trans_fun) (dataflow, i); result_changed = dataflow->problem->trans_fun (dataflow, i);
if (!result_changed || single_pass) if (!result_changed || single_pass)
return; return;
...@@ -531,12 +531,12 @@ df_hybrid_search_backward (basic_block bb, ...@@ -531,12 +531,12 @@ df_hybrid_search_backward (basic_block bb,
if (!TEST_BIT (dataflow->considered, e->dest->index)) if (!TEST_BIT (dataflow->considered, e->dest->index))
continue; continue;
(*dataflow->problem->con_fun_n) (dataflow, e); dataflow->problem->con_fun_n (dataflow, e);
} }
else if (*dataflow->problem->con_fun_0) else if (dataflow->problem->con_fun_0)
(*dataflow->problem->con_fun_0) (dataflow, bb); dataflow->problem->con_fun_0 (dataflow, bb);
result_changed = (*dataflow->problem->trans_fun) (dataflow, i); result_changed = dataflow->problem->trans_fun (dataflow, i);
if (!result_changed || single_pass) if (!result_changed || single_pass)
return; return;
...@@ -605,7 +605,7 @@ df_iterative_dataflow (struct dataflow *dataflow, ...@@ -605,7 +605,7 @@ df_iterative_dataflow (struct dataflow *dataflow,
SET_BIT (pending, idx); SET_BIT (pending, idx);
}; };
(*dataflow->problem->init_fun) (dataflow, blocks_to_init); dataflow->problem->init_fun (dataflow, blocks_to_init);
while (1) while (1)
{ {
...@@ -704,24 +704,24 @@ df_analyze_problem (struct dataflow *dflow, ...@@ -704,24 +704,24 @@ df_analyze_problem (struct dataflow *dflow,
int *postorder, int n_blocks, bool single_pass) int *postorder, int n_blocks, bool single_pass)
{ {
/* (Re)Allocate the datastructures necessary to solve the problem. */ /* (Re)Allocate the datastructures necessary to solve the problem. */
if (*dflow->problem->alloc_fun) if (dflow->problem->alloc_fun)
(*dflow->problem->alloc_fun) (dflow, blocks_to_scan); dflow->problem->alloc_fun (dflow, blocks_to_scan);
/* Set up the problem and compute the local information. This /* Set up the problem and compute the local information. This
function is passed both the blocks_to_consider and the function is passed both the blocks_to_consider and the
blocks_to_scan because the RD and RU problems require the entire blocks_to_scan because the RD and RU problems require the entire
function to be rescanned if they are going to be updated. */ function to be rescanned if they are going to be updated. */
if (*dflow->problem->local_compute_fun) if (dflow->problem->local_compute_fun)
(*dflow->problem->local_compute_fun) (dflow, blocks_to_consider, blocks_to_scan); dflow->problem->local_compute_fun (dflow, blocks_to_consider, blocks_to_scan);
/* Solve the equations. */ /* Solve the equations. */
if (*dflow->problem->dataflow_fun) if (dflow->problem->dataflow_fun)
(*dflow->problem->dataflow_fun) (dflow, blocks_to_consider, blocks_to_init, dflow->problem->dataflow_fun (dflow, blocks_to_consider, blocks_to_init,
postorder, n_blocks, single_pass); postorder, n_blocks, single_pass);
/* Massage the solution. */ /* Massage the solution. */
if (*dflow->problem->finalize_fun) if (dflow->problem->finalize_fun)
(*dflow->problem->finalize_fun) (dflow, blocks_to_consider); dflow->problem->finalize_fun (dflow, blocks_to_consider);
} }
...@@ -825,7 +825,7 @@ df_compact_blocks (struct df *df) ...@@ -825,7 +825,7 @@ df_compact_blocks (struct df *df)
for (p = 0; p < df->num_problems_defined; p++) for (p = 0; p < df->num_problems_defined; p++)
{ {
struct dataflow *dflow = df->problems_in_order[p]; struct dataflow *dflow = df->problems_in_order[p];
if (*dflow->problem->free_bb_fun) if (dflow->problem->free_bb_fun)
{ {
df_grow_bb_info (dflow); df_grow_bb_info (dflow);
memcpy (problem_temps, dflow->block_info, size); memcpy (problem_temps, dflow->block_info, size);
...@@ -849,7 +849,7 @@ df_compact_blocks (struct df *df) ...@@ -849,7 +849,7 @@ df_compact_blocks (struct df *df)
{ {
basic_block bb = BASIC_BLOCK (i); basic_block bb = BASIC_BLOCK (i);
if (problem_temps[i] && bb) if (problem_temps[i] && bb)
(*dflow->problem->free_bb_fun) dflow->problem->free_bb_fun
(dflow, bb, problem_temps[i]); (dflow, bb, problem_temps[i]);
} }
} }
...@@ -1063,7 +1063,7 @@ df_dump (struct df *df, FILE *file) ...@@ -1063,7 +1063,7 @@ df_dump (struct df *df, FILE *file)
df->def_info.bitmap_size, df->use_info.bitmap_size); df->def_info.bitmap_size, df->use_info.bitmap_size);
for (i = 0; i < df->num_problems_defined; i++) for (i = 0; i < df->num_problems_defined; i++)
(*df->problems_in_order[i]->problem->dump_fun) (df->problems_in_order[i], file); df->problems_in_order[i]->problem->dump_fun (df->problems_in_order[i], file);
fprintf (file, "\n"); fprintf (file, "\n");
} }
......
...@@ -453,7 +453,7 @@ df_rescan_blocks (struct df *df, bitmap blocks) ...@@ -453,7 +453,7 @@ df_rescan_blocks (struct df *df, bitmap blocks)
for (i = df->num_problems_defined; i; i--) for (i = df->num_problems_defined; i; i--)
{ {
bitmap blocks_to_reset = NULL; bitmap blocks_to_reset = NULL;
if (*dflow->problem->reset_fun) if (dflow->problem->reset_fun)
{ {
if (!blocks_to_reset) if (!blocks_to_reset)
{ {
...@@ -462,7 +462,7 @@ df_rescan_blocks (struct df *df, bitmap blocks) ...@@ -462,7 +462,7 @@ df_rescan_blocks (struct df *df, bitmap blocks)
if (df->blocks_to_scan) if (df->blocks_to_scan)
bitmap_ior_into (blocks_to_reset, df->blocks_to_scan); bitmap_ior_into (blocks_to_reset, df->blocks_to_scan);
} }
(*dflow->problem->reset_fun) (dflow, blocks_to_reset); dflow->problem->reset_fun (dflow, blocks_to_reset);
} }
if (blocks_to_reset) if (blocks_to_reset)
BITMAP_FREE (blocks_to_reset); BITMAP_FREE (blocks_to_reset);
...@@ -1804,7 +1804,7 @@ df_record_entry_block_defs (struct dataflow * dflow) ...@@ -1804,7 +1804,7 @@ df_record_entry_block_defs (struct dataflow * dflow)
#endif #endif
} }
(*targetm.live_on_entry) (df->entry_block_defs); targetm.live_on_entry (df->entry_block_defs);
EXECUTE_IF_SET_IN_BITMAP (df->entry_block_defs, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (df->entry_block_defs, 0, i, bi)
{ {
......
...@@ -160,12 +160,12 @@ struct c_test\n\ ...@@ -160,12 +160,12 @@ struct c_test\n\
vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\ vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\
optimizing. */\n\ optimizing. */\n\
\n\ \n\
static const struct c_test insn_conditions[] = {\n\ #if GCC_VERSION >= 3001\n\
#if GCC_VERSION >= 3001\n"); static const struct c_test insn_conditions[] = {\n");
traverse_c_tests (write_one_condition, 0); traverse_c_tests (write_one_condition, 0);
puts ("\n#endif /* gcc >= 3.0.1 */\n};\n"); puts ("\n};\n#endif /* gcc >= 3.0.1 */\n");
} }
/* Emit code which will convert the C-format table to a /* Emit code which will convert the C-format table to a
...@@ -181,6 +181,7 @@ write_writer (void) ...@@ -181,6 +181,7 @@ write_writer (void)
" unsigned int i;\n" " unsigned int i;\n"
" const char *p;\n" " const char *p;\n"
" puts (\"(define_conditions [\");\n" " puts (\"(define_conditions [\");\n"
"#if GCC_VERSION >= 3001\n"
" for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n" " for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
" {\n" " {\n"
" printf (\" (%d \\\"\", insn_conditions[i].value);\n" " printf (\" (%d \\\"\", insn_conditions[i].value);\n"
...@@ -196,6 +197,7 @@ write_writer (void) ...@@ -196,6 +197,7 @@ write_writer (void)
" }\n" " }\n"
" puts (\"\\\")\");\n" " puts (\"\\\")\");\n"
" }\n" " }\n"
"#endif /* gcc >= 3.0.1 */\n"
" puts (\"])\");\n" " puts (\"])\");\n"
" fflush (stdout);\n" " fflush (stdout);\n"
"return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n" "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment