M32C Attributes (Using the GNU Compiler Collection (GCC))

#### 6.4.2.13 M32C Attributes ¶

These attributes are supported by the M32C back end:

`bank_switch` ¶

  This attribute applies to functions.

  When added to an interrupt handler with the M32C port, causes the prologue and epilogue to use bank switching to preserve the registers rather than saving them on the stack.

`fast_interrupt` ¶

  This attribute applies to functions.

  Use this attribute on the M32C port to indicate that the specified function is a fast interrupt handler. This is just like the `interrupt` attribute, except that `freit` is used to return instead of `reit`.

`function_vector` ¶

  This attribute applies to functions.

  On M16C/M32C targets, the `function_vector` attribute declares a special page subroutine call function. Use of this attribute reduces the code size by 2 bytes for each call generated to the subroutine. The argument to the attribute is the vector number entry from the special page vector table which contains the 16 low-order bits of the subroutine’s entry address. Each vector table has special page number (18 to 255) that is used in `jsrs` instructions. Jump addresses of the routines are generated by adding 0x0F0000 (in case of M16C targets) or 0xFF0000 (in case of M32C targets), to the 2-byte addresses set in the vector table. Therefore you need to ensure that all the special page vector routines should get mapped within the address range 0x0F0000 to 0x0FFFFF (for M16C) and 0xFF0000 to 0xFFFFFF (for M32C).

  In the following example 2 bytes are saved for each call to function `foo`.

      void foo (void) __attribute__((function_vector(0x18)));
      void foo (void)
      {
      }

      void bar (void)
      {
          foo();
      }

  If functions are defined in one file and are called in another file, then be sure to write this declaration in both files.

  This attribute is ignored for R8C target.

`interrupt` ¶

  This attribute applies to functions.

  It indicates 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.