Implement pattern matching for:
- Redundant move elimination
- Algebraic identity removal
- Strength reduction (multiply/divide by powers of 2)
- Jump chain elimination
Create a pattern database:
- Define patterns as instruction sequences
- Define replacement sequences
- Match and replace
Handle these specific patterns (minimum):
mov X, X → remove
add X, 0 → remove
mul X, 1 → remove
mul X, 0 → mov X, 0
mul X, 2^n → shl X, n
jmp L; L: → remove jump
Run until fixed point (no more matches)