This section discusses the macros that describe which kinds of values (specifically, which machine modes) each register can hold, and how many consecutive registers are needed for a given mode.
| HARD_REGNO_NREGS (regno, mode) | Macro |
|
A C expression for the number of consecutive hard registers, starting
at register number regno, required to hold a value of mode
mode.
On a machine where all registers are exactly one word, a suitable definition of this macro is #define HARD_REGNO_NREGS(REGNO, MODE) \
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
/ UNITS_PER_WORD)
|
| REGMODE_NATURAL_SIZE (mode) | Macro |
| Define this macro if the natural size of registers that hold values of mode mode is not the word size. It is a C expression that should give the natural size in bytes for the specified mode. It is used by the register allocator to try to optimize its results. This happens for example on SPARC 64-bit where the natural size of floating-point registers is still 32-bit. |
| HARD_REGNO_MODE_OK (regno, mode) | Macro |
A C expression that is nonzero if it is permissible to store a value
of mode mode in hard register number regno (or in several
registers starting with that one). For a machine where all registers
are equivalent, a suitable definition is
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
You need not include code to check for the numbers of fixed registers, because the allocation mechanism considers them to be always occupied. On some machines, double-precision values must be kept in even/odd register pairs. You can implement that by defining this macro to reject odd register numbers for such modes. The minimum requirement for a mode to be OK in a register is that the
Since the same instruction used to move Many machines have special registers for floating point arithmetic. Often people assume that floating point machine modes are allowed only in floating point registers. This is not true. Any registers that can hold integers can safely hold a floating point machine mode, whether or not floating arithmetic can be done on it in those registers. Integer move instructions can be used to move the values. On some machines, though, the converse is true: fixed-point machine
modes may not go in floating registers. This is true if the floating
registers normalize any value stored in them, because storing a
non-floating value there would garble it. In this case,
The primary significance of special floating registers is rather that
they are the registers acceptable in floating point arithmetic
instructions. However, this is of no concern to
On some machines, the floating registers are especially slow to access,
so that it is better to store a value in a stack frame than in such a
register if floating point arithmetic is not being done. As long as the
floating registers are not in class |
| MODES_TIEABLE_P (mode1, mode2) | Macro |
|
A C expression that is nonzero if a value of mode
mode1 is accessible in mode mode2 without copying.
If You should define this macro to return nonzero in as many cases as possible since doing so will allow GCC to perform better register allocation. |
| AVOID_CCMODE_COPIES | Macro |
Define this macro if the compiler should avoid copies to/from CCmode
registers. You should only define this macro if support for copying to/from
CCmode is incomplete.
|