← board

Typed instruction encoders for codegen

Motivation

Backend codegen currently emits raw bytes/words/quadwords directly, with comments documenting the intended machine instruction. That works, but every new backend feature repeats operand packing, branch displacement encoding, and bitfield composition at the call site. The next queued work adds more of that surface area: cross exceptions, cross float/Variant support, full parameter ABI, and later targets such as RISC-V / ESP32-class MCUs.

Introduce small typed instruction encoders so new codegen emits through tested helpers instead of hand-rolled byte math. This is now priority prep before ESP32 work: a clean encoder layer reduces risk for future RISC-V/Xtensa target work and gives inline asm a better lower layer without deciding PXX-specific asm syntax yet.

Scope

Non-goals

Acceptance

Notes

Log