Skip to content

x86-64 Machine Code Encoder

Source: src/compiler/x86_64.odin

Encodes AST into x86-64 machine code bytes.


Functions

emit_byte {#emit_byte}

Function: emit_byte Appends a single byte to the instruction buffer.

Parameter Description
buf pointer to the instruction buffer
b the byte to append

init_encoder {#init_encoder}

Function: init_encoder Allocates the instruction buffer, label map, and patch list for a new encoding pass.


Types

Instruction_Buffer {#instruction_buffer}

Type: Instruction_Buffer Dynamic byte buffer used for encoding machine instructions.


Patch_Entry {#patch_entry}

Type: Patch_Entry Forward reference patch entry recording a label name and the buffer offset where a 4-byte relative displacement must be back-patched.


Encoder_Context {#encoder_context}

Type: Encoder_Context Tracks the instruction buffer, label positions, and pending forward- reference patches needed during x86-64 machine code emission.