gccint: Mode Switching

1 
1 18.23 Mode Switching Instructions
1 =================================
1 
1 The following macros control mode switching optimizations:
1 
1  -- Macro: OPTIMIZE_MODE_SWITCHING (ENTITY)
1      Define this macro if the port needs extra instructions inserted for
1      mode switching in an optimizing compilation.
1 
1      For an example, the SH4 can perform both single and double
1      precision floating point operations, but to perform a single
1      precision operation, the FPSCR PR bit has to be cleared, while for
1      a double precision operation, this bit has to be set.  Changing the
1      PR bit requires a general purpose register as a scratch register,
1      hence these FPSCR sets have to be inserted before reload, i.e. you
1      cannot put this into instruction emitting or
1      'TARGET_MACHINE_DEPENDENT_REORG'.
1 
1      You can have multiple entities that are mode-switched, and select
1      at run time which entities actually need it.
1      'OPTIMIZE_MODE_SWITCHING' should return nonzero for any ENTITY that
1      needs mode-switching.  If you define this macro, you also have to
1      define 'NUM_MODES_FOR_MODE_SWITCHING', 'TARGET_MODE_NEEDED',
1      'TARGET_MODE_PRIORITY' and 'TARGET_MODE_EMIT'.
1      'TARGET_MODE_AFTER', 'TARGET_MODE_ENTRY', and 'TARGET_MODE_EXIT'
1      are optional.
1 
1  -- Macro: NUM_MODES_FOR_MODE_SWITCHING
1      If you define 'OPTIMIZE_MODE_SWITCHING', you have to define this as
1      initializer for an array of integers.  Each initializer element N
1      refers to an entity that needs mode switching, and specifies the
1      number of different modes that might need to be set for this
1      entity.  The position of the initializer in the
1      initializer--starting counting at zero--determines the integer that
1      is used to refer to the mode-switched entity in question.  In
1      macros that take mode arguments / yield a mode result, modes are
1      represented as numbers 0 ... N - 1.  N is used to specify that no
1      mode switch is needed / supplied.
1 
1  -- Target Hook: void TARGET_MODE_EMIT (int ENTITY, int MODE, int
1           PREV_MODE, HARD_REG_SET REGS_LIVE)
1      Generate one or more insns to set ENTITY to MODE.  HARD_REG_LIVE is
1      the set of hard registers live at the point where the insn(s) are
1      to be inserted.  PREV_MOXDE indicates the mode to switch from.
1      Sets of a lower numbered entity will be emitted before sets of a
1      higher numbered entity to a mode of the same or lower priority.
1 
1  -- Target Hook: int TARGET_MODE_NEEDED (int ENTITY, rtx_insn *INSN)
1      ENTITY is an integer specifying a mode-switched entity.  If
1      'OPTIMIZE_MODE_SWITCHING' is defined, you must define this macro to
1      return an integer value not larger than the corresponding element
1      in 'NUM_MODES_FOR_MODE_SWITCHING', to denote the mode that ENTITY
1      must be switched into prior to the execution of INSN.
1 
1  -- Target Hook: int TARGET_MODE_AFTER (int ENTITY, int MODE, rtx_insn
1           *INSN)
1      ENTITY is an integer specifying a mode-switched entity.  If this
1      macro is defined, it is evaluated for every INSN during mode
1      switching.  It determines the mode that an insn results in (if
1      different from the incoming mode).
1 
1  -- Target Hook: int TARGET_MODE_ENTRY (int ENTITY)
1      If this macro is defined, it is evaluated for every ENTITY that
1      needs mode switching.  It should evaluate to an integer, which is a
1      mode that ENTITY is assumed to be switched to at function entry.
1      If 'TARGET_MODE_ENTRY' is defined then 'TARGET_MODE_EXIT' must be
1      defined.
1 
1  -- Target Hook: int TARGET_MODE_EXIT (int ENTITY)
1      If this macro is defined, it is evaluated for every ENTITY that
1      needs mode switching.  It should evaluate to an integer, which is a
1      mode that ENTITY is assumed to be switched to at function exit.  If
1      'TARGET_MODE_EXIT' is defined then 'TARGET_MODE_ENTRY' must be
1      defined.
1 
1  -- Target Hook: int TARGET_MODE_PRIORITY (int ENTITY, int N)
1      This macro specifies the order in which modes for ENTITY are
1      processed.  0 is the highest priority,
1      'NUM_MODES_FOR_MODE_SWITCHING[ENTITY] - 1' the lowest.  The value
1      of the macro should be an integer designating a mode for ENTITY.
1      For any fixed ENTITY, 'mode_priority' (ENTITY, N) shall be a
1      bijection in 0 ... 'num_modes_for_mode_switching[ENTITY] - 1'.
1