From dc0ff1c802ef8a9e8075e5a8f4da9881848e08ab Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 28 Jul 2011 18:45:20 +0000 Subject: rtlanal.c (tablejump_p): False for returns. * rtlanal.c (tablejump_p): False for returns. * reorg.c (first_active_target_insn): New static function. (find_end_label): Set JUMP_LABEL for a new returnjump. (optimize_skip, get_jump_flags, rare_destination, mostly_true_jump, get_branch_condition, steal_delay_list_from_target, own_thread_p, fill_simple_delay_slots, follow_jumps, fill_slots_from_thread, fill_eager_delay_slots, relax_delay_slots, make_return_insns, dbr_schedule): Adjust to handle ret_rtx in JUMP_LABELs. * jump.c (delete_related_insns): Likewise. (jump_to_label_p): New function. (redirect_target): New static function. (redirect_exp_1): Use it. Adjust to handle ret_rtx in JUMP_LABELS. (redirect_jump_1): Assert that the new label is nonnull. (redirect_jump): Likewise. (redirect_jump_2): Check for ANY_RETURN_P rather than NULL labels. * ifcvt.c (find_if_case_1): Take care when redirecting jumps to the exit block. (dead_or_predicable): Change NEW_DEST arg to DEST_EDGE. All callers changed. Ensure that the right label is passed to redirect_jump. * function.c (emit_return_into_block, thread_prologue_and_epilogue_insns): Ensure new returnjumps have ret_rtx in their JUMP_LABEL. * print-rtl.c (print_rtx): Handle ret_rtx in a JUMP_LABEL. * emit-rtl.c (skip_consecutive_labels): Allow the caller to pass ret_rtx as label. * cfglayout.c (fixup_reorder_chain): Use force_nonfallthru_and_redirect rather than force_nonfallthru. (duplicate_insn_chain): Copy JUMP_LABELs for returns. * rtl.h (ANY_RETURN_P): New macro. (jump_to_label_p): Declare. * resource.c (find_dead_or_set_registers): Handle ret_rtx in JUMP_LABELs. (mark_target_live_regs): Likewise. * basic-block.h (force_nonfallthru_and_redirect): Declare. * cfgrtl.c (force_nonfallthru_and_redirect): No longer static. * config/alpha/alpha.c (alpha_tablejump_addr_vec, alpha_tablejump_best_label): Remove functions. * config/alpha/alpha-protos.c (alpha_tablejump_addr_vec, alpha_tablejump_best_label): Remove declarations. * config/sh/sh.c (barrier_align, split_branches): Adjust for ret_rtx in JUMP_LABELs. * config/arm/arm.c (is_jump_table): Likewise. From-SVN: r176881 --- gcc/function.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'gcc/function.c') diff --git a/gcc/function.c b/gcc/function.c index 361a8dc..c94680c 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5305,7 +5305,8 @@ emit_use_return_register_into_block (basic_block bb) static void emit_return_into_block (basic_block bb) { - emit_jump_insn_after (gen_return (), BB_END (bb)); + rtx jump = emit_jump_insn_after (gen_return (), BB_END (bb)); + JUMP_LABEL (jump) = ret_rtx; } #endif /* HAVE_return */ @@ -5464,7 +5465,7 @@ thread_prologue_and_epilogue_insns (void) that with a conditional return instruction. */ else if (condjump_p (jump)) { - if (! redirect_jump (jump, 0, 0)) + if (! redirect_jump (jump, ret_rtx, 0)) { ei_next (&ei2); continue; @@ -5547,6 +5548,8 @@ thread_prologue_and_epilogue_insns (void) #ifdef HAVE_epilogue if (HAVE_epilogue) { + rtx returnjump; + start_sequence (); epilogue_end = emit_note (NOTE_INSN_EPILOGUE_BEG); seq = gen_epilogue (); @@ -5557,11 +5560,25 @@ thread_prologue_and_epilogue_insns (void) record_insns (seq, NULL, &epilogue_insn_hash); set_insn_locators (seq, epilogue_locator); + returnjump = get_last_insn (); seq = get_insns (); end_sequence (); insert_insn_on_edge (seq, e); inserted = true; + + if (JUMP_P (returnjump)) + { + rtx pat = PATTERN (returnjump); + if (GET_CODE (pat) == PARALLEL) + pat = XVECEXP (pat, 0, 0); + if (ANY_RETURN_P (pat)) + JUMP_LABEL (returnjump) = pat; + else + JUMP_LABEL (returnjump) = ret_rtx; + } + else + returnjump = NULL_RTX; } else #endif -- cgit v1.1