diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-30 06:11:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-30 06:11:04 +0000 |
commit | 3c6ce5b43cd6818b885f6ecc560d47046c44c685 (patch) | |
tree | 1c17bfb21598b11d311bb69bd8c15fd7b9f61b12 /llvm/lib/CodeGen | |
parent | 12c53c8c84c490b7cbf11e8723c6929f0ed28eda (diff) | |
download | bcm5719-llvm-3c6ce5b43cd6818b885f6ecc560d47046c44c685.tar.gz bcm5719-llvm-3c6ce5b43cd6818b885f6ecc560d47046c44c685.zip |
make machine operands fatter: give each one an up-pointer to the
machineinstr that owns it.
llvm-svn: 45449
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 5950c7c09a4..fc55b95addd 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -85,8 +85,10 @@ MachineInstr::MachineInstr(const MachineInstr &MI) { 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(const MachineInstr &MI) { 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. |