#### 15.7.2 Order of Allocation of Registers

Registers are allocated in order.

— Macro: REG_ALLOC_ORDER

> If defined, an initializer for a vector of integers, containing the numbers of hard registers in the order in which GCC should prefer to use them (from most preferred to least).

> If this macro is not defined, registers are used lowest numbered first (all else being equal).

> One use of this macro is on machines where the highest numbered registers must always be saved and the save-multiple-registers instruction supports only sequences of consecutive registers. On such machines, define `REG_ALLOC_ORDER` to be an initializer that lists the highest numbered allocable register first.

— Target Hook: void TARGET_ADJUST_REG_ALLOC_ORDER (int *order)

> If `REG_ALLOC_ORDER` has been defined, this hook is called after all command-line options have been processed. It enables adjustment of the allocation order based on target-specific flags. Any such adjustment should be performed by the hook directly on the elements of the array `order`. On entry to the hook this array is an unmodified copy of `REG_ALLOC_ORDER`.

— Macro: ORDER_REGS_FOR_LOCAL_ALLOC

> A C statement (sans semicolon) to choose the order in which to allocate hard registers for pseudo-registers local to a basic block.

> Store the desired register order in the array `reg_alloc_order`. Element 0 should be the register to allocate first; element 1, the next register; and so on.

> The macro body should not assume anything about the contents of `reg_alloc_order` before execution of the macro.

> On most machines, it is not necessary to define this macro.