Small tweak to reorg.c

Message ID 5538124.PqTo554e31@polaris
State New
Headers show
Series
  • Small tweak to reorg.c
Related show

Commit Message

Eric Botcazou Oct. 2, 2018, 10:20 a.m.
This changes make_return_insns to using emit_copy_of_insn_after when it needs 
to re-emit insns that were put in a delay slot, like routines doing the same 
thing in the file, and re-emitting the jump insn directly.

Tested on SPARC/Solaris, applied on the mainline.


2018-10-02  Eric Botcazou  <ebotcazou@adacore.com>

	* reorg.c (make_return_insns): Use emit_copy_of_insn_after for the
	insns in the delay slot and add_insn_after for the jump insn.

-- 
Eric Botcazou

Patch

Index: reorg.c
===================================================================
--- reorg.c	(revision 264732)
+++ reorg.c	(working copy)
@@ -3638,18 +3638,13 @@  make_return_insns (rtx_insn *first)
 	 insns for its delay slots, if it needs some.  */
       if (ANY_RETURN_P (PATTERN (jump_insn)))
 	{
-	  rtx_insn *prev = PREV_INSN (insn);
+	  rtx_insn *after = PREV_INSN (insn);
 
 	  delete_related_insns (insn);
-	  for (i = 1; i < XVECLEN (pat, 0); i++)
-	    {
-	      rtx_insn *in_seq_insn = as_a<rtx_insn *> (XVECEXP (pat, 0, i));
-	      prev = emit_insn_after_setloc (PATTERN (in_seq_insn), prev,
-					     INSN_LOCATION (in_seq_insn));
-	    }
-
-	  insn = emit_jump_insn_after_setloc (PATTERN (jump_insn), prev,
-					      INSN_LOCATION (jump_insn));
+	  insn = jump_insn;
+	  for (i = 1; i < pat->len (); i++)
+	    after = emit_copy_of_insn_after (pat->insn (i), after);
+	  add_insn_after (insn, after, NULL);
 	  emit_barrier_after (insn);
 
 	  if (slots)