Skip to main content

Crate ternary_compiler_optimizer

Crate ternary_compiler_optimizer 

Source
Expand description

Optimization passes for ternary bytecode.

Provides dead trit elimination, constant folding, trit merging, peephole optimization, loop detection, and a configurable optimization pipeline.

Structs§

LoopInfo
Information about a detected loop in ternary bytecode.
OptimizationPipeline
A configurable pipeline of optimization passes.
OptimizationResult
Result of an optimization pass.
PeepholeOptimizer
A peephole optimizer that examines small windows of instructions and replaces them with more efficient patterns.
Program
A program is a sequence of instructions.

Enums§

Op
Opcodes for a ternary bytecode virtual machine.
Trit
A ternary value used in bytecode constants.

Functions§

constant_folding
Evaluates constant expressions at compile time.
dead_trit_elimination
Removes instructions whose results are never used.
detect_loops
Detects loops in ternary bytecode by finding back-edges (jumps to earlier positions).
detect_loops_with_iterations
Detects loops and attempts to estimate iteration count for fixed-count loops.
trit_merging
Merges redundant sequences of ternary operations.