On 4/12/21 3:53 PM, H.J. Lu via Gcc-patches wrote:
On Mon, Apr 12, 2021 at 2:21 AM Richard Biener
<richard.guent...@gmail.com> wrote:

On Sat, Apr 10, 2021 at 5:11 PM H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:

Add inline_ignore_target function attribute to inform the compiler that
target specific option mismatch on functions with the always_inline
attribute may be ignored.  On x86 targets, this attribute can be used on
integer functions to ignore target non-integer option mismatch.

I'm not sure I like such attribute but please adjust default_target_can_inline_p
accordingly (only few targets override this hook).

Richard.


Like this?

Thanks.

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 1ddafb3ff2c..44588566f2d 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3187,6 +3187,14 @@ int S::interface (int) __attribute__ ((ifunc ("_ZN1S8resolverEv")));
 Indirect functions cannot be weak.  Binutils version 2.20.1 or higher
 and GNU C Library version 2.11.1 are required to use this feature.

+@item inline_ignore_target
+@cindex @code{inline_ignore_target} function attribute
+The @code{inline_ignore_target} attribute on functions is used to
+inform the compiler that target specific option mismatch on functions
+with the @code{always_inline} attribute may be ignored.  On x86 targets,
+this attribute can be used on integer functions to ignore target
+non-integer option mismatch.
+
 @item interrupt
 @itemx interrupt_handler
 Many GCC back ends support attributes to indicate that a function is

I'm having a hard time understanding the description above (or
the attribute's name for that matter).

  The inline_ignore_target function attribute informs the compiler
  that "target specific option mismatch on functions with the
  @code{always_inline} attribute" may be ignored.

What does "target specific option mismatch" mean?  Is it a mismatch
between target-specific optimization options added to a function by
attribute optimize vs other target-specific optimization options of
the function callers (e.g., added to them by another instance of
attribue optimize, or by #pragma GCC optimize), into which a function
with the attribute may be inlined, and where the conflict between
the two sets of options needs to be reconciled?  And if so, should
it be provided as a generic attribute for all targets?

Also, what's "integer functions" supposed to mean?  Functions that
return integers?

This new attribute seems sufficiently specialized that I think
the description ought to be expanded to make it clearer what it's
for, why it's needed, and when and how to use it.  Adding an example
or two might help, as would using more precise terminology.

Separately, seeing no tests for it in the patch, I wonder how
the new attribute interacts (or should interact) with other
attributes or other kinds of functions than the ones it's tested
with.  For example, what happens when the attribute is added to
a function that's not declared inline, or that's declared with
the noinline attribute.

Martin

Reply via email to