summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/aarch64-function-attributes.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gcc~13/aarch64-function-attributes.html
new repository
Diffstat (limited to 'devdocs/gcc~13/aarch64-function-attributes.html')
-rw-r--r--devdocs/gcc~13/aarch64-function-attributes.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/devdocs/gcc~13/aarch64-function-attributes.html b/devdocs/gcc~13/aarch64-function-attributes.html
new file mode 100644
index 00000000..714cc378
--- /dev/null
+++ b/devdocs/gcc~13/aarch64-function-attributes.html
@@ -0,0 +1,61 @@
+<div class="subsection-level-extent" id="AArch64-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="amd-gcn-function-attributes" accesskey="n" rel="next">AMD GCN Function Attributes</a>, Previous: <a href="common-function-attributes" accesskey="p" rel="prev">Common Function Attributes</a>, Up: <a href="function-attributes" accesskey="u" rel="up">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="AArch64-Function-Attributes-1"><span>6.33.2 AArch64 Function Attributes<a class="copiable-link" href="#AArch64-Function-Attributes-1"> ¶</a></span></h1> <p>The following target-specific function attributes are available for the AArch64 target. For the most part, these options mirror the behavior of similar command-line options (see <a class="pxref" href="aarch64-options">AArch64 Options</a>), but on a per-function basis. </p> <dl class="table"> <dt>
+<span><code class="code">general-regs-only</code><a class="copiable-link" href="#index-general-regs-only-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Indicates that no floating-point or Advanced SIMD registers should be used when generating code for this function. If the function explicitly uses floating-point code, then the compiler gives an error. This is the same behavior as that of the command-line option <samp class="option">-mgeneral-regs-only</samp>. </p> </dd> <dt>
+<span><code class="code">fix-cortex-a53-835769</code><a class="copiable-link" href="#index-fix-cortex-a53-835769-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Indicates that the workaround for the Cortex-A53 erratum 835769 should be applied to this function. To explicitly disable the workaround for this function specify the negated form: <code class="code">no-fix-cortex-a53-835769</code>. This corresponds to the behavior of the command line options <samp class="option">-mfix-cortex-a53-835769</samp> and <samp class="option">-mno-fix-cortex-a53-835769</samp>. </p> </dd> <dt>
+<span><code class="code">cmodel=</code><a class="copiable-link" href="#index-cmodel_003d-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Indicates that code should be generated for a particular code model for this function. The behavior and permissible arguments are the same as for the command line option <samp class="option">-mcmodel=</samp>. </p> </dd> <dt>
+<span><code class="code">strict-align</code><a class="copiable-link" href="#index-strict-align-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dt><code class="code">no-strict-align</code></dt> <dd>
+<p><code class="code">strict-align</code> indicates that the compiler should not assume that unaligned memory references are handled by the system. To allow the compiler to assume that aligned memory references are handled by the system, the inverse attribute <code class="code">no-strict-align</code> can be specified. The behavior is same as for the command-line option <samp class="option">-mstrict-align</samp> and <samp class="option">-mno-strict-align</samp>. </p> </dd> <dt>
+<span><code class="code">omit-leaf-frame-pointer</code><a class="copiable-link" href="#index-omit-leaf-frame-pointer-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Indicates that the frame pointer should be omitted for a leaf function call. To keep the frame pointer, the inverse attribute <code class="code">no-omit-leaf-frame-pointer</code> can be specified. These attributes have the same behavior as the command-line options <samp class="option">-momit-leaf-frame-pointer</samp> and <samp class="option">-mno-omit-leaf-frame-pointer</samp>. </p> </dd> <dt>
+<span><code class="code">tls-dialect=</code><a class="copiable-link" href="#index-tls-dialect_003d-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Specifies the TLS dialect to use for this function. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-mtls-dialect=</samp>. </p> </dd> <dt>
+<span><code class="code">arch=</code><a class="copiable-link" href="#index-arch_003d-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Specifies the architecture version and architectural extensions to use for this function. The behavior and permissible arguments are the same as for the <samp class="option">-march=</samp> command-line option. </p> </dd> <dt>
+<span><code class="code">tune=</code><a class="copiable-link" href="#index-tune_003d-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Specifies the core for which to tune the performance of this function. The behavior and permissible arguments are the same as for the <samp class="option">-mtune=</samp> command-line option. </p> </dd> <dt>
+<span><code class="code">cpu=</code><a class="copiable-link" href="#index-cpu_003d-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Specifies the core for which to tune the performance of this function and also whose architectural features to use. The behavior and valid arguments are the same as for the <samp class="option">-mcpu=</samp> command-line option. </p> </dd> <dt>
+<span><code class="code">sign-return-address</code><a class="copiable-link" href="#index-sign-return-address-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Select the function scope on which return address signing will be applied. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-msign-return-address=</samp>. The default value is <code class="code">none</code>. This attribute is deprecated. The <code class="code">branch-protection</code> attribute should be used instead. </p> </dd> <dt>
+<span><code class="code">branch-protection</code><a class="copiable-link" href="#index-branch-protection-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Select the function scope on which branch protection will be applied. The behavior and permissible arguments are the same as for the command-line option <samp class="option">-mbranch-protection=</samp>. The default value is <code class="code">none</code>. </p> </dd> <dt>
+<span><code class="code">outline-atomics</code><a class="copiable-link" href="#index-outline-atomics-function-attribute_002c-AArch64"> ¶</a></span>
+</dt> <dd>
+<p>Enable or disable calls to out-of-line helpers to implement atomic operations. This corresponds to the behavior of the command line options <samp class="option">-moutline-atomics</samp> and <samp class="option">-mno-outline-atomics</samp>. </p> </dd> </dl> <p>The above target attributes can be specified as follows: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("<var class="var">attr-string</var>")))
+int
+f (int a)
+{
+ return a + 5;
+}</pre>
+</div> <p>where <code class="code"><var class="var">attr-string</var></code> is one of the attribute strings specified above. </p> <p>Additionally, the architectural extension string may be specified on its own. This can be used to turn on and off particular architectural extensions without having to specify a particular architecture version or core. Example: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("+crc+nocrypto")))
+int
+foo (int a)
+{
+ return a + 5;
+}</pre>
+</div> <p>In this example <code class="code">target("+crc+nocrypto")</code> enables the <code class="code">crc</code> extension and disables the <code class="code">crypto</code> extension for the function <code class="code">foo</code> without modifying an existing <samp class="option">-march=</samp> or <samp class="option">-mcpu</samp> option. </p> <p>Multiple target function attributes can be specified by separating them with a comma. For example: </p>
+<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">__attribute__((target("arch=armv8-a+crc+crypto,tune=cortex-a53")))
+int
+foo (int a)
+{
+ return a + 5;
+}</pre>
+</div> <p>is valid and compiles function <code class="code">foo</code> for ARMv8-A with <code class="code">crc</code> and <code class="code">crypto</code> extensions and tunes it for <code class="code">cortex-a53</code>. </p> <ul class="mini-toc"> <li><a href="#Inlining-rules" accesskey="1">Inlining rules</a></li> </ul> <div class="subsubsection-level-extent" id="Inlining-rules"> <h1 class="subsubsection"><span>6.33.2.1 Inlining rules<a class="copiable-link" href="#Inlining-rules"> ¶</a></span></h1> <p>Specifying target attributes on individual functions or performing link-time optimization across translation units compiled with different target options can affect function inlining rules: </p> <p>In particular, a caller function can inline a callee function only if the architectural features available to the callee are a subset of the features available to the caller. For example: A function <code class="code">foo</code> compiled with <samp class="option">-march=armv8-a+crc</samp>, or tagged with the equivalent <code class="code">arch=armv8-a+crc</code> attribute, can inline a function <code class="code">bar</code> compiled with <samp class="option">-march=armv8-a+nocrc</samp> because the all the architectural features that function <code class="code">bar</code> requires are available to function <code class="code">foo</code>. Conversely, function <code class="code">bar</code> cannot inline function <code class="code">foo</code>. </p> <p>Additionally inlining a function compiled with <samp class="option">-mstrict-align</samp> into a function compiled without <code class="code">-mstrict-align</code> is not allowed. However, inlining a function compiled without <samp class="option">-mstrict-align</samp> into a function compiled with <samp class="option">-mstrict-align</samp> is allowed. </p> <p>Note that CPU tuning options and attributes such as the <samp class="option">-mcpu=</samp>, <samp class="option">-mtune=</samp> do not inhibit inlining unless the CPU specified by the <samp class="option">-mcpu=</samp> option or the <code class="code">cpu=</code> attribute conflicts with the architectural feature rules specified above. </p> </div> </div> <div class="nav-panel"> <p> Next: <a href="amd-gcn-function-attributes">AMD GCN Function Attributes</a>, Previous: <a href="common-function-attributes">Common Function Attributes</a>, Up: <a href="function-attributes">Declaring Attributes of Functions</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
+ <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/AArch64-Function-Attributes.html</a>
+ </p>
+</div>