MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / convert_op

Method convert_op

winch/codegen/src/codegen/context.rs:498–519  ·  view source on GitHub ↗

Prepares arguments for emitting a convert operation.

(&mut self, masm: &mut M, dst_ty: WasmValType, emit: F)

Source from the content-addressed store, hash-verified

496
497 /// Prepares arguments for emitting a convert operation.
498 pub fn convert_op<F, M>(&mut self, masm: &mut M, dst_ty: WasmValType, emit: F) -> Result<()>
499 where
500 F: FnOnce(&mut M, Reg, Reg, OperandSize) -> Result<()>,
501 M: MacroAssembler,
502 {
503 let src = self.pop_to_reg(masm, None)?;
504 let dst = self.reg_for_type(dst_ty, masm)?;
505 let dst_size = match dst_ty {
506 WasmValType::I32 => OperandSize::S32,
507 WasmValType::I64 => OperandSize::S64,
508 WasmValType::F32 => OperandSize::S32,
509 WasmValType::F64 => OperandSize::S64,
510 WasmValType::V128 => bail!(CodeGenError::unsupported_wasm_type()),
511 WasmValType::Ref(_) => bail!(CodeGenError::unsupported_wasm_type()),
512 };
513
514 emit(masm, dst, src.into(), dst_size)?;
515
516 self.free_reg(src);
517 self.stack.push(TypedReg::new(dst_ty, dst).into());
518 Ok(())
519 }
520
521 /// Prepares arguments for emitting a convert operation with a temporary
522 /// register.

Calls 7

emitFunction · 0.85
OkFunction · 0.85
pop_to_regMethod · 0.80
reg_for_typeMethod · 0.80
free_regMethod · 0.80
newFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected