Skip to main content

Module register

Module register 

Source
Expand description

Register-based bytecode and a stack→register translator.

The classic compiler emits stack bytecode. A real register VM executes three-address instructions (Add dst, lhs, rhs) with a flat register file. This module defines that IR and a translator that lowers stack bytecode to register bytecode by simulating the operand stack and assigning each stack slot a virtual register.

Structs§

RegChunk
A register-mode chunk (function body), i.e. one frame layout.
StackToRegister
Lower a stack instruction stream to register form.

Enums§

BinKind
CmpKind
RegOp
Three-address register instruction. Registers are u16 indices into a flat frame-local register file. Constants live in the chunk const table.
UnKind
WrapKind

Functions§

parameter_slots
Parameter / this slot count for a chunk: the translator’s starting stack height (RegChunk::param_slots), so let locals land on their own registers.