final.c (alter_subreg): If simplify_subreg can't do anything, handle REG ourselves...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Thu, 15 Nov 2001 14:58:19 +0000 (14:58 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 15 Nov 2001 14:58:19 +0000 (09:58 -0500)
* final.c (alter_subreg): If simplify_subreg can't do anything,
handle REG ourselves and abort for others.

From-SVN: r47058

gcc/ChangeLog
gcc/final.c

index 0cec809d65965cfba7c209b10b7878b1b2eaead8..aac12db4cc3700afbe1cc161f414c14471bee55f 100644 (file)
@@ -1,3 +1,8 @@
+Thu Nov 15 08:36:39 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * final.c (alter_subreg): If simplify_subreg can't do anything,
+       handle REG ourselves and abort for others.
+
 2001-11-15  Richard Hodson  <hodsonr@dionecorp.com>
 
        * config/h8300/h8300.c (dosize): Avoid corrupting R3 in interrupt
index 733503e942480c9497887243f8b251cf447c8ec6..9302feae7eda0d2d09411bd87e290ccc0e6e7b4f 100644 (file)
@@ -3038,7 +3038,26 @@ alter_subreg (xp)
   if (GET_CODE (y) == MEM)
     *xp = adjust_address (y, GET_MODE (x), SUBREG_BYTE (x));
   else
-    *xp = simplify_subreg (GET_MODE (x), y, GET_MODE (y), SUBREG_BYTE (x));
+    {
+      rtx new = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
+                                SUBREG_BYTE (x));
+
+      if (new != 0)
+       *xp = new;
+      /* Simplify_subreg can't handle some REG cases, but we have to.  */
+      else if (GET_CODE (y) == REG)
+       {
+         REGNO (x) = subreg_hard_regno (x, 1);
+         PUT_CODE (x, REG);
+         ORIGINAL_REGNO (x) = ORIGINAL_REGNO (y);
+         /* This field has a different meaning for REGs and SUBREGs.  Make
+            sure to clear it!  */
+         x->used = 0;
+       }
+      else
+       abort ();
+    }
+
   return *xp;
 }