Expand description
IR Optimization Module
Performs optimization passes on the intermediate representation (IR) before bytecode generation. These optimizations reduce code size and improve runtime performance.
ยงOptimization Levels
- Level 0: No IR optimization
- Level 1: Basic dead code elimination
- Level 2: Constant folding and propagation
- Level 3: NeoVM-specific optimizations (identity ops, boolean simplification)
Functionsยง
- dedupe_
labels ๐ - evaluate_
binary_ ๐literal - fold_
constant_ ๐binary_ ops - neovm_
bool_ ๐optimize - NeoVM-specific: optimize boolean patterns
- neovm_
peephole_ ๐optimize - NeoVM-specific peephole optimization: removes redundant stack operations
- neovm_
simplify_ ๐identity_ ops - NeoVM-specific: simplify identity operations (x + 0, x * 1, x & MAX, etc.)
- optimize_
ir ๐ - IR optimization hook. Currently performs simple control-flow cleanup to drop instructions that appear after a terminal return in a basic block.
- remove_
trivial_ ๐jumps - retarget_
jumps ๐ - try_
identity_ ๐elimination - Try to eliminate identity operations