From 1b4f35b9b00351d8ccb33997dc1010b6b8ebf026 Mon Sep 17 00:00:00 2001
From: kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 4 Jun 2001 01:58:24 +0000
Subject: [PATCH] 	* reload.c (reload_inner_reg_of_subreg): Return 1 for
 PLUS. 	(push_reload): Handle non-REG in reload_inner_reg_of_subreg case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42843 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog |  5 +++++
 gcc/reload.c  | 24 +++++++++++++++---------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0bdd10cf71a2..e6d8ff537acd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun  3 21:59:51 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+	* reload.c (reload_inner_reg_of_subreg): Return 1 for PLUS.
+	(push_reload): Handle non-REG in reload_inner_reg_of_subreg case.
+
 2001-06-03  kaz Kojima  <kkojima@rr.iij4u.or.jp>
 
 	* gcc/config/sh/sh.c (print_operand_address, print_operand): Call
diff --git a/gcc/reload.c b/gcc/reload.c
index 96c073dcd2f5..a05c52a833ac 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -690,6 +690,7 @@ find_valid_class (m1, n)
    combine.  P_IN points to the corresponding value of IN, which can be
    modified by this function.
    DONT_SHARE is nonzero if we can't share any input-only reload for IN.  */
+
 static int
 find_reusable_reload (p_in, out, class, type, opnum, dont_share)
      rtx *p_in, out;
@@ -780,8 +781,8 @@ reload_inner_reg_of_subreg (x, mode)
 
   inner = SUBREG_REG (x);
 
-  /* If INNER is a constant, then INNER must be reloaded.  */
-  if (CONSTANT_P (inner))
+  /* If INNER is a constant or PLUS, then INNER must be reloaded.  */
+  if (CONSTANT_P (inner) || GET_CODE (inner) == PLUS)
     return 1;
 
   /* If INNER is not a hard register, then INNER will not need to
@@ -1030,18 +1031,23 @@ push_reload (in, out, inloc, outloc, class,
 
   if (in != 0 && reload_inner_reg_of_subreg (in, inmode))
     {
+      enum reg_class in_class = class;
+
+      if (GET_CODE (SUBREG_REG (in)) == REG)
+	in_class
+	  = find_valid_class (inmode,
+			      subreg_regno_offset (REGNO (SUBREG_REG (in)),
+						   GET_MODE (SUBREG_REG (in)),
+						   SUBREG_BYTE (in),
+						   GET_MODE (in)));
+
       /* This relies on the fact that emit_reload_insns outputs the
 	 instructions for input reloads of type RELOAD_OTHER in the same
 	 order as the reloads.  Thus if the outer reload is also of type
 	 RELOAD_OTHER, we are guaranteed that this inner reload will be
 	 output before the outer reload.  */
-      push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), (rtx*)0,
-		   find_valid_class (inmode,
-				     subreg_regno_offset (REGNO (SUBREG_REG (in)),
-							  GET_MODE (SUBREG_REG (in)),
-							  SUBREG_BYTE (in),
-							  GET_MODE (in))),
-		   VOIDmode, VOIDmode, 0, 0, opnum, type);
+      push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_RTX,
+		   in_class, VOIDmode, VOIDmode, 0, 0, opnum, type);
       dont_remove_subreg = 1;
     }
 
-- 
GitLab