Small patch to expand_call

Jason Merrill jason@cygnus.com
Tue Apr 25 16:26:00 GMT 2000


Now that we have a function dedicated to extracting the FUNCTION_DECL
from a CALL_EXPR, we ought to use it.

2000-04-26  Jason Merrill  <jason@casey.cygnus.com>

	* calls.c (expand_call): Use get_callee_fndecl.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.123
diff -c -p -r1.123 calls.c
*** calls.c	2000/04/20 12:20:38	1.123
--- calls.c	2000/04/25 22:59:14
*************** expand_call (exp, target, ignore)
*** 1982,2025 ****
    /* See if we can find a DECL-node for the actual function.
       As a result, decide whether this is a call to an integrable function.  */
  
!   p = TREE_OPERAND (exp, 0);
!   if (TREE_CODE (p) == ADDR_EXPR)
      {
!       fndecl = TREE_OPERAND (p, 0);
!       if (TREE_CODE (fndecl) != FUNCTION_DECL)
! 	fndecl = 0;
!       else
  	{
! 	  if (!flag_no_inline
! 	      && fndecl != current_function_decl
! 	      && DECL_INLINE (fndecl)
! 	      && DECL_SAVED_INSNS (fndecl)
! 	      && DECL_SAVED_INSNS (fndecl)->inlinable)
! 	    is_integrable = 1;
! 	  else if (! TREE_ADDRESSABLE (fndecl))
! 	    {
! 	      /* In case this function later becomes inlinable,
! 		 record that there was already a non-inline call to it.
  
! 		 Use abstraction instead of setting TREE_ADDRESSABLE
! 		 directly.  */
! 	      if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
! 		  && optimize > 0)
! 		{
! 		  warning_with_decl (fndecl, "can't inline call to `%s'");
! 		  warning ("called from here");
! 		}
! 	      mark_addressable (fndecl);
  	    }
! 
! 	  flags |= flags_from_decl_or_type (fndecl);
  	}
      }
  
    /* If we don't have specific function to call, see if we have a 
       attributes set in the type.  */
!   if (fndecl == 0)
!     flags |= flags_from_decl_or_type (TREE_TYPE (TREE_TYPE (p)));
  
  #ifdef REG_PARM_STACK_SPACE
  #ifdef MAYBE_REG_PARM_STACK_SPACE
--- 1982,2022 ----
    /* See if we can find a DECL-node for the actual function.
       As a result, decide whether this is a call to an integrable function.  */
  
!   fndecl = get_callee_fndecl (exp);
!   if (fndecl)
      {
!       if (!flag_no_inline
! 	  && fndecl != current_function_decl
! 	  && DECL_INLINE (fndecl)
! 	  && DECL_SAVED_INSNS (fndecl)
! 	  && DECL_SAVED_INSNS (fndecl)->inlinable)
! 	is_integrable = 1;
!       else if (! TREE_ADDRESSABLE (fndecl))
  	{
! 	  /* In case this function later becomes inlinable,
! 	     record that there was already a non-inline call to it.
  
! 	     Use abstraction instead of setting TREE_ADDRESSABLE
! 	     directly.  */
! 	  if (DECL_INLINE (fndecl) && warn_inline && !flag_no_inline
! 	      && optimize > 0)
! 	    {
! 	      warning_with_decl (fndecl, "can't inline call to `%s'");
! 	      warning ("called from here");
  	    }
! 	  mark_addressable (fndecl);
  	}
+ 
+       flags |= flags_from_decl_or_type (fndecl);
      }
  
    /* If we don't have specific function to call, see if we have a 
       attributes set in the type.  */
!   else
!     {
!       p = TREE_OPERAND (exp, 0);
!       flags |= flags_from_decl_or_type (TREE_TYPE (TREE_TYPE (p)));
!     }
  
  #ifdef REG_PARM_STACK_SPACE
  #ifdef MAYBE_REG_PARM_STACK_SPACE


More information about the Gcc-patches mailing list