Peepmatic is a DSL for peephole optimizations and compiler for generating peephole optimizers from them. The user writes a set of optimizations in the DSL, and then `peepmatic` compiles the set of optimizations into an efficient peephole optimizer: ``` DSL ----peepmatic----> Peephole Optimizer ``` The generated peephole optimizer has all of its optimizations' left-hand sides collapsed into a compact automata that makes matching candidate instruction sequences fast. The DSL's optimizations may be written by hand or discovered mechanically with a superoptimizer like [Souper][]. Eventually, `peepmatic` should have a verifier that ensures that the DSL's optimizations are sound, similar to what [Alive][] does for LLVM optimizations. [Souper]: https://github.com/google/souper [Alive]: https://github.com/AliveToolkit/alive2
14 lines
233 B
Plaintext
14 lines
233 B
Plaintext
;; Remove redundant bitwise OR instructions that are no-ops.
|
|
|
|
(=> (bor $x (bor $x $y))
|
|
(bor $x $y))
|
|
|
|
(=> (bor $y (bor $x $y))
|
|
(bor $x $y))
|
|
|
|
(=> (bor (bor $x $y) $x)
|
|
(bor $x $y))
|
|
|
|
(=> (bor (bor $x $y) $y)
|
|
(bor $x $y))
|