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

Method binop

winch/codegen/src/codegen/context.rs:354–366  ·  view source on GitHub ↗

Prepares arguments for emitting a binary operation. The `emit` function returns the `TypedReg` to put on the value stack.

(&mut self, masm: &mut M, size: OperandSize, emit: F)

Source from the content-addressed store, hash-verified

352 ///
353 /// The `emit` function returns the `TypedReg` to put on the value stack.
354 pub fn binop<F, M>(&mut self, masm: &mut M, size: OperandSize, emit: F) -> Result<()>
355 where
356 F: FnOnce(&mut M, Reg, Reg, OperandSize) -> Result<TypedReg>,
357 M: MacroAssembler,
358 {
359 let src = self.pop_to_reg(masm, None)?;
360 let dst = self.pop_to_reg(masm, None)?;
361 let dst = emit(masm, dst.reg, src.reg, size)?;
362 self.free_reg(src);
363 self.stack.push(dst.into());
364
365 Ok(())
366 }
367
368 /// Prepares arguments for emitting an f32 or f64 comparison operation.
369 pub fn float_cmp_op<F, M>(&mut self, masm: &mut M, size: OperandSize, emit: F) -> Result<()>

Callers 15

visit_f32_addMethod · 0.80
visit_f64_addMethod · 0.80
visit_f32_subMethod · 0.80
visit_f64_subMethod · 0.80
visit_f32_mulMethod · 0.80
visit_f64_mulMethod · 0.80
visit_f32_divMethod · 0.80
visit_f64_divMethod · 0.80
visit_f32_minMethod · 0.80
visit_f64_minMethod · 0.80
visit_f32_maxMethod · 0.80
visit_f64_maxMethod · 0.80

Calls 5

emitFunction · 0.85
OkFunction · 0.85
pop_to_regMethod · 0.80
free_regMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected