]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gcc/extensions-to-the-c-language-family/declaring-attributes-of-functions/rx-function-attributes.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / declaring-attributes-of-functions / rx-function-attributes.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. _rx-function-attributes:
7
8 RX Function Attributes
9 ^^^^^^^^^^^^^^^^^^^^^^
10
11 These function attributes are supported by the RX back end:
12
13 .. index:: fast_interrupt function attribute, RX
14
15 .. rx-fn-attr:: fast_interrupt
16
17 Use this attribute on the RX port to indicate that the specified
18 function is a fast interrupt handler. This is just like the
19 :rx-fn-attr:`interrupt` attribute, except that ``freit`` is used to return
20 instead of ``reit``.
21
22 .. index:: interrupt function attribute, RX
23
24 .. rx-fn-attr:: interrupt
25
26 Use this attribute to indicate
27 that the specified function is an interrupt handler. The compiler generates
28 function entry and exit sequences suitable for use in an interrupt handler
29 when this attribute is present.
30
31 On RX and RL78 targets, you may specify one or more vector numbers as arguments
32 to the attribute, as well as naming an alternate table name.
33 Parameters are handled sequentially, so one handler can be assigned to
34 multiple entries in multiple tables. One may also pass the magic
35 string ``"$default"`` which causes the function to be used for any
36 unfilled slots in the current table.
37
38 This example shows a simple assignment of a function to one vector in
39 the default table (note that preprocessor macros may be used for
40 chip-specific symbolic vector names):
41
42 .. code-block:: c++
43
44 void __attribute__ ((interrupt (5))) txd1_handler ();
45
46 This example assigns a function to two slots in the default table
47 (using preprocessor macros defined elsewhere) and makes it the default
48 for the ``dct`` table:
49
50 .. code-block:: c++
51
52 void __attribute__ ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default")))
53 txd1_handler ();
54
55 .. index:: naked function attribute, RX
56
57 .. rx-fn-attr:: naked
58
59 This attribute allows the compiler to construct the
60 requisite function declaration, while allowing the body of the
61 function to be assembly code. The specified function will not have
62 prologue/epilogue sequences generated by the compiler. Only basic
63 ``asm`` statements can safely be included in naked functions
64 (see :ref:`basic-asm`). While using extended ``asm`` or a mixture of
65 basic ``asm`` and C code may appear to work, they cannot be
66 depended upon to work reliably and are not supported.
67
68 .. index:: vector function attribute, RX
69
70 .. rx-fn-attr:: vector
71
72 This RX attribute is similar to the :rx-fn-attr:`interrupt` attribute, including its
73 parameters, but does not make the function an interrupt-handler type
74 function (i.e. it retains the normal C function calling ABI). See the
75 :rx-fn-attr:`interrupt` attribute for a description of its arguments.