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

Method transplant_inst

cranelift/codegen/src/ir/function.rs:344–359  ·  view source on GitHub ↗

Replace the `dst` instruction's data with the `src` instruction's data and then remove `src`. `src` and its result values should not be used at all, as any uses would be left dangling after calling this method. `src` and `dst` must have the same number of resulting values, and `src`'s i^th value must have the same type as `dst`'s i^th value.

(&mut self, dst: Inst, src: Inst)

Source from the content-addressed store, hash-verified

342 /// `src` and `dst` must have the same number of resulting values, and
343 /// `src`'s i^th value must have the same type as `dst`'s i^th value.
344 pub fn transplant_inst(&mut self, dst: Inst, src: Inst) {
345 debug_assert_eq!(
346 self.dfg.inst_results(dst).len(),
347 self.dfg.inst_results(src).len()
348 );
349 debug_assert!(
350 self.dfg
351 .inst_results(dst)
352 .iter()
353 .zip(self.dfg.inst_results(src))
354 .all(|(a, b)| self.dfg.value_type(*a) == self.dfg.value_type(*b))
355 );
356
357 self.dfg.insts[dst] = self.dfg.insts[src];
358 self.layout.remove_inst(src);
359 }
360
361 /// Size occupied by all stack slots associated with this function.
362 ///

Callers

nothing calls this directly

Calls 1

remove_instMethod · 0.45

Tested by

no test coverage detected