This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to allow targets to prevent inlining
- To: law at cygnus dot com
- Subject: Re: Patch to allow targets to prevent inlining
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Tue, 29 Feb 2000 14:34:37 -0800
- CC: rearnsha at arm dot com, gcc-patches at gcc dot gnu dot org
Hi Guys,
Here is a revised patch. It adds a new target macro called
'FUNCTION_ATTRIBUTE_INLINABLE_P' which is used by
function_cannot_inline_p to override its new default behaviour. The
new default is to prevent inlining of functions with target specific
attributes attached.
Cheers
Nick
2000-02-29 Nick Clifton <nickc@cygnus.com>
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): If not
defined, define to return a string saying attributed functions
cannot be inlined.
(function_cannot_inline_p): If a function has one or more
target specific attributes, then use the macro
FUNCTION_ATTRIBUTE_INLINABLE_P to decide whether it can be
inlined.
* tm.texi: Add a new node 'Inlining' to document the new macro
FUNCTION_ATTRIBUTE_INLINABLE_P.
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.95
diff -p -r1.95 integrate.c
*** integrate.c 2000/02/27 02:43:43 1.95
--- integrate.c 2000/02/29 22:28:28
*************** extern struct obstack *function_maybeper
*** 62,67 ****
--- 62,72 ----
? (1 + (3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \
: (8 * (8 + list_length (DECL_ARGUMENTS (DECL)))))
#endif
+
+ #ifndef FUNCTION_ATTRIBUTE_INLINABLE_P
+ #define FUNCTION_ATTRIBUTE_INLINABLE_P(FNDECL) \
+ N_("function with target specific attribute(s) cannot be inlined");
+ #endif
static rtvec initialize_for_inline PARAMS ((tree));
static void note_modified_parmregs PARAMS ((rtx, rtx, void *));
*************** function_cannot_inline_p (fndecl)
*** 235,242 ****
result = DECL_RTL (DECL_RESULT (fndecl));
if (result && GET_CODE (result) == PARALLEL)
return N_("inline functions not supported for this return value type");
! return 0;
}
/* Map pseudo reg number into the PARM_DECL for the parm living in the reg.
--- 240,253 ----
result = DECL_RTL (DECL_RESULT (fndecl));
if (result && GET_CODE (result) == PARALLEL)
return N_("inline functions not supported for this return value type");
+
+ /* If the function has a target specific attribute attached to it,
+ then we assume that we should not inline it. This can be overriden
+ by the target if it defines FUNCTION_ATTRIBUTE_INLINABLE_P. */
+ if (DECL_MACHINE_ATTRIBUTES( fndecl))
+ return FUNCTION_ATTRIBUTE_INLINABLE_P (fndecl);
! return NULL;
}
/* 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.116
diff -p -r1.116 tm.texi
*** tm.texi 2000/02/28 21:09:54 1.116
--- tm.texi 2000/02/29 22:28:29
*************** This describes the stack layout and call
*** 2164,2169 ****
--- 2164,2170 ----
* Caller Saves::
* Function Entry::
* Profiling::
+ * Inlining::
@end menu
@node Frame Layout
*************** Registers or condition codes clobbered b
*** 3646,3651 ****
--- 3647,3665 ----
A C function or functions which are needed in the library to
support block profiling.
@end table
+
+ @node Inlining
+ @subsection Permitting inlining of functions with attributes
+ @cindex inlining
+
+ By default if a function has a target specific attribute attached to it,
+ it will not be inlined. This behaviour can be overridden if the target
+ defines the @samp{FUNCTION_ATTRIBUTE_INLINABLE_P} macro. This macro
+ takes one argument, a @samp{DECL} describing the function. It should
+ return @samp{NULL} if the function can be inlined, otherwise it should
+ return a pointer to a text string that contains a message describing why
+ the function could not be inlined. If this message contains a @samp{%s}
+ sequence, this will be replaced by the name of the function.
@node Varargs
@section Implementing the Varargs Macros