OSDN Git Service

CFG transparent RTL expansion:
[pf3gnuchains/gcc-fork.git] / gcc / passes.c
index d959679..a4fb35a 100644 (file)
@@ -1385,8 +1385,6 @@ rest_of_compilation (void)
   else
     finalize_block_changes ();
 
-  init_flow ();
-
   /* Dump the rtl code if we are dumping rtl.  */
   if (open_dump_file (DFI_rtl, current_function_decl))
     close_dump_file (DFI_rtl, print_rtl, get_insns ());
@@ -1443,11 +1441,21 @@ rest_of_compilation (void)
 
   timevar_push (TV_JUMP);
   open_dump_file (DFI_sibling, current_function_decl);
-  rebuild_jump_labels (get_insns ());
-  find_exception_handler_labels ();
-  find_basic_blocks (get_insns (), max_reg_num (), dump_file);
 
+  /* ??? We may get called either via tree_rest_of_compilation when the CFG
+     is already built or directly (for instance from coverage code).
+     The direct callers shall be updated.  */
+  if (!basic_block_info)
+    {
+      init_flow ();
+      rebuild_jump_labels (get_insns ());
+      find_exception_handler_labels ();
+      find_basic_blocks (get_insns (), max_reg_num (), dump_file);
+    }
   delete_unreachable_blocks ();
+#ifdef ENABLE_CHECKING
+  verify_flow_info();
+#endif
 
   /* Turn NOTE_INSN_PREDICTIONs into branch predictions.  */
   if (flag_guess_branch_prob)
@@ -1515,10 +1523,8 @@ rest_of_compilation (void)
   if (flag_guess_branch_prob)
     expected_value_to_br_prob ();
 
-  reg_scan (get_insns (), max_reg_num (), 0);
-  rebuild_jump_labels (get_insns ());
-  find_basic_blocks (get_insns (), max_reg_num (), dump_file);
   delete_trivially_dead_insns (get_insns (), max_reg_num ());
+  reg_scan (get_insns(), max_reg_num (), 0);
   if (dump_file)
     dump_flow_info (dump_file);
   cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP