diff --git a/Cargo.lock b/Cargo.lock index 9fc0d489e2..62459c4e95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,9 +1525,9 @@ dependencies = [ [[package]] name = "regalloc" -version = "0.0.21" +version = "0.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b27b256b41986ac5141b37b8bbba85d314fbf546c182eb255af6720e07e4f804" +checksum = "9993953f6481fe355c490a0bdc2d488e354cd28728da36cd4156e2cfb74fd6de" dependencies = [ "log", "rustc-hash", diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index 7a84613c4d..7f78d4cce0 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -24,7 +24,7 @@ gimli = { version = "0.20.0", default-features = false, features = ["write"], op smallvec = { version = "1.0.0" } thiserror = "1.0.4" byteorder = { version = "1.3.2", default-features = false } -regalloc = "0.0.21" +regalloc = "0.0.22" # It is a goal of the cranelift-codegen crate to have minimal external dependencies. # Please don't add any unless they are essential to the task of creating binary # machine code. Integration tests that need external dependencies can be diff --git a/cranelift/codegen/src/machinst/compile.rs b/cranelift/codegen/src/machinst/compile.rs index 3034822aa5..03a3902922 100644 --- a/cranelift/codegen/src/machinst/compile.rs +++ b/cranelift/codegen/src/machinst/compile.rs @@ -6,7 +6,7 @@ use crate::settings; use crate::timing; use log::debug; -use regalloc::{allocate_registers, RegAllocAlgorithm}; +use regalloc::{allocate_registers_with_opts, Algorithm, Options}; /// Compile the given function down to VCode with allocated registers, ready /// for binary emission. @@ -26,16 +26,25 @@ where debug!("vcode from lowering: \n{}", vcode.show_rru(Some(universe))); // Perform register allocation. - let algorithm = match vcode.flags().regalloc() { - settings::Regalloc::Backtracking => RegAllocAlgorithm::Backtracking, - settings::Regalloc::BacktrackingChecked => RegAllocAlgorithm::BacktrackingChecked, - settings::Regalloc::ExperimentalLinearScan => RegAllocAlgorithm::LinearScan, + let (run_checker, algorithm) = match vcode.flags().regalloc() { + settings::Regalloc::Backtracking => (false, Algorithm::Backtracking(Default::default())), + settings::Regalloc::BacktrackingChecked => { + (true, Algorithm::Backtracking(Default::default())) + } + settings::Regalloc::ExperimentalLinearScan => { + (false, Algorithm::LinearScan(Default::default())) + } }; let result = { let _tt = timing::regalloc(); - allocate_registers( - &mut vcode, algorithm, universe, /*request_block_annotations=*/ false, + allocate_registers_with_opts( + &mut vcode, + universe, + Options { + run_checker, + algorithm, + }, ) .map_err(|err| { debug!(