This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Patch to allow targets to prevent inlining


Hi Guys,

  The patch below creates a new target macro which will allows
  individual backends to prevent inlining of particular functions.

  This ability is useful for the ARM an MCore ports which support
  naked functions (ie functions whoes prologues and epilogues are
  provided by the programmer, not the compiler).  Such functions
  should not be inlined but currently there is no way to prevent
  this. 

  Is it OK to apply this patch ?

Cheers
	Nick


2000-02-14  Nick Clifton  <nickc@cygnus.com>

	* integrate.c (function_cannot_be_inline_p): If defined invoke
	TARGET_CANNOT_INLINE_P as a final test of suitability for
	inlining.

	* tm.texi (Inlining): New node: Describe macro
	TARGET_CANNOT_INLINE_P.

Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.92
diff -p -r1.92 integrate.c
*** integrate.c	2000/02/10 17:43:54	1.92
--- integrate.c	2000/02/14 23:28:38
*************** function_cannot_inline_p (fndecl)
*** 235,241 ****
--- 235,246 ----
    if (result && GET_CODE (result) == PARALLEL)
      return N_("inline functions not supported for this return value type");
  
+ #ifdef TARGET_CANNOT_INLINE_P
+   /* See if the target wishes to apply any further inlining restrictions.  */
+   return TARGET_CANNOT_INLINE_P (fndecl);
+ #else
    return 0;
+ #endif
  }
  
  /* Map pseudo reg number into the PARM_DECL for the parm living in the reg.

Index: tm.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tm.texi,v
retrieving revision 1.112
diff -p -r1.112 tm.texi
*** tm.texi	2000/02/14 10:37:12	1.112
--- tm.texi	2000/02/14 23:28:38
*************** This describes the stack layout and call
*** 2145,2150 ****
--- 2145,2151 ----
  * Caller Saves::
  * Function Entry::
  * Profiling::
+ * Inlining::
  @end menu
  
  @node Frame Layout
*************** Registers or condition codes clobbered b
*** 3627,3632 ****
--- 3628,3647 ----
  A C function or functions which are needed in the library to
  support block profiling.
  @end table
+ 
+ @node Inlining
+ @subsection Preventing Inling
+ @cindex inlining
+ 
+ If the target has particular reasons why a function cannot be inlined,
+ it may define the macro @samp{TARGET_CANNOT_INLINE_P}.  This macro
+ takes one argument, the @samp{DECL} describing the function.  The
+ function should NULL if the function @emph{can} be inlined.  Otherwise
+ is should return a pointer to a string containing a message describing
+ why the function could not be inlined.  The message will displayed if
+ the @samp{-Winline} command line switch has been given.  If the message
+ contains a @samp{%s} sequence, this will be replaced by the name of the
+ function.
  
  @node Varargs
  @section Implementing the Varargs Macros

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