Make cranelift-wasm's type_to_type easier to optimize.
This commit is contained in:
@@ -92,13 +92,13 @@ pub struct Memory {
|
||||
|
||||
/// Helper function translating wasmparser types to Cranelift types when possible.
|
||||
pub fn type_to_type(ty: wasmparser::Type) -> Result<ir::Type, ()> {
|
||||
match ty {
|
||||
wasmparser::Type::I32 => Ok(ir::types::I32),
|
||||
wasmparser::Type::I64 => Ok(ir::types::I64),
|
||||
wasmparser::Type::F32 => Ok(ir::types::F32),
|
||||
wasmparser::Type::F64 => Ok(ir::types::F64),
|
||||
_ => Err(()),
|
||||
}
|
||||
Ok(match ty {
|
||||
wasmparser::Type::I32 => ir::types::I32,
|
||||
wasmparser::Type::I64 => ir::types::I64,
|
||||
wasmparser::Type::F32 => ir::types::F32,
|
||||
wasmparser::Type::F64 => ir::types::F64,
|
||||
_ => return Err(()),
|
||||
})
|
||||
}
|
||||
|
||||
/// Turns a `wasmparser` `f32` into a `Cranelift` one.
|
||||
|
||||
Reference in New Issue
Block a user