2 ms·
Might not be the reason, but six registers make it trivial to write a backend for 32-bit x86 CPUs, since they offer 8 general-purpose registers minus 2 typicall
by AlexAltea 5y ago
Might not be the reason, but six registers make it trivial to write a backend for 32-bit x86 CPUs, since they offer 8 general-purpose registers minus 2 typically used for stack pointer and base (ESP, EBP respectively). That leaves 6 registers usable by compilers: EAX, EDX, ECX, EBX, ESI, EDI.
To my knowledge, any other architecture targeted by GNU lightning offers more registers, so this magic number is effectively the largest number of registers one can offer where register allocation would become trivial for all architectures.