Commit a930a4ef by Jan Hubicka Committed by Jan Hubicka

basic-block.h (FOR_ALL_BB_FN): New macro.


	* basic-block.h (FOR_ALL_BB_FN): New macro.
	(init_flow): Initialize cfg structure.
	* function.c (allocate_struct_function): Do not initialize cfg structure.
	* tree-cfg.c (init_empty_tree_cfg): Break out from ...
	(build_tree_cfg): ... here.
	* tree-flow.h (init_empty_tree_cfg): Declare.

From-SVN: r99633
parent 0995a441
2005-05-13 Jan Hubicka <jh@suse.cz>
* basic-block.h (FOR_ALL_BB_FN): New macro.
(init_flow): Initialize cfg structure.
* function.c (allocate_struct_function): Do not initialize cfg structure.
* tree-cfg.c (init_empty_tree_cfg): Break out from ...
(build_tree_cfg): ... here.
* tree-flow.h (init_empty_tree_cfg): Declare.
2005-05-12 Steven Bosscher <stevenb@suse.de> 2005-05-12 Steven Bosscher <stevenb@suse.de>
Fix PR tree-optimization/21520 Fix PR tree-optimization/21520
......
...@@ -444,6 +444,9 @@ extern bool rediscover_loops_after_threading; ...@@ -444,6 +444,9 @@ extern bool rediscover_loops_after_threading;
#define FOR_ALL_BB(BB) \ #define FOR_ALL_BB(BB) \
for (BB = ENTRY_BLOCK_PTR; BB; BB = BB->next_bb) for (BB = ENTRY_BLOCK_PTR; BB; BB = BB->next_bb)
#define FOR_ALL_BB_FN(BB, FN) \
for (BB = ENTRY_BLOCK_PTR_FOR_FUNCTION (FN); BB; BB = BB->next_bb)
/* Special labels found during CFG build. */ /* Special labels found during CFG build. */
extern GTY(()) rtx label_value_list; extern GTY(()) rtx label_value_list;
......
...@@ -78,7 +78,9 @@ static void free_edge (edge); ...@@ -78,7 +78,9 @@ static void free_edge (edge);
void void
init_flow (void) init_flow (void)
{ {
if (!cfun->cfg)
cfun->cfg = ggc_alloc_cleared (sizeof (struct control_flow_graph));
n_edges = 0;
ENTRY_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def)); ENTRY_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def));
ENTRY_BLOCK_PTR->index = ENTRY_BLOCK; ENTRY_BLOCK_PTR->index = ENTRY_BLOCK;
EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def)); EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def));
......
...@@ -3741,9 +3741,6 @@ allocate_struct_function (tree fndecl) ...@@ -3741,9 +3741,6 @@ allocate_struct_function (tree fndecl)
tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE; tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE;
cfun = ggc_alloc_cleared (sizeof (struct function)); cfun = ggc_alloc_cleared (sizeof (struct function));
cfun->cfg = ggc_alloc_cleared (sizeof (struct control_flow_graph));
n_edges = 0;
cfun->stack_alignment_needed = STACK_BOUNDARY; cfun->stack_alignment_needed = STACK_BOUNDARY;
cfun->preferred_stack_boundary = STACK_BOUNDARY; cfun->preferred_stack_boundary = STACK_BOUNDARY;
......
...@@ -132,6 +132,26 @@ static tree find_case_label_for_value (tree, tree); ...@@ -132,6 +132,26 @@ static tree find_case_label_for_value (tree, tree);
static bool phi_alternatives_equal (basic_block, edge, edge); static bool phi_alternatives_equal (basic_block, edge, edge);
static bool cleanup_forwarder_blocks (void); static bool cleanup_forwarder_blocks (void);
void
init_empty_tree_cfg (void)
{
/* Initialize the basic block array. */
init_flow ();
profile_status = PROFILE_ABSENT;
n_basic_blocks = 0;
last_basic_block = 0;
VARRAY_BB_INIT (basic_block_info, initial_cfg_capacity, "basic_block_info");
/* Build a mapping of labels to their associated blocks. */
VARRAY_BB_INIT (label_to_block_map, initial_cfg_capacity,
"label to block map");
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
create_block_annotation (ENTRY_BLOCK_PTR);
create_block_annotation (EXIT_BLOCK_PTR);
}
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
Create basic blocks Create basic blocks
...@@ -146,20 +166,9 @@ build_tree_cfg (tree *tp) ...@@ -146,20 +166,9 @@ build_tree_cfg (tree *tp)
/* Register specific tree functions. */ /* Register specific tree functions. */
tree_register_cfg_hooks (); tree_register_cfg_hooks ();
/* Initialize the basic block array. */
init_flow ();
profile_status = PROFILE_ABSENT;
n_basic_blocks = 0;
last_basic_block = 0;
VARRAY_BB_INIT (basic_block_info, initial_cfg_capacity, "basic_block_info");
memset ((void *) &cfg_stats, 0, sizeof (cfg_stats)); memset ((void *) &cfg_stats, 0, sizeof (cfg_stats));
/* Build a mapping of labels to their associated blocks. */ init_empty_tree_cfg ();
VARRAY_BB_INIT (label_to_block_map, initial_cfg_capacity,
"label to block map");
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
found_computed_goto = 0; found_computed_goto = 0;
make_blocks (*tp); make_blocks (*tp);
...@@ -176,9 +185,6 @@ build_tree_cfg (tree *tp) ...@@ -176,9 +185,6 @@ build_tree_cfg (tree *tp)
if (n_basic_blocks == 0) if (n_basic_blocks == 0)
create_empty_bb (ENTRY_BLOCK_PTR); create_empty_bb (ENTRY_BLOCK_PTR);
create_block_annotation (ENTRY_BLOCK_PTR);
create_block_annotation (EXIT_BLOCK_PTR);
/* Adjust the size of the array. */ /* Adjust the size of the array. */
VARRAY_GROW (basic_block_info, n_basic_blocks); VARRAY_GROW (basic_block_info, n_basic_blocks);
......
...@@ -541,6 +541,7 @@ extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code, ...@@ -541,6 +541,7 @@ extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
tree, tree, tree); tree, tree, tree);
extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code, extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
tree, tree, tree, tree); tree, tree, tree, tree);
extern void init_empty_tree_cfg (void);
/* In tree-pretty-print.c. */ /* In tree-pretty-print.c. */
extern void dump_generic_bb (FILE *, basic_block, int, int); extern void dump_generic_bb (FILE *, basic_block, int, int);
......
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