From 623a66fa858ef308693b61e33f2c7ba6686d3151 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Mon, 14 Jun 2004 12:09:08 +0000 Subject: basic-block.h (could_fall_through): Declare. * basic-block.h (could_fall_through): Declare. * cfganal.c (can_fallthru): Succeed if the target is EXIT_BLOCK_PTR. Fail if the source already has a fallthrough edge to the exit block pointer. (could_fall_through): New function. * cfgbuild.c (make_edges): Check if we already have a fallthrough edge to the exit block pointer. * cfglayout.c (fixup_fallthru_exit_predecessor): Check that it is not called before reload has completed. Handle special case of first block having a fall-through exit edge. (cfg_layout_finalize): Don't call it before reload or if we have rtl epilogues. (fixup_reorder_chain): A fall through to the exit block does not require the block to come last. Add sanity checks. * cfgrtl.c (rtl_split_edge): Add special handling of fall through edges to the exit block. * function.c (cfglayout.h): #include. (thread_prologue_and_epilogue_insns): If we have neither return nor epilogue, but a fall through to the exit block from mid-function, force a non-fall-through exit. * Makefile.in (function.o): Depend on CFGLAYOUT_H. From-SVN: r83089 --- gcc/cfgrtl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/cfgrtl.c') diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index cdfde6f..6e22d80 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1336,7 +1336,19 @@ rtl_split_edge (edge edge_in) else before = NULL_RTX; - bb = create_basic_block (before, NULL, edge_in->dest->prev_bb); + /* If this is a fall through edge to the exit block, the blocks might be + not adjacent, and the right place is the after the source. */ + if (edge_in->flags & EDGE_FALLTHRU && edge_in->dest == EXIT_BLOCK_PTR) + { + before = NEXT_INSN (BB_END (edge_in->src)); + if (before + && GET_CODE (before) == NOTE + && NOTE_LINE_NUMBER (before) == NOTE_INSN_LOOP_END) + before = NEXT_INSN (before); + bb = create_basic_block (before, NULL, edge_in->src); + } + else + bb = create_basic_block (before, NULL, edge_in->dest->prev_bb); /* ??? This info is likely going to be out of date very soon. */ if (edge_in->dest->global_live_at_start) -- cgit v1.1