]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
combine.c (simplify_rtx): Obey CLASS_CANNOT_CHANGE_SIZE when simplifying a subreg...
authorRichard Henderson <rth@cygnus.com>
Tue, 17 Feb 1998 21:55:52 +0000 (13:55 -0800)
committerJeff Law <law@gcc.gnu.org>
Tue, 17 Feb 1998 21:55:52 +0000 (14:55 -0700)
        * combine.c (simplify_rtx): Obey CLASS_CANNOT_CHANGE_SIZE when
        simplifying a subreg of a hard reg.
        (expand_compound_operation): Likewise.
        (force_to_mode): Likewise.

From-SVN: r18053

gcc/ChangeLog
gcc/combine.c

index 8174fd56a162eaf18b7bea91749261650c6c4e61..1e51a0836d4cfba9f5efee3a403327722c7964dc 100644 (file)
@@ -1,3 +1,10 @@
+Tue Feb 17 22:56:14 1998  Richard Henderson  <rth@cygnus.com>
+
+       * combine.c (simplify_rtx): Obey CLASS_CANNOT_CHANGE_SIZE when
+       simplifying a subreg of a hard reg.
+       (expand_compound_operation): Likewise.
+       (force_to_mode): Likewise.
+
 Sun Feb 15 21:07:48 1998  Jeffrey A Law  (law@cygnus.com)
 
        * arm/netbsd.h (DWARF2_UNWIND_INFO): Define as zero for now.
index 2fd6246e2ef394a90515b66b0491aa69d828b746..bc37d61c7a2f96994696727fbec95ccfd9bdd370 100644 (file)
@@ -3367,6 +3367,13 @@ simplify_rtx (x, op0_mode, last, in_dest)
 
       if (GET_CODE (SUBREG_REG (x)) == REG
          && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
+#ifdef CLASS_CANNOT_CHANGE_SIZE
+         && (! (TEST_HARD_REG_BIT
+                (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
+                 REGNO (SUBREG_REG (x))))
+             || (GET_MODE_SIZE (mode)
+                 == GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
+#endif
          && REGNO (SUBREG_REG (x)) != FRAME_POINTER_REGNUM
 #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
          && REGNO (SUBREG_REG (x)) != HARD_FRAME_POINTER_REGNUM
@@ -4979,6 +4986,20 @@ expand_compound_operation (x)
   int modewidth;
   rtx tem;
 
+#ifdef CLASS_CANNOT_CHANGE_SIZE
+  /* When dealing with hard regs that cannot change size, don't even try
+     expanding to shifts, since we wind up violating the rule.  */
+  if (GET_RTX_CLASS (GET_CODE (x)) == '1'
+      && GET_CODE (XEXP (x, 0)) == REG
+      && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
+      && (TEST_HARD_REG_BIT
+         (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
+          REGNO (SUBREG_REG (x))))
+      && (GET_MODE_SIZE (GET_MODE (x))
+         != GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
+    return x;
+#endif
+
   switch (GET_CODE (x))
     {
     case ZERO_EXTEND:
@@ -6085,6 +6106,17 @@ force_to_mode (x, mode, mask, reg, just_select)
       break;
 
     case SUBREG:
+#ifdef CLASS_CANNOT_CHANGE_SIZE
+      if (GET_CODE (SUBREG_REG (x)) == REG
+         && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
+         && (TEST_HARD_REG_BIT
+             (reg_class_contents[(int) CLASS_CANNOT_CHANGE_SIZE],
+              REGNO (SUBREG_REG (x))))
+         && (GET_MODE_SIZE (GET_MODE (x))
+             != GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
+       return x;
+#endif
+
       if (subreg_lowpart_p (x)
          /* We can ignore the effect of this SUBREG if it narrows the mode or
             if the constant masks to zero all the bits the mode doesn't