Module Role.Register

Common roles for registers.

This module enumerates the blessed set of the register roles that have common meaning among various architectures. Feel free to create target-specific register roles and publish them via your target support libraries. Look for such target-specific roles in the XXX_target modules.

The register roles are specifically grouped in a single module to enable local-opening of this module.

val general : t

the general purpose register

The general purpose registers is a class of register that are used for arithmetic and logic units. On targets with floating-point and vector arithmetic unit this class includes the floating-point and vector registers as well.

To narrow down the list, specify additional roles, e.g., to get the list of general-purpose integer arithmetic registers use [general; integer].

val special : t

the special-purpose register.

The special-purpose register include (but are not limited to) status registers and commonly are accessed using special instructions (couldn't be the targets of common load/store and arithmetic operations of a computation unit).

val pseudo : t

the pseudo-register.

The pseudo-registers do not correspond to an actual storage but rather a hard-wired register, such as constant zero, or an instruction register, or a program counter.

val alias : t

the alias register.

The register is not real register but is defined in terms of other registers, e.g., as a subset of other register or a concatenation of other registers, or somehow else.

See Alias and Origin.

  • since 2.4.0
val integer : t

the register is used by the integer arithmetic unit

This role can be assigned both to general and special purpose registers. E.g., to get integer arithemtic status control registers use [special; integer].

val floating : t

the register is used by the floating-point arithmetic unit

This role can be assigned both to general and special purpose registers. E.g., to get floating-point arithemtic status control registers use [special; floating].

val vector : t

the register is used by the vector processing unit

This role can be assigned both to general and special purpose registers. E.g., to get floating-point arithemtic status control registers use [special; vector].

val stack_pointer : t

the register is used to track the run-time stack

val frame_pointer : t

the register is used to track stack frames

the register holds the return address in subroutine calls

val thread : t

the register is used to store thread-local storage

val privileged : t

the register is used in the privileged mode.

val constant : t

the register holds a constant and is read-only.

val zero : t

the constant register that always holds zero.

val status : t

the program status register

val zero_flag : t

the zero flag register

Is set when an arithmetic operation results in zero.

val sign_flag : t

the sign (aka negative) flag register

Is set when an arithmetic operation results in a negative value.

val carry_flag : t

the carry flag register

Is set when an arithmetic operation results in carry.

val overflow_flag : t

the overflow flag register

Is set when an arithmetic operation results in overflow.

val parity_flag : t

the parity flag register

Is set depending on the parity of the number of bits of a recently set value .

val hardware : t

the non-CPU register

val reserved : t

the reserved register with undefined behavior.

Calling Conventions

val function_argument : t

the register is used to pass function arguments

val function_return : t

the register is used to return values from functions

val caller_saved : t

the register is volatile and should be preserved by the caller

val callee_saved : t

the register is preserved across calls and must be preserved by the callee.