Add serde support for exposed types. (#40)

This adds derived `Serialize` and `Deserialize` implementations for
exposed types that describe registers, operands, and related program
inputs; entity indices; and regalloc output types. This allows
serialization of any of the embedder's IR data types that may embed or
build upon regalloc2 types.

These implementations (and the dependency on the `serde` crate itself)
are enabled only when the non-default `enable-serde` feature is
specified.
This commit is contained in:
Chris Fallin
2022-04-13 10:14:00 -07:00
committed by GitHub
parent 94cd6c421c
commit 4cac1614bf
5 changed files with 38 additions and 0 deletions

View File

@@ -16,6 +16,9 @@ smallvec = "1.6.1"
fxhash = "0.2.1"
slice-group-by = "0.3.0"
# Optional serde support, enabled by feature below.
serde = { version = "1.0.136", features = ["derive"], optional = true }
# The below are only needed for fuzzing.
# Keep this in sync with libfuzzer_sys's crate version:
arbitrary = { version = "^0.4.6", optional = true }
@@ -37,3 +40,6 @@ trace-log = []
# Exposes the internal API for fuzzing.
fuzzing = ["arbitrary", "checker", "trace-log"]
# Enables serde for exposed types.
enable-serde = ["serde"]