make machine operands fatter: give each one an up-pointer to the
machineinstr that owns it.
llvm-svn: 45449
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 5950c7c..fc55b95 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -85,8 +85,10 @@
Operands.reserve(MI.getNumOperands());
// Add operands
- for (unsigned i = 0; i != MI.getNumOperands(); ++i)
+ for (unsigned i = 0; i != MI.getNumOperands(); ++i) {
Operands.push_back(MI.getOperand(i));
+ Operands.back().ParentMI = this;
+ }
// Set parent, next, and prev to null
parent = 0;
@@ -97,6 +99,10 @@
MachineInstr::~MachineInstr() {
LeakDetector::removeGarbageObject(this);
+#ifndef NDEBUG
+ for (unsigned i = 0, e = Operands.size(); i != e; ++i)
+ assert(Operands[i].ParentMI == this && "ParentMI mismatch!");
+#endif
}
/// getOpcode - Returns the opcode of this MachineInstr.