summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/arc-function-attributes.html
blob: 066bcc78970f328a1f04ecc488c0fb2aac14c1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="subsection-level-extent" id="ARC-Function-Attributes"> <div class="nav-panel"> <p> Next: <a href="arm-function-attributes" accesskey="n" rel="next">ARM Function Attributes</a>, Previous: <a href="amd-gcn-function-attributes" accesskey="p" rel="prev">AMD GCN 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="ARC-Function-Attributes-1"><span>6.33.4 ARC Function Attributes<a class="copiable-link" href="#ARC-Function-Attributes-1"> ¶</a></span></h1> <p>These function attributes are supported by the ARC back end: </p> <dl class="table"> <dt>
<span><code class="code">interrupt</code><a class="copiable-link" href="#index-interrupt-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dd>
<p>Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present. </p> <p>On the ARC, you must specify the kind of interrupt to be handled in a parameter to the interrupt attribute like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">void f () __attribute__ ((interrupt ("ilink1")));</pre>
</div> <p>Permissible values for this parameter are: <code class="code">ilink1</code> and <code class="code">ilink2</code> for ARCv1 architecture, and <code class="code">ilink</code> and <code class="code">firq</code> for ARCv2 architecture. </p> </dd> <dt>
   <span><code class="code">long_call</code><a class="copiable-link" href="#index-long_005fcall-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dt><code class="code">medium_call</code></dt> <dt><code class="code">short_call</code></dt> <dd>
<p>These attributes specify how a particular function is called. These attributes override the <samp class="option">-mlong-calls</samp> and <samp class="option">-mmedium-calls</samp> (see <a class="pxref" href="arc-options">ARC Options</a>) command-line switches and <code class="code">#pragma long_calls</code> settings. </p> <p>For ARC, a function marked with the <code class="code">long_call</code> attribute is always called using register-indirect jump-and-link instructions, thereby enabling the called function to be placed anywhere within the 32-bit address space. A function marked with the <code class="code">medium_call</code> attribute will always be close enough to be called with an unconditional branch-and-link instruction, which has a 25-bit offset from the call site. A function marked with the <code class="code">short_call</code> attribute will always be close enough to be called with a conditional branch-and-link instruction, which has a 21-bit offset from the call site. </p> </dd> <dt>
<span><code class="code">jli_always</code><a class="copiable-link" href="#index-jli_005falways-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dd>
<p>Forces a particular function to be called using <code class="code">jli</code> instruction. The <code class="code">jli</code> instruction makes use of a table stored into <code class="code">.jlitab</code> section, which holds the location of the functions which are addressed using this instruction. </p> </dd> <dt>
<span><code class="code">jli_fixed</code><a class="copiable-link" href="#index-jli_005ffixed-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dd>
<p>Identical like the above one, but the location of the function in the <code class="code">jli</code> table is known and given as an attribute parameter. </p> </dd> <dt>
<span><code class="code">secure_call</code><a class="copiable-link" href="#index-secure_005fcall-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dd>
<p>This attribute allows one to mark secure-code functions that are callable from normal mode. The location of the secure call function into the <code class="code">sjli</code> table needs to be passed as argument. </p> </dd> <dt>
<span><code class="code">naked</code><a class="copiable-link" href="#index-naked-function-attribute_002c-ARC"> ¶</a></span>
</dt> <dd>
<p>This attribute allows the compiler to construct the requisite function declaration, while allowing the body of the function to be assembly code. The specified function will not have prologue/epilogue sequences generated by the compiler. Only basic <code class="code">asm</code> statements can safely be included in naked functions (see <a class="pxref" href="basic-asm">Basic Asm — Assembler Instructions Without Operands</a>). While using extended <code class="code">asm</code> or a mixture of basic <code class="code">asm</code> and C code may appear to work, they cannot be depended upon to work reliably and are not supported. </p> </dd> </dl> </div>  <div class="nav-panel"> <p> Next: <a href="arm-function-attributes">ARM Function Attributes</a>, Previous: <a href="amd-gcn-function-attributes">AMD GCN 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/ARC-Function-Attributes.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARC-Function-Attributes.html</a>
  </p>
</div>