Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

262 lines
12KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>AArch64 Function Attributes (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="AArch64 Function Attributes (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="AArch64 Function Attributes (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Function-Attributes.html#Function-Attributes" rel="up" title="Function Attributes">
  30. <link href="AMD-GCN-Function-Attributes.html#AMD-GCN-Function-Attributes" rel="next" title="AMD GCN Function Attributes">
  31. <link href="Common-Function-Attributes.html#Common-Function-Attributes" rel="prev" title="Common Function Attributes">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="AArch64-Function-Attributes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="AMD-GCN-Function-Attributes.html#AMD-GCN-Function-Attributes" accesskey="n" rel="next">AMD GCN Function Attributes</a>, Previous: <a href="Common-Function-Attributes.html#Common-Function-Attributes" accesskey="p" rel="prev">Common Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="AArch64-Function-Attributes-1"></a>
  68. <h4 class="subsection">6.33.2 AArch64 Function Attributes</h4>
  69. <p>The following target-specific function attributes are available for the
  70. AArch64 target. For the most part, these options mirror the behavior of
  71. similar command-line options (see <a href="AArch64-Options.html#AArch64-Options">AArch64 Options</a>), but on a
  72. per-function basis.
  73. </p>
  74. <dl compact="compact">
  75. <dt><code>general-regs-only</code></dt>
  76. <dd><a name="index-general_002dregs_002donly-function-attribute_002c-AArch64"></a>
  77. <p>Indicates that no floating-point or Advanced SIMD registers should be
  78. used when generating code for this function. If the function explicitly
  79. uses floating-point code, then the compiler gives an error. This is
  80. the same behavior as that of the command-line option
  81. <samp>-mgeneral-regs-only</samp>.
  82. </p>
  83. </dd>
  84. <dt><code>fix-cortex-a53-835769</code></dt>
  85. <dd><a name="index-fix_002dcortex_002da53_002d835769-function-attribute_002c-AArch64"></a>
  86. <p>Indicates that the workaround for the Cortex-A53 erratum 835769 should be
  87. applied to this function. To explicitly disable the workaround for this
  88. function specify the negated form: <code>no-fix-cortex-a53-835769</code>.
  89. This corresponds to the behavior of the command line options
  90. <samp>-mfix-cortex-a53-835769</samp> and <samp>-mno-fix-cortex-a53-835769</samp>.
  91. </p>
  92. </dd>
  93. <dt><code>cmodel=</code></dt>
  94. <dd><a name="index-cmodel_003d-function-attribute_002c-AArch64"></a>
  95. <p>Indicates that code should be generated for a particular code model for
  96. this function. The behavior and permissible arguments are the same as
  97. for the command line option <samp>-mcmodel=</samp>.
  98. </p>
  99. </dd>
  100. <dt><code>strict-align</code></dt>
  101. <dt><code>no-strict-align</code></dt>
  102. <dd><a name="index-strict_002dalign-function-attribute_002c-AArch64"></a>
  103. <p><code>strict-align</code> indicates that the compiler should not assume that unaligned
  104. memory references are handled by the system. To allow the compiler to assume
  105. that aligned memory references are handled by the system, the inverse attribute
  106. <code>no-strict-align</code> can be specified. The behavior is same as for the
  107. command-line option <samp>-mstrict-align</samp> and <samp>-mno-strict-align</samp>.
  108. </p>
  109. </dd>
  110. <dt><code>omit-leaf-frame-pointer</code></dt>
  111. <dd><a name="index-omit_002dleaf_002dframe_002dpointer-function-attribute_002c-AArch64"></a>
  112. <p>Indicates that the frame pointer should be omitted for a leaf function call.
  113. To keep the frame pointer, the inverse attribute
  114. <code>no-omit-leaf-frame-pointer</code> can be specified. These attributes have
  115. the same behavior as the command-line options <samp>-momit-leaf-frame-pointer</samp>
  116. and <samp>-mno-omit-leaf-frame-pointer</samp>.
  117. </p>
  118. </dd>
  119. <dt><code>tls-dialect=</code></dt>
  120. <dd><a name="index-tls_002ddialect_003d-function-attribute_002c-AArch64"></a>
  121. <p>Specifies the TLS dialect to use for this function. The behavior and
  122. permissible arguments are the same as for the command-line option
  123. <samp>-mtls-dialect=</samp>.
  124. </p>
  125. </dd>
  126. <dt><code>arch=</code></dt>
  127. <dd><a name="index-arch_003d-function-attribute_002c-AArch64"></a>
  128. <p>Specifies the architecture version and architectural extensions to use
  129. for this function. The behavior and permissible arguments are the same as
  130. for the <samp>-march=</samp> command-line option.
  131. </p>
  132. </dd>
  133. <dt><code>tune=</code></dt>
  134. <dd><a name="index-tune_003d-function-attribute_002c-AArch64"></a>
  135. <p>Specifies the core for which to tune the performance of this function.
  136. The behavior and permissible arguments are the same as for the <samp>-mtune=</samp>
  137. command-line option.
  138. </p>
  139. </dd>
  140. <dt><code>cpu=</code></dt>
  141. <dd><a name="index-cpu_003d-function-attribute_002c-AArch64"></a>
  142. <p>Specifies the core for which to tune the performance of this function and also
  143. whose architectural features to use. The behavior and valid arguments are the
  144. same as for the <samp>-mcpu=</samp> command-line option.
  145. </p>
  146. </dd>
  147. <dt><code>sign-return-address</code></dt>
  148. <dd><a name="index-sign_002dreturn_002daddress-function-attribute_002c-AArch64"></a>
  149. <p>Select the function scope on which return address signing will be applied. The
  150. behavior and permissible arguments are the same as for the command-line option
  151. <samp>-msign-return-address=</samp>. The default value is <code>none</code>. This
  152. attribute is deprecated. The <code>branch-protection</code> attribute should
  153. be used instead.
  154. </p>
  155. </dd>
  156. <dt><code>branch-protection</code></dt>
  157. <dd><a name="index-branch_002dprotection-function-attribute_002c-AArch64"></a>
  158. <p>Select the function scope on which branch protection will be applied. The
  159. behavior and permissible arguments are the same as for the command-line option
  160. <samp>-mbranch-protection=</samp>. The default value is <code>none</code>.
  161. </p>
  162. </dd>
  163. <dt><code>outline-atomics</code></dt>
  164. <dd><a name="index-outline_002datomics-function-attribute_002c-AArch64"></a>
  165. <p>Enable or disable calls to out-of-line helpers to implement atomic operations.
  166. This corresponds to the behavior of the command line options
  167. <samp>-moutline-atomics</samp> and <samp>-mno-outline-atomics</samp>.
  168. </p>
  169. </dd>
  170. </dl>
  171. <p>The above target attributes can be specified as follows:
  172. </p>
  173. <div class="smallexample">
  174. <pre class="smallexample">__attribute__((target(&quot;<var>attr-string</var>&quot;)))
  175. int
  176. f (int a)
  177. {
  178. return a + 5;
  179. }
  180. </pre></div>
  181. <p>where <code><var>attr-string</var></code> is one of the attribute strings specified above.
  182. </p>
  183. <p>Additionally, the architectural extension string may be specified on its
  184. own. This can be used to turn on and off particular architectural extensions
  185. without having to specify a particular architecture version or core. Example:
  186. </p>
  187. <div class="smallexample">
  188. <pre class="smallexample">__attribute__((target(&quot;+crc+nocrypto&quot;)))
  189. int
  190. foo (int a)
  191. {
  192. return a + 5;
  193. }
  194. </pre></div>
  195. <p>In this example <code>target(&quot;+crc+nocrypto&quot;)</code> enables the <code>crc</code>
  196. extension and disables the <code>crypto</code> extension for the function <code>foo</code>
  197. without modifying an existing <samp>-march=</samp> or <samp>-mcpu</samp> option.
  198. </p>
  199. <p>Multiple target function attributes can be specified by separating them with
  200. a comma. For example:
  201. </p><div class="smallexample">
  202. <pre class="smallexample">__attribute__((target(&quot;arch=armv8-a+crc+crypto,tune=cortex-a53&quot;)))
  203. int
  204. foo (int a)
  205. {
  206. return a + 5;
  207. }
  208. </pre></div>
  209. <p>is valid and compiles function <code>foo</code> for ARMv8-A with <code>crc</code>
  210. and <code>crypto</code> extensions and tunes it for <code>cortex-a53</code>.
  211. </p>
  212. <a name="Inlining-rules"></a>
  213. <h4 class="subsubsection">6.33.2.1 Inlining rules</h4>
  214. <p>Specifying target attributes on individual functions or performing link-time
  215. optimization across translation units compiled with different target options
  216. can affect function inlining rules:
  217. </p>
  218. <p>In particular, a caller function can inline a callee function only if the
  219. architectural features available to the callee are a subset of the features
  220. available to the caller.
  221. For example: A function <code>foo</code> compiled with <samp>-march=armv8-a+crc</samp>,
  222. or tagged with the equivalent <code>arch=armv8-a+crc</code> attribute,
  223. can inline a function <code>bar</code> compiled with <samp>-march=armv8-a+nocrc</samp>
  224. because the all the architectural features that function <code>bar</code> requires
  225. are available to function <code>foo</code>. Conversely, function <code>bar</code> cannot
  226. inline function <code>foo</code>.
  227. </p>
  228. <p>Additionally inlining a function compiled with <samp>-mstrict-align</samp> into a
  229. function compiled without <code>-mstrict-align</code> is not allowed.
  230. However, inlining a function compiled without <samp>-mstrict-align</samp> into a
  231. function compiled with <samp>-mstrict-align</samp> is allowed.
  232. </p>
  233. <p>Note that CPU tuning options and attributes such as the <samp>-mcpu=</samp>,
  234. <samp>-mtune=</samp> do not inhibit inlining unless the CPU specified by the
  235. <samp>-mcpu=</samp> option or the <code>cpu=</code> attribute conflicts with the
  236. architectural feature rules specified above.
  237. </p>
  238. <hr>
  239. <div class="header">
  240. <p>
  241. Next: <a href="AMD-GCN-Function-Attributes.html#AMD-GCN-Function-Attributes" accesskey="n" rel="next">AMD GCN Function Attributes</a>, Previous: <a href="Common-Function-Attributes.html#Common-Function-Attributes" accesskey="p" rel="prev">Common Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  242. </div>
  243. </body>
  244. </html>