OSDN Git Service

PR target/10907
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jul 2003 16:33:22 +0000 (16:33 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jul 2003 16:33:22 +0000 (16:33 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69515 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5cdf4b6..44832d1 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 444e882..b277eb0 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):