diff options
author | Nick Clifton <nickc@cygnus.com> | 2000-04-25 21:10:26 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2000-04-25 21:10:26 +0000 |
commit | b36f4ed35411cadef7f3b17cab4089be7246707a (patch) | |
tree | 66352391a75daac1edb0b4115f2fae562f8b2e8e | |
parent | 119d24d17a770d4a535c5da3897469d1c7dba354 (diff) | |
download | gcc-b36f4ed35411cadef7f3b17cab4089be7246707a.zip gcc-b36f4ed35411cadef7f3b17cab4089be7246707a.tar.gz gcc-b36f4ed35411cadef7f3b17cab4089be7246707a.tar.bz2 |
Define FUNCTION_ATTRIBUTE_INLINABLE_P, a target macro to allow functions with
target specific attributes to be inlined.
From-SVN: r33421
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/integrate.c | 15 | ||||
-rw-r--r-- | gcc/tm.texi | 12 |
3 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4547607..a20f78b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2000-04-25 Nick Clifton <nickc@cygnus.com> + + * 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 <zack@wolery.cumb.org> * cpplib.h (struct cpp_buffer): Add 'mapped' flag; fix diff --git a/gcc/integrate.c b/gcc/integrate.c index cfcee1b..6fa0be1 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 7d9610c..d9560ac 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 |