Remove a redundant copy of pretty_verifier_error.

This commit is contained in:
Dan Gohman
2017-09-12 09:00:32 -07:00
parent de27abcb2b
commit ddd398b790

View File

@@ -12,9 +12,6 @@ use cretonne::flowgraph::ControlFlowGraph;
use cretonne::dominator_tree::DominatorTree; use cretonne::dominator_tree::DominatorTree;
use cretonne::Context; use cretonne::Context;
use cretonne::result::CtonError; use cretonne::result::CtonError;
use cretonne::ir;
use cretonne::ir::entities::AnyEntity;
use cretonne::isa::TargetIsa;
use cretonne::verifier; use cretonne::verifier;
use std::fs::File; use std::fs::File;
use std::error::Error; use std::error::Error;
@@ -25,6 +22,7 @@ use std::path::Path;
use std::process::Command; use std::process::Command;
use tempdir::TempDir; use tempdir::TempDir;
use term; use term;
use utils::pretty_verifier_error;
macro_rules! vprintln { macro_rules! vprintln {
($x: expr, $($tts:tt)*) => { ($x: expr, $($tts:tt)*) => {
@@ -218,24 +216,3 @@ fn handle_module(
} }
Ok(()) Ok(())
} }
/// Pretty-print a verifier error.
pub fn pretty_verifier_error(
func: &ir::Function,
isa: Option<&TargetIsa>,
err: verifier::Error,
) -> String {
let msg = err.to_string();
let str1 = match err.location {
AnyEntity::Inst(inst) => {
format!(
"{}\n{}: {}\n\n",
msg,
inst,
func.dfg.display_inst(inst, isa)
)
}
_ => String::from(format!("{}\n", msg)),
};
format!("{}{}", str1, func.display(isa))
}