diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-12 21:33:53 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-04-12 21:33:53 +0000 |
commit | 7a22afabca32ad6744d7fd60c53e2f9d74bb9300 (patch) | |
tree | 172b7b8923ca5862deb02ac22abcd4d3155f0d6d | |
parent | 2e8b5b1cfc84072db7ffc18ccbfa559a56a935eb (diff) | |
download | gcc-7a22afabca32ad6744d7fd60c53e2f9d74bb9300.tar.gz |
* Makefile.in: Add function.h to BASIC_BLOCK_H. Remove all
references to gt-tree-cfg.h.
* basic-block.h (struct basic_block_def): Don't skip rbi
for garbage collection.
(struct reorder_block_def): Make GTY-able.
(struct control_flow_graph): New structure.
(n_edges, n_basic_blocks, last_basic_block, basic_block_info,
BASIC_BLOCK, EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR): No longer vars,
but instead defines to the control_flow_graph for cfun.
(label_to_block_map): New define, points to the label map of
the control_flow_graph for cfun.
(n_edges_for_function, n_basic_blocks_for_function,
last_basic_block_for_function, basic_block_info_for_function,
EXIT_BLOCK_PTR_FOR_FUNCTION, ENTRY_BLOCK_PTR_FOR_FUNCTION,
basic_block_info_for_function, label_to_block_map_for_function):
Counterparts for the above, taking a struct function as an extra
argument.
(alloc_rbi_pool, free_rbi_pool): Remove prototypes.
* cfg.c: (n_edges, n_basic_blocks, last_basic_block,
basic_block_info, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR): Remove.
(alloc_rbi_pool, free_rbi_pool): Remove.
(initialize_bb_rbi): Use ggc_alloc_cleared instead of pool_alloc.
* cfglayout.c: (cfg_layout_initialize): Don't allocate the rbi pool
here...
(cfg_layout_finalize) ... and don't free it here.
* cfgrtl.c (cfg_layout_delete_block): Zero out rbi so it gets
garbage collected.
* flow.c (free_basic_block_vars): Set label_to_block_map and
n_edges to zero too.
* function.h (struct function): Add cfg field.
* function.c (allocate_struct_function): Allocate the cfg.
* tree-cfg.c (label_to_block_map): Remove.
(build_tree_cfg): Don't allocate the rbi pool here...
(delete_tree_cfg_annotations): ...and don't free it here.
Also don't nullify label_to_block_map for cfun.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98048 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 40 | ||||
-rw-r--r-- | gcc/Makefile.in | 6 | ||||
-rw-r--r-- | gcc/basic-block.h | 118 | ||||
-rw-r--r-- | gcc/cfg.c | 54 | ||||
-rw-r--r-- | gcc/cfgcleanup.c | 2 | ||||
-rw-r--r-- | gcc/cfglayout.c | 6 | ||||
-rw-r--r-- | gcc/cfgloopanal.c | 2 | ||||
-rw-r--r-- | gcc/cfgrtl.c | 3 | ||||
-rw-r--r-- | gcc/flow.c | 3 | ||||
-rw-r--r-- | gcc/function.c | 4 | ||||
-rw-r--r-- | gcc/function.h | 3 | ||||
-rw-r--r-- | gcc/passes.c | 1 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 15 | ||||
-rw-r--r-- | gcc/tree-flow.h | 3 |
14 files changed, 146 insertions, 114 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6febf9d4163..5febe1d4428 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,43 @@ +2005-04-12 Steven Bosscher <stevenb@suse.de> + Stuart Hastings <stuart@apple.com> + Jan Hubicka <jh@suse.cz> + + * Makefile.in: Add function.h to BASIC_BLOCK_H. Remove all + references to gt-tree-cfg.h. + * basic-block.h (struct basic_block_def): Don't skip rbi + for garbage collection. + (struct reorder_block_def): Make GTY-able. + (struct control_flow_graph): New structure. + (n_edges, n_basic_blocks, last_basic_block, basic_block_info, + BASIC_BLOCK, EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR): No longer vars, + but instead defines to the control_flow_graph for cfun. + (label_to_block_map): New define, points to the label map of + the control_flow_graph for cfun. + (n_edges_for_function, n_basic_blocks_for_function, + last_basic_block_for_function, basic_block_info_for_function, + EXIT_BLOCK_PTR_FOR_FUNCTION, ENTRY_BLOCK_PTR_FOR_FUNCTION, + basic_block_info_for_function, label_to_block_map_for_function): + Counterparts for the above, taking a struct function as an extra + argument. + (alloc_rbi_pool, free_rbi_pool): Remove prototypes. + * cfg.c: (n_edges, n_basic_blocks, last_basic_block, + basic_block_info, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR): Remove. + (alloc_rbi_pool, free_rbi_pool): Remove. + (initialize_bb_rbi): Use ggc_alloc_cleared instead of pool_alloc. + * cfglayout.c: (cfg_layout_initialize): Don't allocate the rbi pool + here... + (cfg_layout_finalize) ... and don't free it here. + * cfgrtl.c (cfg_layout_delete_block): Zero out rbi so it gets + garbage collected. + * flow.c (free_basic_block_vars): Set label_to_block_map and + n_edges to zero too. + * function.h (struct function): Add cfg field. + * function.c (allocate_struct_function): Allocate the cfg. + * tree-cfg.c (label_to_block_map): Remove. + (build_tree_cfg): Don't allocate the rbi pool here... + (delete_tree_cfg_annotations): ...and don't free it here. + Also don't nullify label_to_block_map for cfun. + 2005-04-12 Caroline Tice <ctice@apple.com> * bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges): diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 57f3d1a5365..fc3ab24452d 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -729,7 +729,7 @@ EMIT_RTL_H = emit-rtl.h FLAGS_H = flags.h options.h EXPR_H = expr.h insn-config.h function.h $(RTL_H) $(FLAGS_H) $(TREE_H) $(MACHMODE_H) $(EMIT_RTL_H) OPTABS_H = optabs.h insn-codes.h -REGS_H = regs.h varray.h $(MACHMODE_H) $(OBSTACK_H) $(BASIC_BLOCK_H) +REGS_H = regs.h varray.h $(MACHMODE_H) $(OBSTACK_H) $(BASIC_BLOCK_H) $(FUNCTION_H) RESOURCE_H = resource.h hard-reg-set.h SCHED_INT_H = sched-int.h $(INSN_ATTR_H) $(BASIC_BLOCK_H) $(RTL_H) INTEGRATE_H = integrate.h varray.h @@ -1699,7 +1699,7 @@ tree-vrp.o : tree-vrp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ tree-cfg.o : tree-cfg.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \ diagnostic.h errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h \ - $(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) gt-tree-cfg.h tree-pass.h \ + $(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \ $(CFGLAYOUT_H) tree-tailcall.o : tree-tailcall.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) function.h $(TM_H) coretypes.h \ @@ -2492,7 +2492,7 @@ gt-c-pragma.h gtype-c.h gt-cfglayout.h \ gt-tree-mudflap.h gt-tree-complex.h \ gt-tree-eh.h \ gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \ -gt-tree-phinodes.h gt-tree-cfg.h gt-tree-nested.h \ +gt-tree-phinodes.h gt-tree-nested.h \ gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \ gt-stringpool.h : s-gtype ; @true diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 0fa8ce55e83..965c3226562 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "predict.h" #include "vec.h" #include "errors.h" +#include "function.h" /* Head of register set linked list. */ typedef bitmap_head regset_head; @@ -242,7 +243,7 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb") struct basic_block_def *next_bb; /* The data used by basic block copying and reordering functions. */ - struct reorder_block_def * GTY ((skip (""))) rbi; + struct reorder_block_def * rbi; /* Annotations used at the tree level. */ struct bb_ann_d *tree_annotations; @@ -261,27 +262,38 @@ struct basic_block_def GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb") /* Various flags. See BB_* below. */ int flags; + + /* Which section block belongs in, when partitioning basic blocks. */ + int partition; }; typedef struct basic_block_def *basic_block; /* Structure to hold information about the blocks during reordering and - copying. */ + copying. Needs to be put on a diet. */ -typedef struct reorder_block_def +struct reorder_block_def GTY(()) { rtx header; rtx footer; + basic_block next; - basic_block original; - /* Used by loop copying. */ - basic_block copy; + + /* These pointers may be unreliable as the first is only used for + debugging (and should probably be removed, and the second is only + used by copying. The basic blocks pointed to may be removed and + that leaves these pointers pointing to garbage. */ + basic_block GTY ((skip (""))) original; + basic_block GTY ((skip (""))) copy; + int duplicated; int copy_number; - /* These fields are used by bb-reorder pass. */ + /* This field is used by the bb-reorder and tracer passes. */ int visited; -} *reorder_block_def_p; +}; + +typedef struct reorder_block_def *reorder_block_def; #define BB_FREQ_MAX 10000 @@ -338,45 +350,81 @@ enum #define BB_COPY_PARTITION(dstbb, srcbb) \ BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb)) -/* Number of basic blocks in the current function. */ +/* A structure to group all the per-function control flow graph data. + The x_* prefixing is necessary because otherwise references to the + fields of this struct are interpreted as the defines for backward + source compatibility following the definition of this struct. */ +struct control_flow_graph GTY(()) +{ + /* Block pointers for the exit and entry of a function. + These are always the head and tail of the basic block list. */ + basic_block x_entry_block_ptr; + basic_block x_exit_block_ptr; + + /* Index by basic block number, get basic block struct info. */ + varray_type x_basic_block_info; + + /* Number of basic blocks in this flow graph. */ + int x_n_basic_blocks; -extern int n_basic_blocks; + /* Number of edges in this flow graph. */ + int x_n_edges; -/* First free basic block number. */ + /* The first free basic block number. */ + int x_last_basic_block; -extern int last_basic_block; + /* Mapping of labels to their associated blocks. At present + only used for the tree CFG. */ + varray_type x_label_to_block_map; -/* Number of edges in the current function. */ + enum profile_status { + PROFILE_ABSENT, + PROFILE_GUESSED, + PROFILE_READ + } x_profile_status; +}; -extern int n_edges; +/* Defines for accessing the fields of the CFG structure for function FN. */ +#define ENTRY_BLOCK_PTR_FOR_FUNCTION(FN) ((FN)->cfg->x_entry_block_ptr) +#define EXIT_BLOCK_PTR_FOR_FUNCTION(FN) ((FN)->cfg->x_exit_block_ptr) +#define basic_block_info_for_function(FN) ((FN)->cfg->x_basic_block_info) +#define n_basic_blocks_for_function(FN) ((FN)->cfg->x_n_basic_blocks) +#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 BASIC_BLOCK_FOR_FUNCTION(FN,N) \ + (VARRAY_BB (basic_block_info_for_function(FN), (N))) + +/* Defines for texual backward source compatibility. */ +#define ENTRY_BLOCK_PTR (cfun->cfg->x_entry_block_ptr) +#define EXIT_BLOCK_PTR (cfun->cfg->x_exit_block_ptr) +#define basic_block_info (cfun->cfg->x_basic_block_info) +#define n_basic_blocks (cfun->cfg->x_n_basic_blocks) +#define n_edges (cfun->cfg->x_n_edges) +#define last_basic_block (cfun->cfg->x_last_basic_block) +#define label_to_block_map (cfun->cfg->x_label_to_block_map) +#define profile_status (cfun->cfg->x_profile_status) + +#define BASIC_BLOCK(N) (VARRAY_BB (basic_block_info, (N))) /* TRUE if we should re-run loop discovery after threading jumps, FALSE otherwise. */ extern bool rediscover_loops_after_threading; -/* Signalize the status of profile information in the CFG. */ -extern enum profile_status -{ - PROFILE_ABSENT, - PROFILE_GUESSED, - PROFILE_READ -} profile_status; - -/* Index by basic block number, get basic block struct info. */ - -extern GTY(()) varray_type basic_block_info; - -#define BASIC_BLOCK(N) (VARRAY_BB (basic_block_info, (N))) - /* For iterating over basic blocks. */ #define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \ for (BB = FROM; BB != TO; BB = BB->DIR) -#define FOR_EACH_BB(BB) \ - FOR_BB_BETWEEN (BB, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR, next_bb) +#define FOR_EACH_BB_FN(BB, FN) \ + FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb) + +#define FOR_EACH_BB(BB) FOR_EACH_BB_FN (BB, cfun) -#define FOR_EACH_BB_REVERSE(BB) \ - FOR_BB_BETWEEN (BB, EXIT_BLOCK_PTR->prev_bb, ENTRY_BLOCK_PTR, prev_bb) +#define FOR_EACH_BB_REVERSE_FN(BB, FN) \ + FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb) + +#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN(BB, cfun) /* For iterating over insns in basic block. */ #define FOR_BB_INSNS(BB, INSN) \ @@ -425,10 +473,6 @@ extern bitmap_obstack reg_obstack; /* Special block number not valid for any block. */ #define INVALID_BLOCK (-3) -/* Similarly, block pointers for the edge list. */ -extern GTY(()) basic_block ENTRY_BLOCK_PTR; -extern GTY(()) basic_block EXIT_BLOCK_PTR; - #define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0) #define set_block_for_insn(INSN, BB) (BLOCK_FOR_INSN (INSN) = BB) @@ -870,9 +914,7 @@ extern void duplicate_computed_gotos (void); extern void partition_hot_cold_basic_blocks (void); /* In cfg.c */ -extern void alloc_rbi_pool (void); extern void initialize_bb_rbi (basic_block bb); -extern void free_rbi_pool (void); /* In dominance.c */ diff --git a/gcc/cfg.c b/gcc/cfg.c index b8dccb080f5..a38cea99c62 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -60,7 +60,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "except.h" #include "toplev.h" #include "tm_p.h" -#include "alloc-pool.h" +#include "obstack.h" #include "timevar.h" #include "ggc.h" @@ -68,33 +68,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA struct bitmap_obstack reg_obstack; -/* Number of basic blocks in the current function. */ - -int n_basic_blocks; - -/* First free basic block number. */ - -int last_basic_block; - -/* Number of edges in the current function. */ - -int n_edges; - -/* The basic block array. */ - -varray_type basic_block_info; - -/* The special entry and exit blocks. */ -basic_block ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR; - -/* Memory alloc pool for bb member rbi. */ -static alloc_pool rbi_pool; - void debug_flow_info (void); static void free_edge (edge); - -/* Indicate the presence of the profile. */ -enum profile_status profile_status; #define RDIV(X,Y) (((X) + (Y) / 2) / (Y)) @@ -103,11 +78,10 @@ enum profile_status profile_status; void init_flow (void) { - n_edges = 0; - ENTRY_BLOCK_PTR = ggc_alloc_cleared (sizeof (*ENTRY_BLOCK_PTR)); + ENTRY_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def)); ENTRY_BLOCK_PTR->index = ENTRY_BLOCK; - EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (*EXIT_BLOCK_PTR)); + EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (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; @@ -158,24 +132,6 @@ alloc_block (void) return bb; } -/* Create memory pool for rbi_pool. */ - -void -alloc_rbi_pool (void) -{ - rbi_pool = create_alloc_pool ("rbi pool", - sizeof (struct reorder_block_def), - n_basic_blocks + 2); -} - -/* Free rbi_pool. */ - -void -free_rbi_pool (void) -{ - free_alloc_pool (rbi_pool); -} - /* Initialize rbi (the structure containing data used by basic block duplication and reordering) for the given basic block. */ @@ -183,8 +139,7 @@ void initialize_bb_rbi (basic_block bb) { gcc_assert (!bb->rbi); - bb->rbi = pool_alloc (rbi_pool); - memset (bb->rbi, 0, sizeof (struct reorder_block_def)); + bb->rbi = ggc_alloc_cleared (sizeof (struct reorder_block_def)); } /* Link block B to chain after AFTER. */ @@ -522,7 +477,6 @@ dump_flow_info (FILE *file) /* There are no pseudo registers after reload. Don't dump them. */ if (reg_n_info && !reload_completed) { - int max_regno = max_reg_num (); fprintf (file, "%d registers.\n", max_regno); for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (REG_N_REFS (i)) diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 70bd28d173c..e7df2aeece6 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -536,7 +536,7 @@ try_forward_edges (int mode, basic_block b) For fallthru forwarders, the LOOP_BEG note must appear between the header of block and CODE_LABEL of the loop, for non forwarders it must appear before the JUMP_INSN. */ - if ((mode & CLEANUP_PRE_LOOP) && optimize) + if ((mode & CLEANUP_PRE_LOOP) && optimize && flag_loop_optimize) { rtx insn = (EDGE_SUCC (target, 0)->flags & EDGE_FALLTHRU ? BB_HEAD (target) : prev_nonnote_insn (BB_END (target))); diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 22c93f11420..d71f0114a0f 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -1097,10 +1097,6 @@ cfg_layout_initialize (unsigned int flags) { basic_block bb; - /* Our algorithm depends on fact that there are no dead jumptables - around the code. */ - alloc_rbi_pool (); - FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) initialize_bb_rbi (bb); @@ -1162,8 +1158,6 @@ cfg_layout_finalize (void) #ifdef ENABLE_CHECKING verify_insn_chain (); #endif - - free_rbi_pool (); FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) bb->rbi = NULL; diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 2d2ece2cb2d..ca788af37af 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -419,7 +419,7 @@ expected_loop_iterations (const struct loop *loop) edge e; edge_iterator ei; - if (loop->header->count) + if (loop->latch->count || loop->header->count) { gcov_type count_in, count_latch, expected; diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index ea7d1ba9b62..0f8d5ebff7f 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -2652,6 +2652,9 @@ cfg_layout_delete_block (basic_block bb) to = &bb->next_bb->rbi->header; else to = &cfg_layout_function_footer; + + bb->rbi = NULL; + rtl_delete_block (bb); if (prev) diff --git a/gcc/flow.c b/gcc/flow.c index 96aa436540e..2c7e84fbe6b 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -760,6 +760,9 @@ free_basic_block_vars (void) } n_basic_blocks = 0; last_basic_block = 0; + n_edges = 0; + + label_to_block_map = NULL; ENTRY_BLOCK_PTR->aux = NULL; ENTRY_BLOCK_PTR->global_live_at_end = NULL; diff --git a/gcc/function.c b/gcc/function.c index 909204fdccc..6d8eb829cb1 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -317,6 +317,7 @@ free_after_compilation (struct function *f) f->emit = NULL; f->varasm = NULL; f->machine = NULL; + f->cfg = NULL; f->x_avail_temp_slots = NULL; f->x_used_temp_slots = NULL; @@ -3908,6 +3909,9 @@ allocate_struct_function (tree fndecl) tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE; 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->preferred_stack_boundary = STACK_BOUNDARY; diff --git a/gcc/function.h b/gcc/function.h index b772752552f..f12452d2fdc 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -166,6 +166,9 @@ struct function GTY(()) struct emit_status *emit; struct varasm_status *varasm; + /* The control flow graph for this function. */ + struct control_flow_graph *cfg; + /* For tree-optimize.c. */ /* Saved tree and arguments during tree optimization. Used later for diff --git a/gcc/passes.c b/gcc/passes.c index a34c97553da..8ae8b3127cc 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -78,7 +78,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "opts.h" #include "coverage.h" #include "value-prof.h" -#include "alloc-pool.h" #include "tree-pass.h" #include "tree-dump.h" diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 1ecf322a942..a9a9fdcab73 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -54,10 +54,6 @@ Boston, MA 02111-1307, USA. */ /* Initial capacity for the basic block array. */ static const int initial_cfg_capacity = 20; -/* Mapping of labels to their associated blocks. This can greatly speed up - building of the CFG in code with lots of gotos. */ -static GTY(()) varray_type label_to_block_map; - /* This hash table allows us to efficiently lookup all CASE_LABEL_EXPRs which use a particular edge. The CASE_LABEL_EXPRs are chained together via their TREE_CHAIN field, which we clear after we're done with the @@ -150,9 +146,6 @@ build_tree_cfg (tree *tp) /* Register specific tree functions. */ tree_register_cfg_hooks (); - /* Initialize rbi_pool. */ - alloc_rbi_pool (); - /* Initialize the basic block array. */ init_flow (); profile_status = PROFILE_ABSENT; @@ -812,7 +805,7 @@ make_switch_expr_edges (basic_block bb) /* Return the basic block holding label DEST. */ basic_block -label_to_block (tree dest) +label_to_block_fn (struct function *ifun, tree dest) { int uid = LABEL_DECL_UID (dest); @@ -828,10 +821,9 @@ label_to_block (tree dest) bsi_insert_before (&bsi, stmt, BSI_NEW_STMT); uid = LABEL_DECL_UID (dest); } - return VARRAY_BB (label_to_block_map, uid); + return VARRAY_BB (ifun->cfg->x_label_to_block_map, uid); } - /* Create edges for a goto statement at block BB. */ static void @@ -2898,7 +2890,6 @@ delete_tree_cfg_annotations (void) free_blocks_annotations (); label_to_block_map = NULL; - free_rbi_pool (); FOR_EACH_BB (bb) bb->rbi = NULL; } @@ -6052,5 +6043,3 @@ struct tree_opt_pass pass_warn_function_return = 0, /* todo_flags_finish */ 0 /* letter */ }; - -#include "gt-tree-cfg.h" diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index eaaa32dc426..961ddde50c6 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -523,7 +523,8 @@ extern tree *last_stmt_ptr (basic_block); extern tree last_and_only_stmt (basic_block); extern edge find_taken_edge (basic_block, tree); extern void cfg_remove_useless_stmts (void); -extern basic_block label_to_block (tree); +extern basic_block label_to_block_fn (struct function *, tree); +#define label_to_block(t) (label_to_block_fn (cfun, t)) extern void bsi_insert_on_edge (edge, tree); extern basic_block bsi_insert_on_edge_immediate (edge, tree); extern void bsi_commit_one_edge_insert (edge, basic_block *); |