From 497786446ba35ea6814862bcd76851e1379653ab Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 14 Nov 2001 20:36:17 +0100 Subject: [PATCH] cfglayout.c (fixup_fallthru_exit_predecesor): New static function. * 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 | 14 ++++++++++++++ gcc/bb-reorder.c | 23 ----------------------- gcc/c-decl.c | 7 +++++-- gcc/cfglayout.c | 26 ++++++++++++++++++++++++++ gcc/predict.c | 1 + 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7607c84292b..44c54091de0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +Wed Nov 14 19:46:08 CET 2001 Jan Hubicka + + * 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 * function.c (struct temp_slot): ALIGN now unsigned. diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 72cf90c7134..97ad1426b36 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -90,10 +90,6 @@ #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; } diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 0e4cf0c6b52..f2289fec3aa 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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 diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 5c2ee088c8a..d93d44f7fed 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -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)); /* 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; + } +} /* 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 (); diff --git a/gcc/predict.c b/gcc/predict.c index 3bfa204f4e5..c5cc0a4a27b 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -540,6 +540,7 @@ expected_value_to_br_prob () { ev = NOTE_EXPECTED_VALUE (insn); ev_reg = XEXP (ev, 0); + delete_insn (insn); } continue;