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

Method sink_inst

cranelift/codegen/src/machinst/lower.rs:1674–1691  ·  view source on GitHub ↗

Indicate that the side-effect of an instruction has been sunk to the current scan location. This should only be done with the instruction's original results are not used (i.e., `put_input_in_regs` is not invoked for the input produced by the sunk instruction), otherwise the side-effect will occur twice.

(&mut self, ir_inst: Inst)

Source from the content-addressed store, hash-verified

1672 /// for the input produced by the sunk instruction), otherwise the
1673 /// side-effect will occur twice.
1674 pub fn sink_inst(&mut self, ir_inst: Inst) {
1675 assert!(has_lowering_side_effect(self.f, ir_inst));
1676 assert!(self.cur_scan_entry_color.is_some());
1677
1678 for result in self.dfg().inst_results(ir_inst) {
1679 assert!(self.value_lowered_uses[*result] == 0);
1680 }
1681
1682 let sunk_inst_entry_color = self
1683 .side_effect_inst_entry_colors
1684 .get(&ir_inst)
1685 .cloned()
1686 .unwrap();
1687 let sunk_inst_exit_color = InstColor::new(sunk_inst_entry_color.get() + 1);
1688 assert!(sunk_inst_exit_color == self.cur_scan_entry_color.unwrap());
1689 self.cur_scan_entry_color = Some(sunk_inst_entry_color);
1690 self.inst_sunk.insert(ir_inst);
1691 }
1692
1693 /// Retrieve immediate data given a handle.
1694 pub fn get_immediate_data(&self, imm: Immediate) -> &ConstantData {

Callers 1

sink_loadMethod · 0.80

Calls 6

newFunction · 0.50
inst_resultsMethod · 0.45
dfgMethod · 0.45
unwrapMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected