diff --git a/cranelift/src/wasm.rs b/cranelift/src/wasm.rs index 0dda98b524..c915379d7e 100644 --- a/cranelift/src/wasm.rs +++ b/cranelift/src/wasm.rs @@ -12,9 +12,6 @@ use cretonne::flowgraph::ControlFlowGraph; use cretonne::dominator_tree::DominatorTree; use cretonne::Context; use cretonne::result::CtonError; -use cretonne::ir; -use cretonne::ir::entities::AnyEntity; -use cretonne::isa::TargetIsa; use cretonne::verifier; use std::fs::File; use std::error::Error; @@ -25,6 +22,7 @@ use std::path::Path; use std::process::Command; use tempdir::TempDir; use term; +use utils::pretty_verifier_error; macro_rules! vprintln { ($x: expr, $($tts:tt)*) => { @@ -218,24 +216,3 @@ fn handle_module( } 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)) -}