public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 4/6] Shrink-wrapping
Date: Wed, 03 Aug 2011 10:42:00 -0000	[thread overview]
Message-ID: <20110803104143.GI26813@bubble.grove.modra.org> (raw)
In-Reply-To: <4E313B82.8050403@codesourcery.com>

On Thu, Jul 28, 2011 at 12:35:46PM +0200, Bernd Schmidt wrote:
[snip]
> 	* rtl.h (ANY_RETURN_P): New macro.
[snip]

This patch makes rebuild_jump_labels set JUMP_LABEL appropriately
for return jumps, and fixes sharing for RETURN.  Since ANY_RETURN_P(X)
is defined as ((X) == ret_rtx), RETURNs need to stay shared.
Bootstrapped and regression tested powerpc-linux and powerpc64-linux.
OK to apply?

	PR rtl-optimization/49941
	* jump.c (mark_jump_label): Comment.
	(mark_jump_label_1): Set JUMP_LABEL for return jumps.
	* emit-rtl.c (copy_rtx_if_shared_1, copy_insn_1): Leave RETURN shared.
	(mark_used_flags): Don't mark RETURN.

Index: gcc/jump.c
===================================================================
--- gcc/jump.c	(revision 177084)
+++ gcc/jump.c	(working copy)
@@ -1039,6 +1039,7 @@ sets_cc0_p (const_rtx x)
    notes.  If INSN is an INSN or a CALL_INSN or non-target operands of
    a JUMP_INSN, and there is at least one CODE_LABEL referenced in
    INSN, add a REG_LABEL_OPERAND note containing that label to INSN.
+   For returnjumps, the JUMP_LABEL will also be set as appropriate.
 
    Note that two labels separated by a loop-beginning note
    must be kept distinct if we have not yet done loop-optimization,
@@ -1081,6 +1082,14 @@ mark_jump_label_1 (rtx x, rtx insn, bool
     case CALL:
       return;
 
+    case RETURN:
+      if (is_target)
+	{
+	  gcc_assert (JUMP_LABEL (insn) == NULL || JUMP_LABEL (insn) == x);
+	  JUMP_LABEL (insn) = x;
+	}
+      return;
+
     case MEM:
       in_mem = true;
       break;
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 177084)
+++ gcc/emit-rtl.c	(working copy)
@@ -2724,6 +2724,7 @@ repeat:
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
     case SCRATCH:
       /* SCRATCH must be shared because they represent distinct values.  */
       return;
@@ -2843,6 +2844,7 @@ repeat:
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
       return;
 
     case DEBUG_INSN:
@@ -5257,6 +5259,7 @@ copy_insn_1 (rtx orig)
     case CODE_LABEL:
     case PC:
     case CC0:
+    case RETURN:
       return orig;
     case CLOBBER:
       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)

-- 
Alan Modra
Australia Development Lab, IBM

  parent reply	other threads:[~2011-08-03 10:42 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 14:44 Shrink-wrapping: Introduction Bernd Schmidt
2011-03-23 14:46 ` [PATCH 1/6] Disallow predicating the prologue Bernd Schmidt
2011-03-31 13:20   ` Jeff Law
2011-04-01 18:59   ` H.J. Lu
2011-04-01 21:08     ` Bernd Schmidt
2011-03-23 14:48 ` [PATCH 2/6] Unique return rtx Bernd Schmidt
2011-03-31 13:23   ` Jeff Law
2011-05-03 11:54     ` Bernd Schmidt
2011-03-23 14:51 ` [PATCH 3/6] Allow jumps in epilogues Bernd Schmidt
2011-03-23 16:46   ` Richard Henderson
2011-03-23 16:49     ` Bernd Schmidt
2011-03-23 17:19       ` Richard Henderson
2011-03-23 17:24         ` Bernd Schmidt
2011-03-23 17:27           ` Richard Henderson
2011-03-24 10:30             ` Bernd Schmidt
2011-03-25 17:51         ` Bernd Schmidt
2011-03-26  5:33           ` Richard Henderson
2011-03-31 20:09             ` Bernd Schmidt
2011-03-31 21:51               ` Richard Henderson
2011-03-31 22:36                 ` Bernd Schmidt
2011-03-31 23:57                   ` Richard Henderson
2011-04-05 21:59                 ` Bernd Schmidt
2011-04-11 17:10                   ` Richard Henderson
2011-04-13 14:16                     ` Bernd Schmidt
2011-04-13 15:14                       ` Bernd Schmidt
2011-04-13 15:16                       ` Bernd Schmidt
2011-04-13 15:17                       ` Bernd Schmidt
2011-04-13 15:28                     ` Bernd Schmidt
2011-04-13 14:44                       ` Richard Henderson
2011-04-13 14:54                         ` Jakub Jelinek
2011-04-15 16:29                       ` Bernd Schmidt
2011-03-23 14:56 ` [PATCH 5/6] Generate more shrink-wrapping opportunities Bernd Schmidt
2011-03-23 15:03   ` Jeff Law
2011-03-23 15:05     ` Bernd Schmidt
2011-03-23 15:18       ` Jeff Law
2011-03-31 13:26   ` Jeff Law
2011-03-31 13:34     ` Bernd Schmidt
2011-03-23 14:56 ` [PATCH 4/6] Shrink-wrapping Bernd Schmidt
2011-07-07 14:51   ` Richard Sandiford
2011-07-07 15:40     ` Bernd Schmidt
2011-07-07 17:00       ` Paul Koning
2011-07-07 17:02         ` Jeff Law
2011-07-07 17:05           ` Paul Koning
2011-07-07 17:08             ` Jeff Law
2011-07-07 17:30             ` Bernd Schmidt
2011-07-08 22:59             ` [pdp11] Emit prologue as rtl Richard Henderson
2011-07-09 13:46               ` Paul Koning
2011-07-09 16:53                 ` Richard Henderson
2011-07-07 15:57     ` [PATCH 4/6] Shrink-wrapping Richard Earnshaw
2011-07-07 20:19       ` Richard Sandiford
2011-07-08  8:30         ` Richard Earnshaw
2011-07-08 13:57         ` Bernd Schmidt
2011-07-11 11:24           ` Richard Sandiford
2011-07-11 11:42             ` Bernd Schmidt
2011-07-21  3:57     ` Bernd Schmidt
2011-07-21 11:25       ` Richard Sandiford
2011-07-28 11:48         ` Bernd Schmidt
2011-07-28 12:45           ` Richard Sandiford
2011-07-28 23:30           ` Richard Earnshaw
2011-07-29 12:40             ` Bernd Schmidt
2011-08-03 10:42           ` Alan Modra [this message]
2011-08-03 11:19             ` Bernd Schmidt
2011-08-02  8:40     ` Bernd Schmidt
2011-08-03 15:39       ` Richard Sandiford
2011-08-24 19:23         ` Bernd Schmidt
2011-08-24 20:48           ` Richard Sandiford
2011-08-24 20:55             ` Bernd Schmidt
2011-08-26 14:49               ` Ramana Radhakrishnan
2011-08-26 14:58                 ` Bernd Schmidt
2011-08-26 15:06                   ` Ramana Radhakrishnan
2011-08-28 10:58           ` H.J. Lu
2011-07-07 21:41   ` Michael Hope
2011-03-23 14:57 ` [PATCH 6/6] A testcase Bernd Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110803104143.GI26813@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).