aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/MachineBasicBlock.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/MachineBasicBlock.cpp
parentdc5f936bf898a945b7b5a823d00ef9b336f2dc6a (diff)
downloadexternal_llvm-2c3f7ae3843bdc9dcfe85393e178211976c1f9bd.zip
external_llvm-2c3f7ae3843bdc9dcfe85393e178211976c1f9bd.tar.gz
external_llvm-2c3f7ae3843bdc9dcfe85393e178211976c1f9bd.tar.bz2
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/MachineBasicBlock.cpp')
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index 31e6ea8..9a9f5b9 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -18,6 +18,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetInstrDesc.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Support/LeakDetector.h"
#include <algorithm>
using namespace llvm;
@@ -26,6 +27,10 @@ MachineBasicBlock::MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb)
Insts.getTraits().Parent = this;
}
+MachineBasicBlock::~MachineBasicBlock() {
+ LeakDetector::removeGarbageObject(this);
+}
+
std::ostream& llvm::operator<<(std::ostream &OS, const MachineBasicBlock &MBB) {
MBB.print(OS);
return OS;
@@ -46,11 +51,14 @@ void alist_traits<MachineBasicBlock>::addNodeToList(MachineBasicBlock* N) {
MachineRegisterInfo &RegInfo = MF.getRegInfo();
for (MachineBasicBlock::iterator I = N->begin(), E = N->end(); I != E; ++I)
I->AddRegOperandsToUseLists(RegInfo);
+
+ LeakDetector::removeGarbageObject(N);
}
void alist_traits<MachineBasicBlock>::removeNodeFromList(MachineBasicBlock* N) {
N->getParent()->removeFromMBBNumbering(N->Number);
N->Number = -1;
+ LeakDetector::addGarbageObject(N);
}
@@ -65,6 +73,8 @@ void alist_traits<MachineInstr>::addNodeToList(MachineInstr* N) {
// use/def lists.
MachineFunction *MF = Parent->getParent();
N->AddRegOperandsToUseLists(MF->getRegInfo());
+
+ LeakDetector::removeGarbageObject(N);
}
/// removeNodeFromList (MI) - When we remove an instruction from a basic block
@@ -77,6 +87,8 @@ void alist_traits<MachineInstr>::removeNodeFromList(MachineInstr* N) {
N->RemoveRegOperandsFromUseLists();
N->setParent(0);
+
+ LeakDetector::addGarbageObject(N);
}
/// transferNodesFromList (MI) - When moving a range of instructions from one