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

Method i64_shift

winch/codegen/src/codegen/context.rs:81–108  ·  view source on GitHub ↗

Prepares arguments for emitting an i64 binary operation.

(&mut self, masm: &mut M, kind: ShiftKind)

Source from the content-addressed store, hash-verified

79
80 /// Prepares arguments for emitting an i64 binary operation.
81 pub fn i64_shift<M>(&mut self, masm: &mut M, kind: ShiftKind) -> Result<()>
82 where
83 M: MacroAssembler,
84 {
85 let top = self
86 .stack
87 .peek()
88 .ok_or_else(|| CodeGenError::missing_values_in_stack())?;
89 if top.is_i64_const() {
90 let val = self
91 .stack
92 .pop_i64_const()
93 .ok_or_else(|| CodeGenError::missing_values_in_stack())?;
94 let typed_reg = self.pop_to_reg(masm, None)?;
95 masm.shift_ir(
96 writable!(typed_reg.reg),
97 Imm::i64(val),
98 typed_reg.reg,
99 kind,
100 OperandSize::S64,
101 )?;
102 self.stack.push(typed_reg.into());
103 } else {
104 masm.shift(self, kind, OperandSize::S64)?;
105 };
106
107 Ok(())
108 }
109}
110
111impl<'a> CodeGenContext<'a, Prologue> {

Callers 5

visit_i64_shlMethod · 0.45
visit_i64_shr_sMethod · 0.45
visit_i64_shr_uMethod · 0.45
visit_i64_rotlMethod · 0.45
visit_i64_rotrMethod · 0.45

Calls 9

i64Function · 0.85
OkFunction · 0.85
is_i64_constMethod · 0.80
pop_to_regMethod · 0.80
peekMethod · 0.45
pop_i64_constMethod · 0.45
shift_irMethod · 0.45
pushMethod · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected