Always require a Flags reference for verifying functions.

Add a settings::FlagsOrIsa struct which represents a flags reference and
optionally the ISA it belongs to. Use this for passing flags/isa
information to the verifier.

The verify_function() and verify_context() functions are now generic so
they accept either a &Flags or a &TargetISa argument.

Fix the return_at_end verifier tests which no longer require an ISA
specified. The signle "set return_at_end" flag setting now makes it to
the verifier even when no ISA is present to carry it.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-14 17:40:43 -07:00
parent 9e77af25a3
commit 1349a6bdbc
17 changed files with 111 additions and 79 deletions

View File

@@ -218,7 +218,7 @@ fn parse_function_body<FE: FuncEnvironment + ?Sized>(
mod tests {
use cretonne::{ir, Context};
use cretonne::ir::types::I32;
use runtime::DummyRuntime;
use runtime::{DummyRuntime, FuncEnvironment};
use super::FuncTranslator;
#[test]
@@ -250,7 +250,7 @@ mod tests {
trans.translate(&BODY, &mut ctx.func, &mut runtime).unwrap();
dbg!("{}", ctx.func.display(None));
ctx.verify(None).unwrap();
ctx.verify(runtime.flags()).unwrap();
}
#[test]
@@ -283,7 +283,7 @@ mod tests {
trans.translate(&BODY, &mut ctx.func, &mut runtime).unwrap();
dbg!("{}", ctx.func.display(None));
ctx.verify(None).unwrap();
ctx.verify(runtime.flags()).unwrap();
}
#[test]
@@ -322,6 +322,6 @@ mod tests {
trans.translate(&BODY, &mut ctx.func, &mut runtime).unwrap();
dbg!("{}", ctx.func.display(None));
ctx.verify(None).unwrap();
ctx.verify(runtime.flags()).unwrap();
}
}