sibcall.c (skip_pic_restore): New.
authorRichard Henderson <rth@cygnus.com>
Sun, 24 Sep 2000 23:49:22 +0000 (16:49 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 24 Sep 2000 23:49:22 +0000 (16:49 -0700)
        * sibcall.c (skip_pic_restore): New.
        (identify_call_return_value): Use it.

From-SVN: r36596

gcc/ChangeLog
gcc/sibcall.c

index 7507986d61e52eb7980fdc013e6a6c0ba20d1600..0e48841c911ca9705f99d2cf61b6b8237a85e14d 100644 (file)
@@ -2,6 +2,9 @@
 
        * emit-rtl.c (gen_lowpart_common): Use trunc_int_for_mode.
 
+       * sibcall.c (skip_pic_restore): New.
+       (identify_call_return_value): Use it.
+
 2000-09-24  Mark Mitchell  <mark@codesourcery.com>
 
        * c-tree.texi: Moved here from cp/ir.texi.  Documented nested
index 42a9d70fb815a3ef35a8e1e40b3a76f643022672..eaf9ae76fe58c654835eb3e49cca10ae474b70ab 100644 (file)
@@ -36,6 +36,7 @@ static int identify_call_return_value PARAMS ((rtx, rtx *, rtx *));
 static rtx skip_copy_to_return_value   PARAMS ((rtx, rtx, rtx));
 static rtx skip_use_of_return_value    PARAMS ((rtx, enum rtx_code));
 static rtx skip_stack_adjustment       PARAMS ((rtx));
+static rtx skip_pic_restore            PARAMS ((rtx));
 static rtx skip_jump_insn              PARAMS ((rtx));
 static int uses_addressof              PARAMS ((rtx));
 static int sequence_uses_addressof     PARAMS ((rtx));
@@ -82,6 +83,11 @@ identify_call_return_value (cp, p_hard_return, p_soft_return)
   if (! insn)
     return 0;
 
+  /* Restore of GP register may appear here.  */
+  insn = skip_pic_restore (insn);
+  if (! insn)
+    return 0;
+
   /* If there's nothing after, there's no soft return value.  */
   insn = NEXT_INSN (insn);
   if (! insn)
@@ -199,10 +205,6 @@ skip_stack_adjustment (orig_insn)
   if (insn)
     set = single_set (insn);
 
-  /* The source must be the same as the current function's return value to
-     ensure that any return value is put in the same place by the current
-     function and the function we're calling.   The destination register
-     must be a pseudo.  */
   if (insn
       && set
       && GET_CODE (SET_SRC (set)) == PLUS
@@ -211,8 +213,26 @@ skip_stack_adjustment (orig_insn)
       && SET_DEST (set) == stack_pointer_rtx)
     return insn;
 
-  /* It did not look like a copy of the return value, so return the
-     same insn we were passed.  */
+  return orig_insn;
+}
+
+/* If the first real insn after ORIG_INSN sets the pic register,
+   return it.  Otherwise return ORIG_INSN.  */
+
+static rtx
+skip_pic_restore (orig_insn)
+     rtx orig_insn;
+{
+  rtx insn, set = NULL_RTX;
+
+  insn = next_nonnote_insn (orig_insn);
+
+  if (insn)
+    set = single_set (insn);
+
+  if (insn && set && SET_DEST (set) == pic_offset_table_rtx)
+    return insn;
+
   return orig_insn;
 }