[llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp MachineBasicBlock.cpp
Tanya Brethour
tbrethou at cs.uiuc.edu
Mon May 24 02:16:06 PDT 2004
Changes in directory llvm/lib/CodeGen:
MachineFunction.cpp updated: 1.57 -> 1.58
MachineBasicBlock.cpp updated: 1.12 -> 1.13
---
Log message:
Moved MachineBasicBlock deconstructor to cpp file and removed it from LeakDetector to fix memory leak bug.
---
Diffs of the changes: (+11 -5)
Index: llvm/lib/CodeGen/MachineFunction.cpp
diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.57 llvm/lib/CodeGen/MachineFunction.cpp:1.58
--- llvm/lib/CodeGen/MachineFunction.cpp:1.57 Mon May 24 01:11:46 2004
+++ llvm/lib/CodeGen/MachineFunction.cpp Mon May 24 02:14:26 2004
@@ -98,9 +98,9 @@
ilist_iterator<MachineBasicBlock> first,
ilist_iterator<MachineBasicBlock> last)
{
- if (parent != toList.parent)
+ if (Parent != toList.Parent)
for (; first != last; ++first)
- first->Parent = toList.parent;
+ first->Parent = toList.Parent;
}
MachineFunction::MachineFunction(const Function *F,
@@ -110,7 +110,7 @@
MFInfo = new MachineFunctionInfo(*this);
FrameInfo = new MachineFrameInfo();
ConstantPool = new MachineConstantPool();
- BasicBlocks.parent = this;
+ BasicBlocks.Parent = this;
}
MachineFunction::~MachineFunction() {
Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.12 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.13
--- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.12 Mon May 24 01:11:47 2004
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp Mon May 24 02:14:27 2004
@@ -20,14 +20,20 @@
#include "Support/LeakDetector.h"
using namespace llvm;
+MachineBasicBlock::~MachineBasicBlock() {
+ LeakDetector::removeGarbageObject(this);
+}
+
+
+
// MBBs start out as #-1. When a MBB is added to a MachineFunction, it
// gets the next available unique MBB number. If it is removed from a
// MachineFunction, it goes back to being #-1.
void ilist_traits<MachineBasicBlock>::addNodeToList (MachineBasicBlock* N)
{
assert(N->Parent == 0 && "machine instruction already in a basic block");
- N->Parent = parent;
- N->Number = parent->getNextMBBNumber();
+ N->Parent = Parent;
+ N->Number = Parent->getNextMBBNumber();
LeakDetector::removeGarbageObject(N);
More information about the llvm-commits
mailing list