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
This commit is contained in:
Eric Botcazou 2006-02-07 18:04:29 +00:00
parent 0e5264e8ea
commit e45dcf9c6e
3 changed files with 36 additions and 34 deletions

View File

@ -369,9 +369,9 @@ df_set_blocks (struct df *df, bitmap blocks)
for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{
struct dataflow *dflow = df->problems_in_order[p];
if (*dflow->problem->reset_fun)
(*dflow->problem->reset_fun) (dflow, df->blocks_to_analyze);
else if (*dflow->problem->free_bb_fun)
if (dflow->problem->reset_fun)
dflow->problem->reset_fun (dflow, df->blocks_to_analyze);
else if (dflow->problem->free_bb_fun)
{
bitmap_iterator bi;
unsigned int bb_index;
@ -381,7 +381,7 @@ df_set_blocks (struct df *df, bitmap blocks)
basic_block bb = BASIC_BLOCK (bb_index);
if (bb)
{
(*dflow->problem->free_bb_fun)
dflow->problem->free_bb_fun
(dflow, bb, df_get_bb_info (dflow, bb_index));
df_set_bb_info (dflow, bb_index, NULL);
}
@ -403,7 +403,7 @@ df_set_blocks (struct df *df, bitmap blocks)
for (p = df->num_problems_defined - 1; p >= 0 ;p--)
{
struct dataflow *dflow = df->problems_in_order[p];
if (*dflow->problem->reset_fun)
if (dflow->problem->reset_fun)
{
if (!blocks_to_reset)
{
@ -414,7 +414,7 @@ df_set_blocks (struct df *df, bitmap blocks)
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)
@ -444,7 +444,7 @@ df_finish1 (struct df *df)
int 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);
}
@ -479,12 +479,12 @@ df_hybrid_search_forward (basic_block bb,
if (!TEST_BIT (dataflow->considered, e->src->index))
continue;
(*dataflow->problem->con_fun_n) (dataflow, e);
dataflow->problem->con_fun_n (dataflow, e);
}
else if (*dataflow->problem->con_fun_0)
(*dataflow->problem->con_fun_0) (dataflow, bb);
else if (dataflow->problem->con_fun_0)
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)
return;
@ -531,12 +531,12 @@ df_hybrid_search_backward (basic_block bb,
if (!TEST_BIT (dataflow->considered, e->dest->index))
continue;
(*dataflow->problem->con_fun_n) (dataflow, e);
dataflow->problem->con_fun_n (dataflow, e);
}
else if (*dataflow->problem->con_fun_0)
(*dataflow->problem->con_fun_0) (dataflow, bb);
else if (dataflow->problem->con_fun_0)
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)
return;
@ -605,7 +605,7 @@ df_iterative_dataflow (struct dataflow *dataflow,
SET_BIT (pending, idx);
};
(*dataflow->problem->init_fun) (dataflow, blocks_to_init);
dataflow->problem->init_fun (dataflow, blocks_to_init);
while (1)
{
@ -704,24 +704,24 @@ df_analyze_problem (struct dataflow *dflow,
int *postorder, int n_blocks, bool single_pass)
{
/* (Re)Allocate the datastructures necessary to solve the problem. */
if (*dflow->problem->alloc_fun)
(*dflow->problem->alloc_fun) (dflow, blocks_to_scan);
if (dflow->problem->alloc_fun)
dflow->problem->alloc_fun (dflow, blocks_to_scan);
/* Set up the problem and compute the local information. This
function is passed both the blocks_to_consider and the
blocks_to_scan because the RD and RU problems require the entire
function to be rescanned if they are going to be updated. */
if (*dflow->problem->local_compute_fun)
(*dflow->problem->local_compute_fun) (dflow, blocks_to_consider, blocks_to_scan);
if (dflow->problem->local_compute_fun)
dflow->problem->local_compute_fun (dflow, blocks_to_consider, blocks_to_scan);
/* Solve the equations. */
if (*dflow->problem->dataflow_fun)
(*dflow->problem->dataflow_fun) (dflow, blocks_to_consider, blocks_to_init,
postorder, n_blocks, single_pass);
if (dflow->problem->dataflow_fun)
dflow->problem->dataflow_fun (dflow, blocks_to_consider, blocks_to_init,
postorder, n_blocks, single_pass);
/* Massage the solution. */
if (*dflow->problem->finalize_fun)
(*dflow->problem->finalize_fun) (dflow, blocks_to_consider);
if (dflow->problem->finalize_fun)
dflow->problem->finalize_fun (dflow, blocks_to_consider);
}
@ -825,7 +825,7 @@ df_compact_blocks (struct df *df)
for (p = 0; p < df->num_problems_defined; 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);
memcpy (problem_temps, dflow->block_info, size);
@ -849,7 +849,7 @@ df_compact_blocks (struct df *df)
{
basic_block bb = BASIC_BLOCK (i);
if (problem_temps[i] && bb)
(*dflow->problem->free_bb_fun)
dflow->problem->free_bb_fun
(dflow, bb, problem_temps[i]);
}
}
@ -1063,7 +1063,7 @@ df_dump (struct df *df, FILE *file)
df->def_info.bitmap_size, df->use_info.bitmap_size);
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");
}

View File

@ -453,7 +453,7 @@ df_rescan_blocks (struct df *df, bitmap blocks)
for (i = df->num_problems_defined; i; i--)
{
bitmap blocks_to_reset = NULL;
if (*dflow->problem->reset_fun)
if (dflow->problem->reset_fun)
{
if (!blocks_to_reset)
{
@ -462,7 +462,7 @@ df_rescan_blocks (struct df *df, bitmap blocks)
if (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)
BITMAP_FREE (blocks_to_reset);
@ -1804,7 +1804,7 @@ df_record_entry_block_defs (struct dataflow * dflow)
#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)
{

View File

@ -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\
optimizing. */\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);
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
@ -181,6 +181,7 @@ write_writer (void)
" unsigned int i;\n"
" const char *p;\n"
" puts (\"(define_conditions [\");\n"
"#if GCC_VERSION >= 3001\n"
" for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
" {\n"
" printf (\" (%d \\\"\", insn_conditions[i].value);\n"
@ -196,6 +197,7 @@ write_writer (void)
" }\n"
" puts (\"\\\")\");\n"
" }\n"
"#endif /* gcc >= 3.0.1 */\n"
" puts (\"])\");\n"
" fflush (stdout);\n"
"return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"