re PR target/10907 ([IA64] gcc violates the ia64 ABI)
authorRichard Henderson <rth@redhat.com>
Thu, 17 Jul 2003 16:33:22 +0000 (09:33 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 17 Jul 2003 16:33:22 +0000 (09:33 -0700)
        PR target/10907
        * config/ia64/ia64.c (ia64_epilogue_uses): GP is live at end
        even with !TARGET_CONST_GP.
        (ia64_function_ok_for_sibcall): Reject non-local functions.

From-SVN: r69515

gcc/ChangeLog
gcc/config/ia64/ia64.c

index 5cdf4b67b2f77768e47673d0e5bd19d1a19505cd..44832d1e2105a458cb546c25dbbfeb6a637c3cf1 100644 (file)
@@ -1,3 +1,10 @@
+2003-07-17  Richard Henderson  <rth@redhat.com>
+
+        PR target/10907
+        * config/ia64/ia64.c (ia64_epilogue_uses): GP is live at end
+        even with !TARGET_CONST_GP.
+        (ia64_function_ok_for_sibcall): Reject non-local functions.
+
 2003-07-17  Steven Bosscher  <steven@gcc.gnu.org>
 
        * c-common.c (c_estimate_num_insns_1): Don't handle
index 444e882457d125fb7935a1fd7c56ac39cdd4bbb6..b277eb0e2b011bf8360e0646677ac03234793533 100644 (file)
@@ -3642,14 +3642,9 @@ ia64_function_ok_for_sibcall (decl, exp)
      tree decl;
      tree exp ATTRIBUTE_UNUSED;
 {
-  /* Direct calls are always ok.  */
-  if (decl)
-    return true;
-
-  /* If TARGET_CONST_GP is in effect, then our caller expects us to
-     return with our current GP.  This means that we'll always have
-     a GP reload after an indirect call.  */
-  return !ia64_epilogue_uses (R_GR (1));
+  /* We must always return with our current GP.  This means we can
+     only sibcall to functions defined in the current module.  */
+  return decl && (*targetm.binds_local_p) (decl);
 }
 \f
 
@@ -7356,12 +7351,11 @@ ia64_epilogue_uses (regno)
   switch (regno)
     {
     case R_GR (1):
-      /* When a function makes a call through a function descriptor, we
-         will write a (potentially) new value to "gp".  After returning
-         from such a call, we need to make sure the function restores the
-         original gp-value, even if the function itself does not use the
-         gp anymore.  */
-      return (TARGET_CONST_GP && !(TARGET_AUTO_PIC || TARGET_NO_PIC));
+      /* With a call to a function in another module, we will write a new
+        value to "gp".  After returning from such a call, we need to make
+        sure the function restores the original gp-value, even if the
+        function itself does not use the gp anymore.  */
+      return !(TARGET_AUTO_PIC || TARGET_NO_PIC);
 
     case IN_REG (0): case IN_REG (1): case IN_REG (2): case IN_REG (3):
     case IN_REG (4): case IN_REG (5): case IN_REG (6): case IN_REG (7):