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

@@ -5,11 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use std::borrow::Cow;
use cretonne::{self, write_function};
use cretonne::ir::Function;
use cretonne::{self, write_function};
use cton_reader::TestCommand;
use filetest::subtest::{SubTest, Context, Result, run_filecheck};
use std::borrow::Cow;
use utils::pretty_verifier_error;
struct TestRegalloc;
@@ -46,6 +47,7 @@ impl SubTest for TestRegalloc {
// TODO: Should we have an option to skip legalization?
comp_ctx.legalize(isa);
comp_ctx.regalloc(isa);
comp_ctx.verify(isa).map_err(|e| pretty_verifier_error(&comp_ctx.func, e))?;
let mut text = String::new();
write_function(&mut text, &comp_ctx.func, Some(isa)).map_err(|e| e.to_string())?;