OSDN Git Service

* basic-block.h (FOR_ALL_BB_FN): New macro.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 May 2005 22:32:16 +0000 (22:32 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 May 2005 22:32:16 +0000 (22:32 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99633 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/basic-block.h
gcc/cfg.c
gcc/function.c
gcc/tree-cfg.c
gcc/tree-flow.h

index fb42b57..f88fbf4 100644 (file)
@@ -1,3 +1,12 @@
+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>
 
        Fix PR tree-optimization/21520
index baca9d7..4a71d25 100644 (file)
@@ -444,6 +444,9 @@ extern bool rediscover_loops_after_threading;
 #define FOR_ALL_BB(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.  */
 
 extern GTY(()) rtx label_value_list;
index a0f326a..c1cf389 100644 (file)
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -78,7 +78,9 @@ static void free_edge (edge);
 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->index = ENTRY_BLOCK;
   EXIT_BLOCK_PTR = ggc_alloc_cleared (sizeof (struct basic_block_def));
index 6bc3344..059886f 100644 (file)
@@ -3741,9 +3741,6 @@ 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;
index 9860a29..9f0d1e5 100644 (file)
@@ -132,6 +132,26 @@ static tree find_case_label_for_value (tree, tree);
 static bool phi_alternatives_equal (basic_block, edge, edge);
 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
@@ -146,20 +166,9 @@ build_tree_cfg (tree *tp)
   /* Register specific tree functions.  */
   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));
 
-  /* 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;
+  init_empty_tree_cfg ();
 
   found_computed_goto = 0;
   make_blocks (*tp);
@@ -176,9 +185,6 @@ build_tree_cfg (tree *tp)
   if (n_basic_blocks == 0)
     create_empty_bb (ENTRY_BLOCK_PTR);
 
-  create_block_annotation (ENTRY_BLOCK_PTR);
-  create_block_annotation (EXIT_BLOCK_PTR);
-  
   /* Adjust the size of the array.  */
   VARRAY_GROW (basic_block_info, n_basic_blocks);
 
index f3e3334..2835c22 100644 (file)
@@ -541,6 +541,7 @@ extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
                             tree, tree, tree);
 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
                             tree, tree, tree, tree);
+extern void init_empty_tree_cfg (void);
 
 /* In tree-pretty-print.c.  */
 extern void dump_generic_bb (FILE *, basic_block, int, int);