[llvm] [MachineInstr] add insert method for variadic instructions (PR #67699)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 15:05:46 PDT 2023


================
@@ -2475,3 +2475,24 @@ MachineInstr::getFirst5RegLLTs() const {
       Reg2, getRegInfo()->getType(Reg2), Reg3, getRegInfo()->getType(Reg3),
       Reg4, getRegInfo()->getType(Reg4));
 }
+
+void MachineInstr::insert(mop_iterator It, ArrayRef<MachineOperand> Ops) {
+  assert(isVariadic() && "can only modify variadic instructions");
+  assert(It->getParent() == this && "iterator points to operand of other inst");
----------------
nickdesaulniers wrote:

I don't follow; we need to check that the iterator for where in a given MachineInstr's list of operands to insert into points into that MachineInstr's operand list and not some other random/unrelated MachineIntr's operand list.

https://github.com/llvm/llvm-project/pull/67699


More information about the llvm-commits mailing list