Expand description
Yul Code Generation Module
Generates NeoVM bytecode from Yul AST. This module handles the translation of high-level Yul constructs to low-level NeoVM instructions.
§Output
CompilationResult- Complete compilation output including bytecode, ABI, manifest, and debug information
§Code Generation Pipeline
- AST traversal and instruction emission
- Label resolution and jump patching
- Optimization passes
- Final bytecode assembly
Structs§
- Code
Generator - Code generator for Yul AST to NeoVM bytecode
- Compilation
Result - Result of compiling Yul source to NeoVM bytecode
- Function
Meta - Metadata for a compiled function, collected during bytecode generation.
- Loop
Context - Loop context for break/continue tracking
- Variable
Info - Variable information for code generation
Constants§
- INIT_
MARKER_ LEN - Length of the init marker prepended to bytecode (PUSHDATA1 + len + b“init“).
Functions§
- emit_
ldloc 🔒 - Emit LDLOC instruction with proper index encoding NeoVM uses 0x10-0x13 for indices 0-3, or 0x14 + index for larger indices
- emit_
stloc 🔒 - Emit STLOC instruction with proper index encoding NeoVM uses 0x0C-0x0F for indices 0-3, or 0x14 + index for larger indices
- interop_
id_ bytes - Compute the 4-byte interop ID for a Neo syscall name This is used to identify syscalls in NeoVM bytecode