3 ms·
This is interesting: https://github.com/zherczeg/sljit/blob/master/sljit_src/sljitLir.h https://github.com/zherczeg/sljit/blob/master/sljit_src/slji... (Lines
by peter_d_sherman 2y ago
This is interesting:
https://github.com/zherczeg/sljit/blob/master/sljit_src/sljitLir.h https://github.com/zherczeg/sljit/blob/master/sljit_src/slji...
(Lines 167-205):
// Scratch registers.
#define SLJIT_R0 1
#define SLJIT_R1 2
#define SLJIT_R2 3
// Note: on x86-32, R3 - R6 (same as S3 - S6) are emulated (they are allocated on the stack). These registers are called virtual and cannot be used for memory addressing (cannot be part of any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such limitation on other CPUs. See sljit_get_register_index().
#define SLJIT_R3 4
[...]
#define SLJIT_R9 10
[...]
/* Saved registers. */
#define SLJIT_S0 (SLJIT_NUMBER_OF_REGISTERS)
#define SLJIT_S1 (SLJIT_NUMBER_OF_REGISTERS - 1)
#define SLJIT_S2 (SLJIT_NUMBER_OF_REGISTERS - 2)
// Note: on x86-32, S3 - S6 (same as R3 - R6) are emulated (they are allocated on the stack). These registers are called virtual and cannot be used for memory addressing (cannot be part of any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such limitation on other CPUs. See sljit_get_register_index().
#define SLJIT_S3 (SLJIT_NUMBER_OF_REGISTERS - 3)
[...]
#define SLJIT_S9 (SLJIT_NUMBER_OF_REGISTERS - 9)
Anyway, this is a cool technique...
Emulating additional registers on machines that don't have them via the Stack, so that the assembly-like LIR can run on those machines too!
Very nice!