Move verify calls out of Context.

Also, move flowgraph() calls out of filetest and into the passes that
need them so that filetest doesn't have embedded knowledge of these
dependencies.

This resolves a TODO about the way Context was running the verifier, and
it makes the Context functions and the filetest runners more transparent.

This also fixes simple_gvn to use the existing dominator tree rather
than computing its own.
This commit is contained in:
Dan Gohman
2017-09-12 15:38:30 -07:00
parent 69f8174c03
commit 9d0d6b5a1b
8 changed files with 37 additions and 32 deletions

View File

@@ -10,7 +10,6 @@ use cretonne::loop_analysis::LoopAnalysis;
use cretonne::flowgraph::ControlFlowGraph;
use cretonne::dominator_tree::DominatorTree;
use cretonne::Context;
use cretonne::result::CtonError;
use cretonne::verifier;
use cretonne::settings::{self, Configurable};
use std::fs::File;
@@ -171,18 +170,10 @@ fn handle_module(
context.loop_analysis = loop_analysis;
verifier::verify_context(&context.func, &context.cfg, &context.domtree, None)
.map_err(|err| pretty_verifier_error(&context.func, None, err))?;
context.licm().map_err(|error| match error {
CtonError::Verifier(err) => pretty_verifier_error(&context.func, None, err),
CtonError::InvalidInput |
CtonError::ImplLimitExceeded |
CtonError::CodeTooLarge => String::from(error.description()),
})?;
context.simple_gvn().map_err(|error| match error {
CtonError::Verifier(err) => pretty_verifier_error(&context.func, None, err),
CtonError::InvalidInput |
CtonError::ImplLimitExceeded |
CtonError::CodeTooLarge => String::from(error.description()),
})?;
context.licm();
verifier::verify_context(&context.func, &context.cfg, &context.domtree, None)
.map_err(|err| pretty_verifier_error(&context.func, None, err))?;
context.simple_gvn();
verifier::verify_context(&context.func, &context.cfg, &context.domtree, None)
.map_err(|err| pretty_verifier_error(&context.func, None, err))?;
}