Run the verifier in the Context methods when it is enabled.
The test drivers can stop calling comp_ctx.verify because legalize() and regalloc() do it themselves now. This also makes it possible for those two passes to return other CtonError codes in the future, not just verifier errors.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use cretonne::ir::entities::AnyEntity;
|
||||
use cretonne::{ir, verifier, write_function};
|
||||
use cretonne::result::CtonError;
|
||||
use std::fmt::Write;
|
||||
use std::fs::File;
|
||||
use std::io::{Result, Read};
|
||||
@@ -45,6 +46,15 @@ pub fn pretty_verifier_error(func: &ir::Function, err: verifier::Error) -> Strin
|
||||
msg
|
||||
}
|
||||
|
||||
/// Pretty-print a Cretonne error.
|
||||
pub fn pretty_error(func: &ir::Function, err: CtonError) -> String {
|
||||
if let CtonError::Verifier(e) = err {
|
||||
pretty_verifier_error(func, e)
|
||||
} else {
|
||||
err.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_match_directive() {
|
||||
assert_eq!(match_directive("; foo: bar ", "foo:"), Some("bar"));
|
||||
|
||||
Reference in New Issue
Block a user