From 82cac298d5510568eb85854a314ed1811d9a4ad6 Mon Sep 17 00:00:00 2001 From: nickc Date: Tue, 25 Apr 2000 21:10:26 +0000 Subject: [PATCH] Define FUNCTION_ATTRIBUTE_INLINABLE_P, a target macro to allow functions with target specific attributes to be inlined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33421 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/integrate.c | 15 ++++++++++++++- gcc/tm.texi | 12 ++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4547607ffcf..a20f78b4185 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2000-04-25 Nick Clifton + + * integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): If not + defined, define to return zero. + (function_cannot_inline_p): If a function has any target + specific attributes, then use the macro + FUNCTION_ATTRIBUTE_INLINABLE_P to allow the target to decide + whether it can be inlined. If it cannot, issue a suitable + explanation. + + * tm.texi: Add a new node 'Inlining' to document the new macro + FUNCTION_ATTRIBUTE_INLINABLE_P. + 2000-04-25 Zack Weinberg * cpplib.h (struct cpp_buffer): Add 'mapped' flag; fix diff --git a/gcc/integrate.c b/gcc/integrate.c index cfcee1b09a8..6fa0be17fc7 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -62,6 +62,12 @@ extern struct obstack *function_maybepermanent_obstack; ? (1 + (3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \ : (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))) #endif + +/* Decide whether a function with a target specific attribute + attached can be inlined. By default we disallow this. */ +#ifndef FUNCTION_ATTRIBUTE_INLINABLE_P +#define FUNCTION_ATTRIBUTE_INLINABLE_P(FNDECL) 0 +#endif static rtvec initialize_for_inline PARAMS ((tree)); static void note_modified_parmregs PARAMS ((rtx, rtx, void *)); @@ -240,7 +246,14 @@ function_cannot_inline_p (fndecl) if (result && GET_CODE (result) == PARALLEL) return N_("inline functions not supported for this return value type"); - return 0; + /* 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) + && ! FUNCTION_ATTRIBUTE_INLINABLE_P (fndecl)) + return N_("function with target specific attribute(s) cannot be inlined"); + + return NULL; } /* Map pseudo reg number into the PARM_DECL for the parm living in the reg. diff --git a/gcc/tm.texi b/gcc/tm.texi index 7d9610c6245..d9560ac98ca 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -2169,6 +2169,7 @@ This describes the stack layout and calling conventions. * Caller Saves:: * Function Entry:: * Profiling:: +* Inlining:: @end menu @node Frame Layout @@ -3671,6 +3672,17 @@ 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 non-zero if the function can be inlined, otherwise it should +return 0. + @node Varargs @section Implementing the Varargs Macros @cindex varargs implementation -- 2.11.4.GIT