This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch: always_inline attribute
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 20 Feb 2002 16:05:33 +0000 (GMT)
- Subject: Re: patch: always_inline attribute
On Wed, 20 Feb 2002, Aldy Hernandez wrote:
> 2002-02-20 Aldy Hernandez <aldyh@redhat.com>
>
> * doc/extend.texi (Function Attributes): Document always_inline
> attribute.
>
> * cp/decl.c (duplicate_decls): Merge always_inline attribute.
>
> * cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
> unless DECL_ALWAYS_INLINE.
>
> * c-objc-common.c (c_cannot_inline_tree_fn): Do not inline at -O0
> unless DECL_ALWAYS_INLINE.
> (c_disregard_inline_limits): Disregard if always_inline set.
>
> * langhooks.c (lhd_tree_inlining_disregard_inline_limits):
> Disregard if always_inline set.
> (lhd_tree_inlining_cannot_inline_tree_fn): Do not inline at -O0
> unless DECL_ALWAYS_INLINE.
>
> * attribs.c (handle_always_inline_attribute): New.
> (c_common_attribute_table): Add always_inline.
>
> * tree.h (DECL_ALWAYS_INLINE): New.s
> (struct tree_decl): Add always_inline.
>
> * tree-inline.c: Set flag_inline_trees by default.
>
> * config/rs6000/altivec.h: Add prototypes for builtins
> requiring the always_inline attribute.
Testcases?
> + @cindex @code{always_inline} function attribute
> + @item always_inline
> + Generally, functions are not inlined unless optimization is specified.
> + For functions declared inline, this attribute inlines the function even
> + if no optimization level was specified.
Elsewhere extend.texi says:
GCC does not inline any functions when not optimizing. It is not
clear whether it is better to inline or not, in this case, but we found
that a correct implementation when not optimizing was difficult. So we
did the easy thing, and turned it off.
That needs updating - presuming that the implementation (at least for tree
inlining) is now correct without optimization, it needs to explain that,
and the always_inline attribute.
--
Joseph S. Myers
jsm28@cam.ac.uk