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

Method move_val_to_reg

winch/codegen/src/codegen/context.rs:310–334  ·  view source on GitHub ↗

Move a stack value to the given register.

(
        &self,
        src: &Val,
        dst: Reg,
        masm: &mut M,
    )

Source from the content-addressed store, hash-verified

308
309 /// Move a stack value to the given register.
310 pub fn move_val_to_reg<M: MacroAssembler>(
311 &self,
312 src: &Val,
313 dst: Reg,
314 masm: &mut M,
315 ) -> Result<()> {
316 let size: OperandSize = src.ty().try_into()?;
317 match src {
318 Val::Reg(tr) => masm.mov(writable!(dst), RegImm::reg(tr.reg), size),
319 Val::I32(imm) => masm.mov(writable!(dst), RegImm::i32(*imm), size),
320 Val::I64(imm) => masm.mov(writable!(dst), RegImm::i64(*imm), size),
321 Val::F32(imm) => masm.mov(writable!(dst), RegImm::f32(imm.bits()), size),
322 Val::F64(imm) => masm.mov(writable!(dst), RegImm::f64(imm.bits()), size),
323 Val::V128(imm) => masm.mov(writable!(dst), RegImm::v128(*imm), size),
324 Val::Local(local) => {
325 let slot = self.frame.get_wasm_local(local.index);
326 let addr = masm.local_address(&slot)?;
327 masm.load(addr, writable!(dst), size)
328 }
329 Val::Memory(mem) => {
330 let addr = masm.address_from_sp(mem.slot.offset)?;
331 masm.load(addr, writable!(dst), size)
332 }
333 }
334 }
335
336 /// Prepares arguments for emitting a unary operation.
337 ///

Callers 3

emit_check_alignMethod · 0.80
assignMethod · 0.80
pop_to_regMethod · 0.80

Calls 10

i64Function · 0.85
v128Function · 0.85
get_wasm_localMethod · 0.80
try_intoMethod · 0.45
tyMethod · 0.45
movMethod · 0.45
bitsMethod · 0.45
local_addressMethod · 0.45
loadMethod · 0.45
address_from_spMethod · 0.45

Tested by

no test coverage detected