Stack Registers - GNU Compiler Collection (GCC) Internals
Description: GNU Compiler Collection (GCC) Internals

Previous: Leaf Functions, Up: Registers

#### 17.7.5 Registers That Form a Stack

There are special features to handle computers where some of the “registers” form a stack. Stack registers are normally written by pushing onto the stack, and are numbered relative to the top of the stack.

Currently, GCC can only handle one group of stack-like registers, and they must be consecutively numbered. Furthermore, the existing support for stack-like registers is specific to the 80387 floating point coprocessor. If you have a new architecture that uses stack-like registers, you will need to do substantial work on `reg-stack.c` and write your machine description to cooperate with it, as well as defining these macros.

— Macro: STACK_REGS

> Define this if the machine has any stack-like registers.

— Macro: STACK_REG_COVER_CLASS

> This is a cover class containing the stack registers. Define this if the machine has any stack-like registers.

— Macro: FIRST_STACK_REG

> The number of the first stack-like register. This one is the top of the stack.

— Macro: LAST_STACK_REG

> The number of the last stack-like register. This one is the bottom of the stack.