neo-devpack-solidity 0.22.0

Production-focused Solidity-to-NeoVM compilation system
Documentation
//! NeoVM Bytecode Generation Module
//!
//! Converts the intermediate representation (IR) to NeoVM bytecode. This module
//! handles the low-level emission of NeoVM opcodes and manages function dispatch,
//! storage operations, and syscall generation.
//!
//! # Architecture
//!
//! The bytecode generator works in several phases:
//! 1. **Function dispatch** - Generates entry point with method selector routing
//! 2. **IR lowering** - Converts IR instructions to NeoVM opcodes
//! 3. **Optimization** - Applies peephole optimizations to reduce bytecode size
//! 4. **Patching** - Resolves function call targets and jump addresses
//!
//! # NeoVM Opcodes
//!
//! Key opcodes used:
//! - `0x00-0x20` - Push operations (PUSH0, PUSHINT8, etc.)
//! - `0x40` - RET (return from function)
//! - `0x41` - SYSCALL (invoke system call)
//! - `0x45-0x4D` - Control flow (JMP, JMPIF, CALL, etc.)
//!
//! # Storage Model
//!
//! Storage keys are computed using SHA-256 hashing of variable names and
//! mapping keys, following Neo N3 storage conventions.

use neo_devpack_solidity::frontend::VisibilityKind;
use neo_devpack_solidity::ir::{self, LiteralValue, ValueType};
use neo_devpack_solidity::solidity::{ContractMetadata, FunctionKind, FunctionMetadata};

#[cfg(test)]
use neo_devpack_solidity::solidity::NatspecDoc;
use num_bigint::BigInt;
use num_traits::{Signed, ToPrimitive, Zero};
use std::collections::HashMap;

include!("bytecode/bytecode_core.rs");
include!("bytecode/uint256_ops.rs");
include!("bytecode/bytecode_emit_ir.rs");
include!("bytecode/bytecode_helpers.rs");
include!("bytecode/bytecode_builtins.rs");
include!("bytecode/bytecode_disasm.rs");

#[cfg(test)]
pub(crate) mod tests;