Add support for running the regalloc2 checker. (#4043)
With these fixes, all this PR has to do is instantiate and run the checker on the `regalloc2::Output`. This is off by default, and is enabled by setting the `regalloc_checker` Cranelift option. This restores the old functionality provided by e.g. the `backtracking_checked` regalloc algorithm setting rather than `backtracking` when we were still on regalloc.rs.
This commit is contained in:
@@ -47,5 +47,23 @@ pub fn compile<B: LowerBackend + TargetIsa>(
|
||||
.expect("register allocation")
|
||||
};
|
||||
|
||||
// Run the regalloc checker, if requested.
|
||||
if b.flags().regalloc_checker() {
|
||||
let _tt = timing::regalloc_checker();
|
||||
let mut checker = regalloc2::checker::Checker::new(&vcode, machine_env);
|
||||
checker.prepare(®alloc_result);
|
||||
checker
|
||||
.run()
|
||||
.map_err(|err| {
|
||||
log::error!(
|
||||
"Register allocation checker errors:\n{:?}\nfor vcode:\n{:?}",
|
||||
err,
|
||||
vcode
|
||||
);
|
||||
err
|
||||
})
|
||||
.expect("register allocation checker");
|
||||
}
|
||||
|
||||
Ok((vcode, regalloc_result))
|
||||
}
|
||||
|
||||
@@ -515,6 +515,7 @@ tls_model = "none"
|
||||
libcall_call_conv = "isa_default"
|
||||
baldrdash_prologue_words = 0
|
||||
probestack_size_log2 = 12
|
||||
regalloc_checker = false
|
||||
enable_verifier = true
|
||||
is_pic = false
|
||||
use_colocated_libcalls = false
|
||||
|
||||
@@ -65,6 +65,7 @@ define_passes! {
|
||||
vcode_emit_finish: "VCode emission finalization",
|
||||
|
||||
regalloc: "Register allocation",
|
||||
regalloc_checker: "Register allocation symbolic verification",
|
||||
binemit: "Binary machine code emission",
|
||||
layout_renumber: "Layout full renumbering",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user