rs6000.c (secondary_reload_class): Fix Darwin specific misuse of r0 as a reload address.
authorDale Johannesen <dalej@apple.com>
Fri, 18 May 2001 22:01:54 +0000 (22:01 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Fri, 18 May 2001 22:01:54 +0000 (22:01 +0000)
2001-05-18  Dale Johannesen  <dalej@apple.com>

        * config/rs6000/rs6000.c (secondary_reload_class): Fix Darwin
        specific misuse of r0 as a reload address.

From-SVN: r42287

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index e89fddc56f029fcc4015c7137440aa7e3d5bbd62..6ff92046539fd39a4417f4e09d68911e2ac5c977 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-18  Dale Johannesen  <dalej@apple.com>
+
+       * config/rs6000/rs6000.c (secondary_reload_class): Fix Darwin
+       specific misuse of r0 as a reload address.
+
 Fri May 18 22:42:04 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
        * combine.c (combine_simplify_rtx): Clear op0_mode if simplification
index 8d2a799b8e3ea28d6a18aeba04b4480d548852b4..9376b2a97ea2963bf96d9c290f459f28ae48a7cb 100644 (file)
@@ -3587,17 +3587,22 @@ secondary_reload_class (class, mode, in)
 {
   int regno;
 
-#if TARGET_ELF
-  /* We can not copy a symbolic operand directly into anything other than
-     BASE_REGS for TARGET_ELF.  So indicate that a register from BASE_REGS
-     is needed as an intermediate register.  */
-  if (class != BASE_REGS
-      && (GET_CODE (in) == SYMBOL_REF
-         || GET_CODE (in) == HIGH
-         || GET_CODE (in) == LABEL_REF
-         || GET_CODE (in) == CONST))
-    return BASE_REGS;
-#endif
+  if (TARGET_ELF || (DEFAULT_ABI == ABI_DARWIN && flag_pic))
+    {
+      /* We cannot copy a symbolic operand directly into anything
+         other than BASE_REGS for TARGET_ELF.  So indicate that a
+         register from BASE_REGS is needed as an intermediate
+         register.
+         
+        On Darwin, pic addresses require a load from memory, which
+        needs a base register.  */
+      if (class != BASE_REGS
+          && (GET_CODE (in) == SYMBOL_REF
+              || GET_CODE (in) == HIGH
+              || GET_CODE (in) == LABEL_REF
+              || GET_CODE (in) == CONST))
+        return BASE_REGS;
+    }
 
   if (GET_CODE (in) == REG)
     {