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.
6 .. _m32c-function-attributes:
8 M32C Function Attributes
9 ^^^^^^^^^^^^^^^^^^^^^^^^
11 These function attributes are supported by the M32C back end:
13 .. index:: bank_switch function attribute, M32C
15 .. m32c-fn-attr:: bank_switch
17 When added to an interrupt handler with the M32C port, causes the
18 prologue and epilogue to use bank switching to preserve the registers
19 rather than saving them on the stack.
21 .. index:: fast_interrupt function attribute, M32C
23 .. m32c-fn-attr:: fast_interrupt
25 Use this attribute on the M32C port to indicate that the specified
26 function is a fast interrupt handler. This is just like the
27 :m32c-fn-attr:`interrupt` attribute, except that ``freit`` is used to return
30 .. index:: function_vector function attribute, M16C/M32C
32 .. m32c-fn-attr:: function_vector
34 On M16C/M32C targets, the :m32c-fn-attr:`function_vector` attribute declares a
35 special page subroutine call function. Use of this attribute reduces
36 the code size by 2 bytes for each call generated to the
37 subroutine. The argument to the attribute is the vector number entry
38 from the special page vector table which contains the 16 low-order
39 bits of the subroutine's entry address. Each vector table has special
40 page number (18 to 255) that is used in ``jsrs`` instructions.
41 Jump addresses of the routines are generated by adding 0x0F0000 (in
42 case of M16C targets) or 0xFF0000 (in case of M32C targets), to the
43 2-byte addresses set in the vector table. Therefore you need to ensure
44 that all the special page vector routines should get mapped within the
45 address range 0x0F0000 to 0x0FFFFF (for M16C) and 0xFF0000 to 0xFFFFFF
48 In the following example 2 bytes are saved for each call to
53 void foo (void) __attribute__((function_vector(0x18)));
63 If functions are defined in one file and are called in another file,
64 then be sure to write this declaration in both files.
66 This attribute is ignored for R8C target.
68 .. index:: interrupt function attribute, M32C
70 .. m32c-fn-attr:: interrupt
72 Use this attribute to indicate
73 that the specified function is an interrupt handler. The compiler generates
74 function entry and exit sequences suitable for use in an interrupt handler
75 when this attribute is present.