final.c (alter_subreg): Allow the target to hook by-mode subreg hard register number...
authorRichard Henderson <rth@cygnus.com>
Thu, 2 Apr 1998 01:56:17 +0000 (17:56 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 2 Apr 1998 01:56:17 +0000 (17:56 -0800)
* final.c (alter_subreg): Allow the target to hook by-mode subreg
hard register number changes.

From-SVN: r18946

gcc/ChangeLog
gcc/final.c
gcc/tm.texi

index 9eea255533b131969aa42b461041b77c2c099153..578b9b7ac9bf9f72b94c1c3c435ad94456db113c 100644 (file)
@@ -5,6 +5,8 @@ Thu Apr  2 01:01:34 1998  Richard Henderson  <rth@cygnus.com>
 
        * emit-rtl.c (gen_lowpart_common): Skip count by HARD_REGNO_NREGS.
        (gen_highpart): Likewise.
+       * final.c (alter_subreg): Allow the target to hook by-mode subreg
+       hard register number changes.
        
 Wed Apr  1 22:26:22 1998  Jeffrey A Law  (law@cygnus.com)
 
index 74a6d15d74370062289ec2a77e265c9939800bb8..6b851f20be745f3fb5a84f924d10bc054dbcba73 100644 (file)
@@ -2891,9 +2891,20 @@ alter_subreg (x)
 
   if (GET_CODE (y) == REG)
     {
-      /* If the containing reg really gets a hard reg, so do we.  */
+      /* If the word size is larger than the size of this register,
+        adjust the register number to compensate.  */
+      /* ??? Note that this just catches stragglers created by/for
+        integrate.  It would be better if we either caught these
+        earlier, or kept _all_ subregs until now and eliminate
+        gen_lowpart and friends.  */
+
       PUT_CODE (x, REG);
+#ifdef ALTER_HARD_SUBREG
+      REGNO (x) = ALTER_HARD_SUBREG(GET_MODE (x), SUBREG_WORD (x),
+                                   GET_MODE (y), REGNO (y));
+#else
       REGNO (x) = REGNO (y) + SUBREG_WORD (x);
+#endif
     }
   else if (GET_CODE (y) == MEM)
     {
index d8fb72407751824aefc0be2203531d68dd736965..ad578386be67d109d81ac380ea187f099abd0cf4 100644 (file)
@@ -1403,6 +1403,17 @@ definition of this macro is
     / UNITS_PER_WORD))
 @end smallexample
 
+@findex ALTER_HARD_SUBREG
+@item ALTER_HARD_SUBREG (@var{tgt_mode}, @var{word}, @var{src_mode}, @var{regno})
+A C expression that returns an adjusted hard register number for 
+
+@smallexample
+(subreg:@var{tgt_mode} (reg:@var{src_mode} @var{regno}) @var{word})
+@end smallexample
+
+This may be needed if the target machine has mixed sized big-endian
+registers, like Sparc v9.
+
 @findex HARD_REGNO_MODE_OK
 @item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
 A C expression that is nonzero if it is permissible to store a value