aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-17 23:49:46 +0000
committerDan Gohman <gohman@apple.com>2008-07-17 23:49:46 +0000
commit2c3f7ae3843bdc9dcfe85393e178211976c1f9bd (patch)
tree931e028b14e487fd6d424fd5666f5559ac11e12e /lib/CodeGen/MachineInstr.cpp
parentdc5f936bf898a945b7b5a823d00ef9b336f2dc6a (diff)
Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
Fix a leak that this turned up in LowerSubregs.cpp. And, comment a leak in LiveIntervalAnalysis.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53746 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 595a9149b3..b672cd9c12 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -21,6 +21,7 @@
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetInstrDesc.h"
#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Streams.h"
#include <ostream>
@@ -257,6 +258,8 @@ MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
/// TID NULL and no operands.
MachineInstr::MachineInstr()
: TID(0), NumImplicitOps(0), Parent(0) {
+ // Make sure that we get added to a machine basicblock
+ LeakDetector::addGarbageObject(this);
}
void MachineInstr::addImplicitDefUseOperands() {
@@ -283,6 +286,8 @@ MachineInstr::MachineInstr(const TargetInstrDesc &tid, bool NoImp)
Operands.reserve(NumImplicitOps + TID->getNumOperands());
if (!NoImp)
addImplicitDefUseOperands();
+ // Make sure that we get added to a machine basicblock
+ LeakDetector::addGarbageObject(this);
}
/// MachineInstr ctor - Work exactly the same as the ctor above, except that the
@@ -300,6 +305,8 @@ MachineInstr::MachineInstr(MachineBasicBlock *MBB,
NumImplicitOps++;
Operands.reserve(NumImplicitOps + TID->getNumOperands());
addImplicitDefUseOperands();
+ // Make sure that we get added to a machine basicblock
+ LeakDetector::addGarbageObject(this);
MBB->push_back(this); // Add instruction to end of basic block!
}
@@ -326,6 +333,7 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI) {
}
MachineInstr::~MachineInstr() {
+ LeakDetector::removeGarbageObject(this);
assert(MemOperands.empty() &&
"MachineInstr being deleted with live memoperands!");
#ifndef NDEBUG