tree-pass.h (pass_rtl_eh): Remove.
authorRichard Guenther <rguenther@suse.de>
Tue, 20 Mar 2012 09:52:02 +0000 (09:52 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 20 Mar 2012 09:52:02 +0000 (09:52 +0000)
2012-03-20  Richard Guenther  <rguenther@suse.de>

* tree-pass.h (pass_rtl_eh): Remove.
* except.c (gate_handle_eh): Likewise.
(rest_of_handle_eh): Likewise.
(pass_rtl_eh): Likewise.
(finish_eh_generation): Export.
* except.h (finish_eh_generation): Declare.
* passes.c (init_optimization_passes): Remove pass_rtl_eh.
* cfgexpand.c (gimple_expand_cfg): Call finish_eh_generation
after expanding stack alignment.  Instead of compacting blocks
call cleanup_cfg.

From-SVN: r185564

gcc/ChangeLog
gcc/cfgexpand.c
gcc/except.c
gcc/except.h
gcc/passes.c
gcc/tree-pass.h

index 9eade87ce520c6ea53dfad63f0ce11243839da3b..b9378eab93d1d4ab248320a09329c6f6367307ba 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree-pass.h (pass_rtl_eh): Remove.
+       * except.c (gate_handle_eh): Likewise.
+       (rest_of_handle_eh): Likewise.
+       (pass_rtl_eh): Likewise.
+       (finish_eh_generation): Export.
+       * except.h (finish_eh_generation): Declare.
+       * passes.c (init_optimization_passes): Remove pass_rtl_eh.
+       * cfgexpand.c (gimple_expand_cfg): Call finish_eh_generation
+       after expanding stack alignment.  Instead of compacting blocks
+       call cleanup_cfg.
+
 2012-03-20  Richard Guenther  <rguenther@suse.de>
 
        * stor-layout.c (finish_bitfield_representative): Fallback
index bd21169eb876849cdf9bceda5cd481bf30924d41..543404a70d3a35eeb4a3fcd94d154b7c278835b7 100644 (file)
@@ -4623,10 +4623,22 @@ gimple_expand_cfg (void)
   sbitmap_free (blocks);
   purge_all_dead_edges ();
 
-  compact_blocks ();
-
   expand_stack_alignment ();
 
+  /* After initial rtl generation, call back to finish generating
+     exception support code.  We need to do this before cleaning up
+     the CFG as the code does not expect dead landing pads.  */
+  if (cfun->eh->region_tree != NULL)
+    finish_eh_generation ();
+
+  /* Remove unreachable blocks, otherwise we cannot compute dominators
+     which are needed for loop state verification.  As a side-effect
+     this also compacts blocks.
+     ???  We cannot remove trivially dead insns here as for example
+     the DRAP reg on i?86 is not magically live at this point.
+     gcc.c-torture/execute/ipa-sra-2.c execution, -Os -m32 fails otherwise.  */
+  cleanup_cfg (CLEANUP_NO_INSN_DEL);
+
 #ifdef ENABLE_CHECKING
   verify_flow_info ();
 #endif
index 8cf47bcc23627738b9e33959ea8a1709e8a195f9..eb27648786cf4f09502abe1e8a813c45832c7fe3 100644 (file)
@@ -81,7 +81,7 @@ along with GCC; see the file COPYING3.  If not see
    gimple to eh_region mapping that had been recorded in the
    THROW_STMT_TABLE.
 
-   During pass_rtl_eh (except.c), we generate the real landing pads
+   Then, via finish_eh_generation, we generate the real landing pads
    to which the runtime will actually transfer control.  These new
    landing pads perform whatever bookkeeping is needed by the target
    backend in order to resume execution within the current function.
@@ -1406,7 +1406,7 @@ sjlj_build_landing_pads (void)
 /* After initial rtl generation, call back to finish generating
    exception support code.  */
 
-static void
+void
 finish_eh_generation (void)
 {
   basic_block bb;
@@ -1453,41 +1453,6 @@ finish_eh_generation (void)
        }
     }
 }
-
-static bool
-gate_handle_eh (void)
-{
-  /* Nothing to do if no regions created.  */
-  return cfun->eh->region_tree != NULL;
-}
-
-/* Complete generation of exception handling code.  */
-static unsigned int
-rest_of_handle_eh (void)
-{
-  finish_eh_generation ();
-  cleanup_cfg (CLEANUP_NO_INSN_DEL);
-  return 0;
-}
-
-struct rtl_opt_pass pass_rtl_eh =
-{
- {
-  RTL_PASS,
-  "rtl_eh",                             /* name */
-  gate_handle_eh,                       /* gate */
-  rest_of_handle_eh,                   /* execute */
-  NULL,                                 /* sub */
-  NULL,                                 /* next */
-  0,                                    /* static_pass_number */
-  TV_JUMP,                              /* tv_id */
-  0,                                    /* properties_required */
-  0,                                    /* properties_provided */
-  0,                                    /* properties_destroyed */
-  0,                                    /* todo_flags_start */
-  0                                     /* todo_flags_finish */
- }
-};
 \f
 /* This section handles removing dead code for flow.  */
 
index 5d461d7000b651e1016561a8f2e44ffeccf487f9..e161493b5aac523c30d057e2e89cb5ff263ecf87 100644 (file)
@@ -291,6 +291,8 @@ extern void assign_filter_values (void);
 extern eh_region get_eh_region_from_rtx (const_rtx);
 extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx);
 
+extern void finish_eh_generation (void);
+
 struct GTY(()) throw_stmt_node {
   gimple stmt;
   int lp_nr;
index 6e58d8bbd51284244f168ee23e772ff08ae7ae2f..02b1b5b122fbf2ec2a5a03b3f18819f8cb169fc1 100644 (file)
@@ -1431,7 +1431,6 @@ init_optimization_passes (void)
       struct opt_pass **p = &pass_rest_of_compilation.pass.sub;
       NEXT_PASS (pass_init_function);
       NEXT_PASS (pass_jump);
-      NEXT_PASS (pass_rtl_eh);
       NEXT_PASS (pass_initial_value_sets);
       NEXT_PASS (pass_unshare_all_rtl);
       NEXT_PASS (pass_instantiate_virtual_regs);
index 6f1fd6aca691d93e3f7f0a77be8982a2c930baa0..8c50267953cf5304950fc28fb9e19c961fcb6241 100644 (file)
@@ -487,7 +487,6 @@ extern struct gimple_opt_pass pass_fixup_cfg;
 extern struct rtl_opt_pass pass_expand;
 extern struct rtl_opt_pass pass_init_function;
 extern struct rtl_opt_pass pass_jump;
-extern struct rtl_opt_pass pass_rtl_eh;
 extern struct rtl_opt_pass pass_initial_value_sets;
 extern struct rtl_opt_pass pass_unshare_all_rtl;
 extern struct rtl_opt_pass pass_instantiate_virtual_regs;