Add an enable_verifier setting.
This is off by default, but enabled by the parser when reading a textual IL file. Test files can still override the default to turn off verification. The setting enables IL verifier passes at critical points of the compilation pipeline.
This commit is contained in:
@@ -18,6 +18,14 @@ opt_level = EnumSetting(
|
||||
""",
|
||||
'default', 'best', 'fastest')
|
||||
|
||||
enable_verifier = BoolSetting(
|
||||
"""
|
||||
Run the Cretonne IL verifier at strategic times during compilation.
|
||||
|
||||
This makes compilation slower but catches many bugs. The verifier is
|
||||
disabled by default, except when reading Cretonne IL from a text file.
|
||||
""")
|
||||
|
||||
is_64bit = BoolSetting("Enable 64-bit code generation")
|
||||
|
||||
is_compressed = BoolSetting("Enable compressed instructions")
|
||||
|
||||
@@ -271,6 +271,7 @@ mod tests {
|
||||
assert_eq!(f.to_string(),
|
||||
"[shared]\n\
|
||||
opt_level = \"default\"\n\
|
||||
enable_verifier = false\n\
|
||||
is_64bit = false\n\
|
||||
is_compressed = false\n\
|
||||
enable_float = true\n\
|
||||
|
||||
@@ -17,7 +17,7 @@ use cretonne::ir::immediates::{Imm64, Offset32, Uoffset32, Ieee32, Ieee64};
|
||||
use cretonne::ir::entities::AnyEntity;
|
||||
use cretonne::ir::instructions::{InstructionFormat, InstructionData, VariableArgs};
|
||||
use cretonne::isa::{self, TargetIsa, Encoding};
|
||||
use cretonne::settings;
|
||||
use cretonne::settings::{self, Configurable};
|
||||
use testfile::{TestFile, Details, Comment};
|
||||
use error::{Location, Error, Result};
|
||||
use lexer::{self, Lexer, Token};
|
||||
@@ -577,6 +577,13 @@ impl<'a> Parser<'a> {
|
||||
let mut isas = Vec::new();
|
||||
let mut flag_builder = settings::builder();
|
||||
|
||||
// Change the default for `enable_verifier` to `true`. It defaults to `false` because it
|
||||
// would slow down normal compilation, but when we're reading IL from a text file we're
|
||||
// either testing or debugging Cretonne, and verification makes sense.
|
||||
flag_builder
|
||||
.set_bool("enable_verifier", true)
|
||||
.expect("Missing enable_verifier setting");
|
||||
|
||||
while let Some(Token::Identifier(command)) = self.token() {
|
||||
match command {
|
||||
"set" => {
|
||||
@@ -1849,7 +1856,10 @@ mod tests {
|
||||
assert_eq!(tf.commands[0].command, "cfg");
|
||||
assert_eq!(tf.commands[1].command, "verify");
|
||||
match tf.isa_spec {
|
||||
IsaSpec::None(s) => assert!(!s.enable_float()),
|
||||
IsaSpec::None(s) => {
|
||||
assert!(s.enable_verifier());
|
||||
assert!(!s.enable_float());
|
||||
}
|
||||
_ => panic!("unexpected ISAs"),
|
||||
}
|
||||
assert_eq!(tf.preamble_comments.len(), 2);
|
||||
|
||||
Reference in New Issue
Block a user