Run verifier after legalizer and regalloc file tests.

Run the verify_contexti() function after invoking the legalize() and
regalloc() context functions. This will help catch bad code produced by
these passes.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-29 15:16:59 -07:00
parent 7a0092754d
commit 4c3e590bb9
4 changed files with 41 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ use ir::Function;
use isa::TargetIsa;
use legalize_function;
use regalloc;
use verifier;
/// Persistent data structures and compilation pipeline.
pub struct Context {
@@ -45,6 +46,16 @@ impl Context {
}
}
/// Run the verifier on the function.
///
/// Also check that the dominator tree and control flow graph are consistent with the function.
///
/// The `TargetIsa` argument is currently unused, but the verifier will soon be able to also
/// check ISA-dependent constraints.
pub fn verify<'a, ISA: Into<Option<&'a TargetIsa>>>(&self, _isa: ISA) -> verifier::Result<()> {
verifier::verify_context(self)
}
/// Run the legalizer for `isa` on the function.
pub fn legalize(&mut self, isa: &TargetIsa) {
legalize_function(&mut self.func, &mut self.cfg, isa);