[multiple changes]
2008-05-16 Nathan Froyd <froydnj@codesourcery.com> * tree-flow.h (init_empty_tree_cfg_for_function): Declare. * tree-cfg.c (init_empty_tree_cfg_for_function): Define. (init_empty_tree_cfg): Call it. 2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com> * cfg.c (init_flow): Add argument THE_FUN. Use it instead of cfun. Update all users. From-SVN: r135418
This commit is contained in:
parent
3e894af156
commit
9defb1fe37
@ -1,3 +1,14 @@
|
||||
2008-05-16 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* tree-flow.h (init_empty_tree_cfg_for_function): Declare.
|
||||
* tree-cfg.c (init_empty_tree_cfg_for_function): Define.
|
||||
(init_empty_tree_cfg): Call it.
|
||||
|
||||
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
|
||||
|
||||
* cfg.c (init_flow): Add argument THE_FUN. Use it
|
||||
instead of cfun. Update all users.
|
||||
|
||||
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
|
||||
|
||||
* doc/invoke.text (-fdump-tree-*-verbose): New option.
|
||||
|
@ -414,9 +414,12 @@ struct control_flow_graph GTY(())
|
||||
#define n_edges_for_function(FN) ((FN)->cfg->x_n_edges)
|
||||
#define last_basic_block_for_function(FN) ((FN)->cfg->x_last_basic_block)
|
||||
#define label_to_block_map_for_function(FN) ((FN)->cfg->x_label_to_block_map)
|
||||
#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)
|
||||
|
||||
#define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
|
||||
(VEC_index (basic_block, basic_block_info_for_function(FN), (N)))
|
||||
#define SET_BASIC_BLOCK_FOR_FUNCTION(FN,N,BB) \
|
||||
(VEC_replace (basic_block, basic_block_info_for_function(FN), (N), (BB)))
|
||||
|
||||
/* Defines for textual backward source compatibility. */
|
||||
#define ENTRY_BLOCK_PTR (cfun->cfg->x_entry_block_ptr)
|
||||
@ -839,7 +842,7 @@ extern bool br_prob_note_reliable_p (const_rtx);
|
||||
/* In cfg.c */
|
||||
extern void dump_regset (regset, FILE *);
|
||||
extern void debug_regset (regset);
|
||||
extern void init_flow (void);
|
||||
extern void init_flow (struct function *);
|
||||
extern void debug_bb (basic_block);
|
||||
extern basic_block debug_bb_n (int);
|
||||
extern void dump_regset (regset, FILE *);
|
||||
|
24
gcc/cfg.c
24
gcc/cfg.c
@ -81,17 +81,21 @@ static void free_edge (edge);
|
||||
/* Called once at initialization time. */
|
||||
|
||||
void
|
||||
init_flow (void)
|
||||
init_flow (struct function *the_fun)
|
||||
{
|
||||
if (!cfun->cfg)
|
||||
cfun->cfg = GGC_CNEW (struct control_flow_graph);
|
||||
n_edges = 0;
|
||||
ENTRY_BLOCK_PTR = GGC_CNEW (struct basic_block_def);
|
||||
ENTRY_BLOCK_PTR->index = ENTRY_BLOCK;
|
||||
EXIT_BLOCK_PTR = GGC_CNEW (struct basic_block_def);
|
||||
EXIT_BLOCK_PTR->index = EXIT_BLOCK;
|
||||
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
|
||||
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
|
||||
if (!the_fun->cfg)
|
||||
the_fun->cfg = GGC_CNEW (struct control_flow_graph);
|
||||
n_edges_for_function (the_fun) = 0;
|
||||
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)
|
||||
= GGC_CNEW (struct basic_block_def);
|
||||
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = ENTRY_BLOCK;
|
||||
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)
|
||||
= GGC_CNEW (struct basic_block_def);
|
||||
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = EXIT_BLOCK;
|
||||
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->next_bb
|
||||
= EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun);
|
||||
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->prev_bb
|
||||
= ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun);
|
||||
}
|
||||
|
||||
/* Helper function for remove_edge and clear_edges. Frees edge structure
|
||||
|
@ -114,26 +114,41 @@ static edge find_taken_edge_switch_expr (basic_block, tree);
|
||||
static tree find_case_label_for_value (tree, tree);
|
||||
|
||||
void
|
||||
init_empty_tree_cfg (void)
|
||||
init_empty_tree_cfg_for_function (struct function *fn)
|
||||
{
|
||||
/* Initialize the basic block array. */
|
||||
init_flow ();
|
||||
profile_status = PROFILE_ABSENT;
|
||||
n_basic_blocks = NUM_FIXED_BLOCKS;
|
||||
last_basic_block = NUM_FIXED_BLOCKS;
|
||||
basic_block_info = VEC_alloc (basic_block, gc, initial_cfg_capacity);
|
||||
VEC_safe_grow_cleared (basic_block, gc, basic_block_info,
|
||||
init_flow (fn);
|
||||
profile_status_for_function (fn) = PROFILE_ABSENT;
|
||||
n_basic_blocks_for_function (fn) = NUM_FIXED_BLOCKS;
|
||||
last_basic_block_for_function (fn) = NUM_FIXED_BLOCKS;
|
||||
basic_block_info_for_function (fn)
|
||||
= VEC_alloc (basic_block, gc, initial_cfg_capacity);
|
||||
VEC_safe_grow_cleared (basic_block, gc,
|
||||
basic_block_info_for_function (fn),
|
||||
initial_cfg_capacity);
|
||||
|
||||
/* Build a mapping of labels to their associated blocks. */
|
||||
label_to_block_map = VEC_alloc (basic_block, gc, initial_cfg_capacity);
|
||||
VEC_safe_grow_cleared (basic_block, gc, label_to_block_map,
|
||||
label_to_block_map_for_function (fn)
|
||||
= VEC_alloc (basic_block, gc, initial_cfg_capacity);
|
||||
VEC_safe_grow_cleared (basic_block, gc,
|
||||
label_to_block_map_for_function (fn),
|
||||
initial_cfg_capacity);
|
||||
|
||||
SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR);
|
||||
SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR);
|
||||
ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
|
||||
EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
|
||||
SET_BASIC_BLOCK_FOR_FUNCTION (fn, ENTRY_BLOCK,
|
||||
ENTRY_BLOCK_PTR_FOR_FUNCTION (fn));
|
||||
SET_BASIC_BLOCK_FOR_FUNCTION (fn, EXIT_BLOCK,
|
||||
EXIT_BLOCK_PTR_FOR_FUNCTION (fn));
|
||||
|
||||
ENTRY_BLOCK_PTR_FOR_FUNCTION (fn)->next_bb
|
||||
= EXIT_BLOCK_PTR_FOR_FUNCTION (fn);
|
||||
EXIT_BLOCK_PTR_FOR_FUNCTION (fn)->prev_bb
|
||||
= ENTRY_BLOCK_PTR_FOR_FUNCTION (fn);
|
||||
}
|
||||
|
||||
void
|
||||
init_empty_tree_cfg (void)
|
||||
{
|
||||
init_empty_tree_cfg_for_function (cfun);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user