gcc: SH Function Attributes

1 
1 6.31.28 SH Function Attributes
1 ------------------------------
1 
1 These function attributes are supported on the SH family of processors:
1 
1 'function_vector'
1      On SH2A targets, this attribute declares a function to be called
1      using the TBR relative addressing mode.  The argument to this
1      attribute is the entry number of the same function in a vector
1      table containing all the TBR relative addressable functions.  For
1      correct operation the TBR must be setup accordingly to point to the
1      start of the vector table before any functions with this attribute
1      are invoked.  Usually a good place to do the initialization is the
1      startup routine.  The TBR relative vector table can have at max 256
1      function entries.  The jumps to these functions are generated using
1      a SH2A specific, non delayed branch instruction JSR/N @(disp8,TBR).
1      You must use GAS and GLD from GNU binutils version 2.7 or later for
1      this attribute to work correctly.
1 
1      In an application, for a function being called once, this attribute
1      saves at least 8 bytes of code; and if other successive calls are
1      being made to the same function, it saves 2 bytes of code per each
1      of these calls.
1 
1 'interrupt_handler'
1      Use this attribute to indicate that the specified function is an
1      interrupt handler.  The compiler generates function entry and exit
1      sequences suitable for use in an interrupt handler when this
1      attribute is present.
1 
1 'nosave_low_regs'
1      Use this attribute on SH targets to indicate that an
1      'interrupt_handler' function should not save and restore registers
1      R0..R7.  This can be used on SH3* and SH4* targets that have a
1      second R0..R7 register bank for non-reentrant interrupt handlers.
1 
1 'renesas'
1      On SH targets this attribute specifies that the function or struct
1      follows the Renesas ABI.
1 
1 'resbank'
1      On the SH2A target, this attribute enables the high-speed register
1      saving and restoration using a register bank for
1      'interrupt_handler' routines.  Saving to the bank is performed
1      automatically after the CPU accepts an interrupt that uses a
1      register bank.
1 
1      The nineteen 32-bit registers comprising general register R0 to
1      R14, control register GBR, and system registers MACH, MACL, and PR
1      and the vector table address offset are saved into a register bank.
1      Register banks are stacked in first-in last-out (FILO) sequence.
1      Restoration from the bank is executed by issuing a RESBANK
1      instruction.
1 
1 'sp_switch'
1      Use this attribute on the SH to indicate an 'interrupt_handler'
1      function should switch to an alternate stack.  It expects a string
1      argument that names a global variable holding the address of the
1      alternate stack.
1 
1           void *alt_stack;
1           void f () __attribute__ ((interrupt_handler,
1                                     sp_switch ("alt_stack")));
1 
1 'trap_exit'
1      Use this attribute on the SH for an 'interrupt_handler' to return
1      using 'trapa' instead of 'rte'.  This attribute expects an integer
1      argument specifying the trap number to be used.
1 
1 'trapa_handler'
1      On SH targets this function attribute is similar to
1      'interrupt_handler' but it does not save and restore all registers.
1