peepmatic: Be generic over the operator type
This lets us avoid the cost of `cranelift_codegen::ir::Opcode` to `peepmatic_runtime::Operator` conversion overhead, and paves the way for allowing Peepmatic to support non-clif optimizations (e.g. vcode optimizations). Rather than defining our own `peepmatic::Operator` type like we used to, now the whole `peepmatic` crate is effectively generic over a `TOperator` type parameter. For the Cranelift integration, we use `cranelift_codegen::ir::Opcode` as the concrete type for our `TOperator` type parameter. For testing, we also define a `TestOperator` type, so that we can test Peepmatic code without building all of Cranelift, and we can keep them somewhat isolated from each other. The methods that `peepmatic::Operator` had are now translated into trait bounds on the `TOperator` type. These traits need to be shared between all of `peepmatic`, `peepmatic-runtime`, and `cranelift-codegen`'s Peepmatic integration. Therefore, these new traits live in a new crate: `peepmatic-traits`. This crate acts as a header file of sorts for shared trait/type/macro definitions. Additionally, the `peepmatic-runtime` crate no longer depends on the `peepmatic-macro` procedural macro crate, which should lead to faster build times for Cranelift when it is using pre-built peephole optimizers.
This commit is contained in:
33
Cargo.lock
generated
33
Cargo.lock
generated
@@ -386,11 +386,13 @@ dependencies = [
|
||||
"log",
|
||||
"peepmatic",
|
||||
"peepmatic-runtime",
|
||||
"peepmatic-traits",
|
||||
"regalloc",
|
||||
"serde",
|
||||
"smallvec",
|
||||
"target-lexicon",
|
||||
"thiserror",
|
||||
"wast 15.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1298,20 +1300,23 @@ dependencies = [
|
||||
"peepmatic-automata",
|
||||
"peepmatic-macro",
|
||||
"peepmatic-runtime",
|
||||
"peepmatic-test-operator",
|
||||
"peepmatic-traits",
|
||||
"serde",
|
||||
"wast 15.0.0",
|
||||
"z3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-automata"
|
||||
version = "0.2.0"
|
||||
version = "0.66.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-fuzzing"
|
||||
version = "0.2.0"
|
||||
version = "0.66.0"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"bincode",
|
||||
@@ -1322,6 +1327,8 @@ dependencies = [
|
||||
"peepmatic-automata",
|
||||
"peepmatic-runtime",
|
||||
"peepmatic-test",
|
||||
"peepmatic-test-operator",
|
||||
"peepmatic-traits",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"wast 15.0.0",
|
||||
@@ -1329,7 +1336,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-macro"
|
||||
version = "0.2.0"
|
||||
version = "0.66.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1338,13 +1345,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-runtime"
|
||||
version = "0.2.0"
|
||||
version = "0.66.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bumpalo",
|
||||
"log",
|
||||
"peepmatic-automata",
|
||||
"peepmatic-macro",
|
||||
"peepmatic-test-operator",
|
||||
"peepmatic-traits",
|
||||
"serde",
|
||||
"serde_test",
|
||||
"thiserror",
|
||||
@@ -1359,8 +1367,23 @@ dependencies = [
|
||||
"log",
|
||||
"peepmatic",
|
||||
"peepmatic-runtime",
|
||||
"peepmatic-test-operator",
|
||||
"peepmatic-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-test-operator"
|
||||
version = "0.66.0"
|
||||
dependencies = [
|
||||
"peepmatic-traits",
|
||||
"serde",
|
||||
"wast 15.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peepmatic-traits"
|
||||
version = "0.66.0"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
version = "0.2.3"
|
||||
|
||||
Reference in New Issue
Block a user