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

Method clone_inst

cranelift/codegen/src/ir/dfg.rs:1058–1071  ·  view source on GitHub ↗

Clone an instruction, attaching new result `Value`s and returning them.

(&mut self, inst: Inst)

Source from the content-addressed store, hash-verified

1056 /// Clone an instruction, attaching new result `Value`s and
1057 /// returning them.
1058 pub fn clone_inst(&mut self, inst: Inst) -> Inst {
1059 // First, add a clone of the InstructionData.
1060 let inst_data = self.insts[inst];
1061 // If the `inst_data` has a reference to a ValueList, clone it
1062 // as well, because we can't share these (otherwise mutating
1063 // one would affect the other).
1064 let inst_data = inst_data.deep_clone(&mut self.value_lists);
1065 let new_inst = self.make_inst(inst_data);
1066 // Get the controlling type variable.
1067 let ctrl_typevar = self.ctrl_typevar(inst);
1068 // Create new result values.
1069 self.make_inst_results(new_inst, ctrl_typevar);
1070 new_inst
1071 }
1072
1073 /// Get the first result of an instruction.
1074 ///

Callers 3

cloningFunction · 0.80
maybe_remat_argMethod · 0.80
process_elab_stackMethod · 0.80

Calls 4

make_instMethod · 0.80
ctrl_typevarMethod · 0.80
make_inst_resultsMethod · 0.80
deep_cloneMethod · 0.45

Tested by 1

cloningFunction · 0.64