OSDN Git Service

PR rtl-optimization/49941
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 15 Oct 2011 10:32:33 +0000 (10:32 +0000)
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 15 Oct 2011 10:32:33 +0000 (10:32 +0000)
* jump.c (mark_jump_label_1): Set JUMP_LABEL for simple_return jumps.

* rtl.h (set_return_jump_label): Declare.
* function.c (set_return_jump_label): New function, extracted..
(thread_prologue_and_epilogue_insns): ..from here.  Use it in
another instance to set return jump_label.
* cfgrtl.c (force_nonfallthru_and_redirect): Use set_return_jump_label.
* reorg.c (find_end_label): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180027 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgrtl.c
gcc/function.c
gcc/jump.c
gcc/reorg.c
gcc/rtl.h

index 2bc40b0..960b79b 100644 (file)
@@ -1,3 +1,15 @@
+2011-10-15  Alan Modra  <amodra@gmail.com>
+
+       PR rtl-optimization/49941
+       * jump.c (mark_jump_label_1): Set JUMP_LABEL for simple_return jumps.
+
+       * rtl.h (set_return_jump_label): Declare.
+       * function.c (set_return_jump_label): New function, extracted..
+       (thread_prologue_and_epilogue_insns): ..from here.  Use it in
+       another instance to set return jump_label.
+       * cfgrtl.c (force_nonfallthru_and_redirect): Use set_return_jump_label.
+       * reorg.c (find_end_label): Likewise.
+
 2011-10-14  David S. Miller  <davem@davemloft.net>
 
        * config/sparc/sol2.h: Protect -m{cpu,tune}=native handling
index b3f045b..f06dbc8 100644 (file)
@@ -1273,7 +1273,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
          gcc_unreachable ();
 #endif
        }
-      JUMP_LABEL (BB_END (jump_block)) = jump_label;
+      set_return_jump_label (BB_END (jump_block));
     }
   else
     {
index c469ab9..c3702fb 100644 (file)
@@ -5527,6 +5527,20 @@ emit_return_into_block (bool simple_p, basic_block bb)
 }
 #endif
 
+/* Set JUMP_LABEL for a return insn.  */
+
+void
+set_return_jump_label (rtx 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;
+}
+
 /* Return true if BB has any active insns.  */
 static bool
 bb_active_p (basic_block bb)
@@ -6062,7 +6076,7 @@ thread_prologue_and_epilogue_insns (void)
          emit_return_into_block (false, last_bb);
          epilogue_end = BB_END (last_bb);
          if (JUMP_P (epilogue_end))
-           JUMP_LABEL (epilogue_end) = ret_rtx;
+           set_return_jump_label (epilogue_end);
          single_succ_edge (last_bb)->flags &= ~EDGE_FALLTHRU;
          goto epilogue_done;
        }
@@ -6127,15 +6141,7 @@ thread_prologue_and_epilogue_insns (void)
       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;
-       }
+       set_return_jump_label (returnjump);
     }
   else
 #endif
index 0273adf..f852f82 100644 (file)
@@ -1086,6 +1086,7 @@ mark_jump_label_1 (rtx x, rtx insn, bool in_mem, bool is_target)
       return;
 
     case RETURN:
+    case SIMPLE_RETURN:
       if (is_target)
        {
          gcc_assert (JUMP_LABEL (insn) == NULL || JUMP_LABEL (insn) == x);
@@ -1408,7 +1409,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx insn)
   int i;
   const char *fmt;
 
-      if ((code == LABEL_REF && XEXP (x, 0) == olabel)
+  if ((code == LABEL_REF && XEXP (x, 0) == olabel)
       || x == olabel)
     {
       x = redirect_target (nlabel);
index 179bf5f..f77a3a0 100644 (file)
@@ -467,7 +467,7 @@ find_end_label (rtx kind)
              /* The return we make may have delay slots too.  */
              rtx insn = gen_return ();
              insn = emit_jump_insn (insn);
-             JUMP_LABEL (insn) = ret_rtx;
+             set_return_jump_label (insn);
              emit_barrier ();
              if (num_delay_slots (insn) > 0)
                obstack_ptr_grow (&unfilled_slots_obstack, insn);
index 567aff9..f13485e 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2503,6 +2503,7 @@ extern int sibcall_epilogue_contains (const_rtx);
 extern void mark_temp_addr_taken (rtx);
 extern void update_temp_slot_address (rtx, rtx);
 extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
+extern void set_return_jump_label (rtx);
 
 /* In stmt.c */
 extern void expand_null_return (void);