]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cfglayout.c (fixup_fallthru_exit_predecesor): New static function.
authorJan Hubicka <jh@suse.cz>
Wed, 14 Nov 2001 19:36:17 +0000 (20:36 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 14 Nov 2001 19:36:17 +0000 (19:36 +0000)
* cfglayout.c (fixup_fallthru_exit_predecesor): New static function.
(cfg_layout_finalize): Use it.
* bb-reorder.c (HAVE_epilogue): Remove.
(make_reorder_chain): Do not care special placement of
last basic block.

* predict.c (expected_value_to_br_prob): Delete the note
once transformed.

* c-decl.c (c_expand_body): Fix TV_EXPAND nesting problem;
measure integration time separately.

From-SVN: r47019

gcc/ChangeLog
gcc/bb-reorder.c
gcc/c-decl.c
gcc/cfglayout.c
gcc/predict.c

index 7607c84292bc37a13dbfafa6a3bf113e85735670..44c54091de009d1594a383ce7d27ab577a6a3fd3 100644 (file)
@@ -1,3 +1,17 @@
+Wed Nov 14 19:46:08 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * cfglayout.c (fixup_fallthru_exit_predecesor): New static function.
+       (cfg_layout_finalize): Use it.
+       * bb-reorder.c (HAVE_epilogue): Remove.
+       (make_reorder_chain): Do not care special placement of 
+       last basic block.
+
+       * predict.c (expected_value_to_br_prob): Delete the note
+       once transformed.
+
+       * c-decl.c (c_expand_body): Fix TV_EXPAND nesting problem;
+       measure integration time separately.
+
 Wed Nov 14 12:30:57 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * function.c (struct temp_slot): ALIGN now unsigned.
index 72cf90c7134cc914ef2bfb152e13dfb1c37a4031..97ad1426b369fc12c441169666864fd72e245270 100644 (file)
 #include "output.h"
 #include "cfglayout.h"
 
-#ifndef HAVE_epilogue
-#define HAVE_epilogue 0
-#endif
-
 /* Local function prototypes.  */
 static void make_reorder_chain         PARAMS ((void));
 static basic_block make_reorder_chain_1        PARAMS ((basic_block, basic_block));
@@ -104,22 +100,10 @@ static basic_block make_reorder_chain_1   PARAMS ((basic_block, basic_block));
 static void
 make_reorder_chain ()
 {
-  basic_block last_block = NULL;
   basic_block prev = NULL;
   int nbb_m1 = n_basic_blocks - 1;
   basic_block next;
 
-  /* If we've not got epilogue in RTL, we must fallthru to the exit.
-     Force the last block to be at the end.  */
-  /* ??? Some ABIs (e.g. MIPS) require the return insn to be at the
-     end of the function for stack unwinding purposes.  */
-  if (! HAVE_epilogue)
-    {
-      last_block = BASIC_BLOCK (nbb_m1);
-      RBI (last_block)->visited = 1;
-      nbb_m1 -= 1;
-    }
-
   /* Loop until we've placed every block.  */
   do
     {
@@ -144,13 +128,6 @@ make_reorder_chain ()
         prev = make_reorder_chain_1 (next, prev);
     }
   while (next);
-
-  /* Terminate the chain.  */
-  if (! HAVE_epilogue)
-    {
-      RBI (prev)->next = last_block;
-      prev = last_block;
-    }
   RBI (prev)->next = NULL;
 }
 
index 0e4cf0c6b52322fd3789fde7f459c1b151b832ef..f2289fec3aa2fa75ab3416bee3f2752d3fba1c86 100644 (file)
@@ -6783,13 +6783,12 @@ c_expand_body (fndecl, nested_p, can_defer_p)
   if (flag_syntax_only)
     return;
 
-  timevar_push (TV_EXPAND);
-
   if (flag_inline_trees)
     {
       /* First, cache whether the current function is inlinable.  Some
          predicates depend on cfun and current_function_decl to
          function completely.  */
+      timevar_push (TV_INTEGRATION);
       uninlinable = ! tree_inlinable_function_p (fndecl);
       
       if (! uninlinable && can_defer_p
@@ -6800,13 +6799,17 @@ c_expand_body (fndecl, nested_p, can_defer_p)
        {
          /* Let the back-end know that this funtion exists.  */
          (*debug_hooks->deferred_inline_function) (fndecl);
+          timevar_pop (TV_INTEGRATION);
          return;
        }
       
       /* Then, inline any functions called in it.  */
       optimize_inline_calls (fndecl);
+      timevar_pop (TV_INTEGRATION);
     }
 
+  timevar_push (TV_EXPAND);
+
   if (nested_p)
     {
       /* Make sure that we will evaluate variable-sized types involved
index 5c2ee088c8a9ed2ada4b0936c991071d0e59bbfb..d93d44f7fed64e86c1e32235fedc47bcf3e2f0be 100644 (file)
@@ -110,6 +110,7 @@ static rtx get_next_bb_note         PARAMS ((rtx));
 static rtx get_prev_bb_note            PARAMS ((rtx));
 
 void verify_insn_chain                 PARAMS ((void));
+static basic_block fixup_fallthru_exit_predecesor PARAMS ((void));
 \f
 /* Skip over inter-block insns occurring after BB which are typically
    associated with BB (e.g., barriers). If there are any such insns,
@@ -1041,6 +1042,30 @@ verify_insn_chain ()
       abort ();
     }
 }
+
+/* The block falling trought to exit must be last in the reordered
+   chain.  Make it happen so.  */
+static basic_block
+fixup_fallthru_exit_predecesor ()
+{
+  edge e;
+  basic_block bb = NULL;
+
+  for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
+    if (e->flags & EDGE_FALLTHRU)
+      bb = e->src;
+  if (bb && RBI (bb)->next)
+    {
+      basic_block c = BASIC_BLOCK (0);
+      while (RBI (c)->next != bb)
+       c = RBI (c)->next;
+      RBI (c)->next = RBI (bb)->next;
+      while (RBI (c)->next)
+       c = RBI (c)->next;
+      RBI (c)->next = bb;
+      RBI (bb)->next = NULL;
+    }
+}
 \f
 /* Main entry point to this module - initialize the datastructures for
    CFG layout changes.  */
@@ -1062,6 +1087,7 @@ cfg_layout_initialize ()
 void
 cfg_layout_finalize ()
 {
+  fixup_fallthru_exit_predecesor ();
   fixup_reorder_chain ();
 #ifdef ENABLE_CHECKING
   verify_insn_chain ();
index 3bfa204f4e514ec08f43c3c1359597c1f2b03829..c5cc0a4a27b33e127fae00307a42df62faec0911 100644 (file)
@@ -540,6 +540,7 @@ expected_value_to_br_prob ()
            {
              ev = NOTE_EXPECTED_VALUE (insn);
              ev_reg = XEXP (ev, 0);
+             delete_insn (insn);
            }
          continue;