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:
@@ -631,6 +631,7 @@ mod tests {
|
||||
use cretonne::ir::types::*;
|
||||
use frontend::{ILBuilder, FunctionBuilder};
|
||||
use cretonne::verifier::verify_function;
|
||||
use cretonne::settings;
|
||||
|
||||
use std::u32;
|
||||
|
||||
@@ -727,7 +728,8 @@ mod tests {
|
||||
builder.seal_block(block1);
|
||||
}
|
||||
|
||||
let res = verify_function(&func, None);
|
||||
let flags = settings::Flags::new(&settings::builder());
|
||||
let res = verify_function(&func, &flags);
|
||||
// println!("{}", func.display(None));
|
||||
match res {
|
||||
Ok(_) => {}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
//! use cretonne::entity::EntityRef;
|
||||
//! use cretonne::ir::{FunctionName, CallConv, Function, Signature, ArgumentType, InstBuilder};
|
||||
//! use cretonne::ir::types::*;
|
||||
//! use cretonne::settings;
|
||||
//! use cton_frontend::{ILBuilder, FunctionBuilder};
|
||||
//! use cretonne::verifier::verify_function;
|
||||
//! use std::u32;
|
||||
@@ -133,7 +134,8 @@
|
||||
//! builder.seal_block(block1);
|
||||
//! }
|
||||
//!
|
||||
//! let res = verify_function(&func, None);
|
||||
//! let flags = settings::Flags::new(&settings::builder());
|
||||
//! let res = verify_function(&func, &flags);
|
||||
//! println!("{}", func.display(None));
|
||||
//! match res {
|
||||
//! Ok(_) => {}
|
||||
|
||||
@@ -589,6 +589,7 @@ mod tests {
|
||||
use cretonne::ir::types::*;
|
||||
use cretonne::verify_function;
|
||||
use cretonne::ir::instructions::BranchInfo;
|
||||
use cretonne::settings;
|
||||
use ssa::SSABuilder;
|
||||
use std::u32;
|
||||
|
||||
@@ -1194,7 +1195,8 @@ mod tests {
|
||||
cur.goto_bottom(ebb1);
|
||||
func.dfg.ins(cur).return_(&[])
|
||||
};
|
||||
match verify_function(&func, None) {
|
||||
let flags = settings::Flags::new(&settings::builder());
|
||||
match verify_function(&func, &flags) {
|
||||
Ok(()) => {}
|
||||
Err(err) => panic!(err.message),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user