Clone an instruction, attaching new result `Value`s and returning them.
(&mut self, inst: Inst)
| 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 | /// |