From 8b3b5171b5dd6ae6ec4c305cb16f8c17f5dc9a8e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 17 Jul 2008 23:49:46 +0000 Subject: 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 --- lib/CodeGen/MachineInstr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/CodeGen/MachineInstr.cpp') 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 @@ -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 -- cgit v1.2.3