This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sibcall identification tweek


IA-64 has a call-clobbered GP register, which means that
it must be restored after every function call.  This
interferred with the identification of tail calls.


r~


        * sibcall.c (skip_pic_restore): New.
        (identify_call_return_value): Use it.

Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/sibcall.c,v
retrieving revision 1.8
diff -c -p -d -r1.8 sibcall.c
*** sibcall.c	2000/08/12 16:28:10	1.8
--- sibcall.c	2000/09/24 23:04:49
*************** static int identify_call_return_value	PA
*** 36,41 ****
--- 36,42 ----
  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));
*************** identify_call_return_value (cp, p_hard_r
*** 82,87 ****
--- 83,93 ----
    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)
*************** skip_stack_adjustment (orig_insn)
*** 199,208 ****
    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
--- 205,210 ----
*************** skip_stack_adjustment (orig_insn)
*** 211,218 ****
        && 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;
  }
  
--- 213,238 ----
        && SET_DEST (set) == stack_pointer_rtx)
      return insn;
  
!   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;
  }
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]