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

Method i32_binop

winch/codegen/src/codegen/context.rs:398–414  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

396 ///
397 /// The `emit` function returns the `TypedReg` to put on the value stack.
398 pub fn i32_binop<F, M>(&mut self, masm: &mut M, mut emit: F) -> Result<()>
399 where
400 F: FnMut(&mut M, Reg, RegImm, OperandSize) -> Result<TypedReg>,
401 M: MacroAssembler,
402 {
403 match self.pop_i32_const() {
404 Some(val) => {
405 let typed_reg = self.pop_to_reg(masm, None)?;
406 let dst = emit(masm, typed_reg.reg, RegImm::i32(val), OperandSize::S32)?;
407 self.stack.push(dst.into());
408 }
409 None => self.binop(masm, OperandSize::S32, |masm, dst, src, size| {
410 emit(masm, dst, src.into(), size)
411 })?,
412 }
413 Ok(())
414 }
415
416 /// Prepares arguments for emitting an i64 binary operation.
417 ///

Callers 7

visit_i32_addMethod · 0.80
visit_i32_subMethod · 0.80
visit_i32_mulMethod · 0.80
visit_i32_andMethod · 0.80
visit_i32_orMethod · 0.80
visit_i32_xorMethod · 0.80
cmp_i32sMethod · 0.80

Calls 6

emitFunction · 0.85
OkFunction · 0.85
pop_to_regMethod · 0.80
binopMethod · 0.80
pop_i32_constMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected