Next: , Previous: Register Basics, Up: Registers


17.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.

— 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.

— Macro: IRA_HARD_REGNO_ADD_COST_MULTIPLIER (regno)

In some case register allocation order is not enough for the Integrated Register Allocator (IRA) to generate a good code. If this macro is defined, it should return a floating point value based on regno. The cost of using regno for a pseudo will be increased by approximately the pseudo's usage frequency times the value returned by this macro. Not defining this macro is equivalent to having it always return 0.0.

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