From 997de8ed6b50b6e24573e6bf562f2845b1660088 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Tue, 12 Apr 2005 21:33:53 +0000 Subject: Makefile.in: Add function.h to BASIC_BLOCK_H. * 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. Co-Authored-By: Jan Hubicka Co-Authored-By: Stuart Hastings From-SVN: r98048 --- gcc/cfg.c | 54 ++++-------------------------------------------------- 1 file changed, 4 insertions(+), 50 deletions(-) (limited to 'gcc/cfg.c') diff --git a/gcc/cfg.c b/gcc/cfg.c index b8dccb0..a38cea9 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)) -- cgit v1.1