diff --git a/Cargo.toml b/Cargo.toml index 7e32c7c..c54201c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,24 +4,20 @@ version = "0.0.1" authors = ["Chris Fallin ", "Mozilla SpiderMonkey Developers"] edition = "2018" license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0" -description = "Backtracking register allocator ported from IonMonkey" -repository = "https://github.com/cfallin/regalloc2" +description = "Backtracking register allocator inspired from IonMonkey" +repository = "https://github.com/bytecodealliance/regalloc2" [dependencies] log = { version = "0.4.8", default-features = false } smallvec = "1.6.1" -# keep this in sync with libfuzzer_sys's crate version: -arbitrary = "^0.4.6" -rand = "0.8" -rand_chacha = "0.3" -env_logger = "*" -[dev-dependencies] -criterion = "0.3" +# The below are only needed for fuzzing. +# Keep this in sync with libfuzzer_sys's crate version: +arbitrary = { version = "^0.4.6", optional = true } [profile.release] debug = true -[[bench]] -name = "regalloc" -harness = false +[features] +default = [] +fuzzing = ["arbitrary"] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 7a94f2d..199eb9d 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -10,14 +10,12 @@ edition = "2018" cargo-fuzz = true [dependencies] +regalloc2 = { path = "../", features = ["fuzzing"] } libfuzzer-sys = "0.3" arbitrary = { version = "^0.4.6", features = ["derive"] } log = { version = "0.4.8", default-features = false } env_logger = "0.8.3" -[dependencies.regalloc2] -path = ".." - # Prevent this from interfering with workspaces [workspace] members = ["."] diff --git a/src/lib.rs b/src/lib.rs index 8d1cca0..34873f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,8 @@ pub mod index; pub use index::{Block, Inst, InstRange, InstRangeIter}; pub mod checker; + +#[cfg(feature = "fuzzing")] pub mod fuzzing; /// Register classes. diff --git a/test/Cargo.toml b/test/Cargo.toml new file mode 100644 index 0000000..bfbb291 --- /dev/null +++ b/test/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "regalloc2-test" +version = "0.0.1" +authors = ["Chris Fallin ", "Mozilla SpiderMonkey Developers"] +edition = "2018" +license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0" +description = "small test driver for benchmarking regalloc2" +repository = "https://github.com/bytecodealliance/regalloc2" + +[dependencies] +regalloc2 = { version = "*", path = "../", features = ["fuzzing"] } + +# Keep this in sync with libfuzzer_sys's crate version: +arbitrary = { version = "^0.4.6" } +rand = { version = "0.8" } +rand_chacha = { version = "0.3" } +env_logger = { version = "*" } + +[dev-dependencies] +criterion = "0.3" + +[profile.release] +debug = true + +[[bench]] +name = "regalloc" +harness = false + diff --git a/benches/regalloc.rs b/test/benches/regalloc.rs similarity index 100% rename from benches/regalloc.rs rename to test/benches/regalloc.rs diff --git a/src/bin/test.rs b/test/src/main.rs similarity index 100% rename from src/bin/test.rs rename to test/src/main.rs