On 4/14/21 4:39 PM, H.J. Lu wrote:
commit 87c753ac241f25d222d46ba1ac66ceba89d6a200
Author: H.J. Lu <hjl.to...@gmail.com>
Date: Fri Aug 21 09:42:49 2020 -0700
x86: Add target("general-regs-only") function attribute
is incomplete since it is impossible to call integer intrinsics from
a function with general-regs-only target attribute.
1. Add general_regs_only function attribute to inform the compiler that
functions use only general purpose registers. When making inlining
decisions on such functions, non-GPR compiler options are excluded.
2. Add general_regs_only attribute to x86 intrinsics which use only
general purpose registers.
...
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7066,6 +7066,11 @@ On x86 targets, the @code{fentry_section} attribute sets
the name
of the section to record function entry instrumentation calls in when
enabled with @option{-pg -mrecord-mcount}
+@item general_regs_only
+@cindex @code{general_regs_only} function attribute, x86
+The @code{general_regs_only} attribute on functions is used to
+inform the compiler that functions use only general purpose registers.
I'll just reiterate basically the same comment as before: it's not
clear from the very brief description above what the requirements
are for using the attribute. I'm guessing it can be applied to
any function (inline or otherwise) but only has any effect when
the function is actually inlined and otherwise doesn't constrain
what the function can do. (Whatever the constraints are, I think
the manual should spell them out, and likewise for its effects.)
Similarly it's not clear what should be expected when the function
does use some other register. Ideally, I think GCC would check and
issue a nice error message whether or not the function is inlined
or called. I suspect that might only be possible for inline
functions that are actually called and for which the back end must
emit code.
Other than that, I'd suggest to improve the phrasing a bit:
The @code{general_regs_only} function attribute indicates that
the function uses only general purpose registers... [text
explaining constraints and errors follows].
Martin