Go to the previous, next section.

Machine Registers

Machine registers correspond directly to the processor registers in the target architecture. They are only needed when doing register allocation. The machine registers are divided into general-purpose and floating-point registers. Each of these groups is further divided into callee-saved and caller-saved registers. The values in callee-saved registers are preserved across procedures but you have to explicitly save the caller-saved registers at each call site where they are live. The different classes of machine registers are identified by the following constants:

CALLEE_GPRS
Callee-saved general-purpose registers.
CALLER_GPRS
Caller-saved general-purpose registers.
CALLEE_FPRS
Callee-saved floating-point registers.
CALLER_FPRS
Caller-saved floating-point registers.

The num_machine_regs array contains the number of machine registers in each class. For example, num_machine_regs[CALLER_GPRS] is equal to the number of caller-saved general-purpose registers. Pointers to the actual simple_reg structures for machine registers are stored in the two-dimensional machine_regs array. The first array index identifies the machine register class and the second index identifies a particular register within the class. Note that the second array index ranges from zero to num_machine_regs[class]; it is not the register number.

The current library only handles machine registers for MIPS-based architectures. The general-purpose registers contain signed 32-bit variables, and the floating-point registers contain 64-bit floating-point variables. There is no way to access a floating-point register as a pair of 32-bit values. Support for other architectures may be added in the future.

Go to the previous, next section.