diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-16 07:17:43 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-16 07:17:43 +0000 |
commit | aad5c0505183a5b7913f1a443a1f0650122551cc (patch) | |
tree | c67e8d48e44e95a8791e18f4484931c7a389bc9c /include/llvm/CodeGen | |
parent | 19831ec8531b0710629c1b0a8c0323e70ae0ef07 (diff) |
Add LeakDetection to MachineInstr.
Move out of line member functions of MachineBasicBlock to
MachineBasicBlock.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/MachineBasicBlock.h | 28 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 3 |
2 files changed, 9 insertions, 22 deletions
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index a0b7f26f20..3469a5e9d9 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -24,8 +24,6 @@ namespace llvm { template <> class ilist_traits<MachineInstr> { - typedef ilist_traits<MachineInstr> self; - // this is only set by the MachineBasicBlock owning the ilist friend class MachineBasicBlock; MachineBasicBlock* parent; @@ -45,25 +43,13 @@ public: static void setPrev(MachineInstr* N, MachineInstr* prev) { N->prev = prev; } static void setNext(MachineInstr* N, MachineInstr* next) { N->next = next; } - static MachineInstr* createNode() { return new MachineInstr(0, 0); } - - void addNodeToList(MachineInstr* N) { - assert(N->parent == 0 && "machine instruction already in a basic block"); - N->parent = parent; - } - - void removeNodeFromList(MachineInstr* N) { - assert(N->parent != 0 && "machine instruction not in a basic block"); - N->parent = 0; - } - - void transferNodesFromList(iplist<MachineInstr, self>& toList, - ilist_iterator<MachineInstr> first, - ilist_iterator<MachineInstr> last) { - if (parent != toList.parent) - for (; first != last; ++first) - first->parent = toList.parent; - } + static MachineInstr* createNode(); + void addNodeToList(MachineInstr* N); + void removeNodeFromList(MachineInstr* N); + void transferNodesFromList( + iplist<MachineInstr, ilist_traits<MachineInstr> >& toList, + ilist_iterator<MachineInstr> first, + ilist_iterator<MachineInstr> last); }; class BasicBlock; diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index a1507c8d23..a90f1333a5 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -345,7 +345,6 @@ private: // Intrusive list support // friend class ilist_traits<MachineInstr>; - MachineInstr() : Opcode(0), numImplicitRefs(0) { /* used only by ilist */ } public: MachineInstr(short Opcode, unsigned numOperands); @@ -363,6 +362,8 @@ public: /// MachineInstr(MachineBasicBlock *MBB, short Opcode, unsigned numOps); + ~MachineInstr(); + const MachineBasicBlock* getParent() const { return parent; } MachineBasicBlock* getParent() { return parent; } |