Register Conventions
The compiler has different register conventions, depending on the target processor used; some of the registers have specific uses during code generation. The following section describes the generic names of the registers on a platform per platform basis. It also indicates what registers are used as scratch registers, and which can be freely used in assembler blocks.
accumulator register
The accumulator register is at least a 32-bit integer hardware register, and is used to return results of function calls which return integral values.
accumulator 64-bit register
The accumulator 64-bit register is used in 32-bit environments and is defined as the group of registers which will be used when returning 64-bit integral results in function calls. This is a register pair.
float result register
This register is used for returning floating point values from functions.
self register
The self register contains a pointer to the actual object or class. This register gives access to the data of the object or class, and the VMT pointer of that object or class.
frame pointer register
The frame pointer register is used to access parameters in subroutines, as well as to access local variables. References to the pushed parameters and local variables are constructed using the frame pointer. 3.
stack pointer register
The stack pointer is used to give the address of the stack area, where the local variables and parameters to subroutines are stored.
scratch registers
Scratch registers are those which can be used in assembler blocks, or in external object files without requiring any saving before usage.
Processor mapping of registers
This indicates what registers are used for what purposes on each of the processors supported by Free Pascal. It also indicates which registers can be used as scratch registers.
Intel 80x86 version
| Generic register name | CPU Register name |
|---|---|
| accumulator | EAX |
| accumulator (64-bit) high / low | EDX:EAX |
| float result | FP(0) |
| self | ESI |
| frame pointer | EBP |
| stack pointer | ESP |
| scratch regs. | N/A |
| OS_128 type (128 bit integer) | RDX:RAX |
Motorola 680x0 version
| Generic register name | CPU Register name |
|---|---|
| accumulator | D0 |
| accumulator (64-bit) high / low | D0:D1 |
| float result | FP04 |
| self | A5 |
| frame pointer | A6 |
| stack pointer | A7 |
| scratch regs. | D0, D1, A0, A1, FP0, FP1 |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
