Hello everyone! I'm new to Cranelift at the moment but have been looking to possibly use the DSLs for compiler peepholes in Cranelift in my project for formalising peepholes in Lean, particularly for encoding the actual rules in the theorem statement.
For example below are two theorems (not rewrites yet!) for associativity and UB refinement using the ~> relation (this is a LLVM style poison model of UB).
The peepmatic DSL seems like a perfect fit, and I'll have to adjust it to support polymorphism ∀bitwidths. I've looked around at the resources and I've seen for Peepmatic:
My question is, what happened to Peepmatic? I can't find much mention of it inside the Cranelift codebase. Was it subsumed into a more general rewriting system under ISLE? (I thought peepmatic was for the middle end generic peepholes, that are separate to instruction selection/lowering)
I'm looking for a good DSL base to represent rewrites in a compiler, from what I've seen I can choose between the existing DSL in Cranelift (might not be peepmatic anymore) or the Go compiler's .rules DSL. Cranelift seems like it would be the better choice, given the existing literature and resources around it.
Could the community also point me towards where to get started with understanding how the existing DSL is implemented in Cranelift? I appreciate it!
Hi @l1mey -- thanks for the question!
You're correct that ISLE has subsumed Peepmatic, and we subsequently removed Peepmatic from the tree -- for all the reasoning, see @fitzgen (he/him) 's PR here: https://github.com/bytecodealliance/wasmtime/pull/3543
ISLE was originally designed for the instruction-selection/lowering use-case, but its (not well-kept) secret is that it is a general matching language, and so in our new rewrite-based mid-end (https://github.com/bytecodealliance/rfcs/blob/main/accepted/cranelift-egraph.md) we re-used ISLE as well. In essence we have two different ISLE environments with two separate preludes that bind it to either the mid-end or back-end context.
For more on ISLE, you can read the ISLE langref, the docs on the backend integration here, the RFC on the ISLE design here, the RFC on the mid-end here, and my blog post on ISLE here.
You can see examples of our use of ISLE to define mid-end rewrites here, as well.
I appreciate it! Thanks for the quick response. I'll take a look over these and let you know if I have any further questions.
Last updated: Jan 09 2026 at 13:15 UTC