Module ir_optimize

Module ir_optimize 

Source
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