Crate peepmatic_souper[−][src]
Expand description
Converting Souper optimizations into Peepmatic DSL.
Conversion from Souper into Peepmatic is implemented with a straightforward, top-down recursive traversal of the optimization’s left- and right-hand side expression DAGs. Most Souper instructions have a corresponding Peepmatic instruction. If we run into an instruction where that isn’t the case, we skip that Souper optimization and move on to the next one.
Note that Souper fully supports DAGs, for example:
%0 = var
%1 = add 1, %0
%2 = add %1, %1 ;; Two edges to `%1` makes this a DAG.
On the other hand, Peepmatic only currently supports trees, so shared subexpressions are duplicated:
(iadd (iadd 1 $x)
(iadd 1 $x)) ;; The shared subexpression is duplicated.
This does not affect correctness.
Functions
Convert a file containing Souper optimizations into Peepmatic DSL.
Convert a string of Souper optimizations into Peepmatic DSL.