diff options
author | Dan Gohman <gohman@apple.com> | 2008-07-28 21:51:04 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-07-28 21:51:04 +0000 |
commit | fed90b6d097d50881afb45e4d79f430db66dd741 (patch) | |
tree | 7ec1a6f6b2a8a37e054b84505502b3346c6680c7 /include/llvm/CodeGen/MachineBasicBlock.h | |
parent | 80e051dfdede65678ac66f1552278338bc1a1b33 (diff) |
Fold the useful features of alist and alist_node into ilist, and
a new ilist_node class, and remove them. Unlike alist_node,
ilist_node doesn't attempt to manage storage itself, so it avoids
the associated problems, including being opaque in gdb.
Adjust the Recycler class so that it doesn't depend on alist_node.
Also, change it to use explicit Size and Align parameters, allowing
it to work when the largest-sized node doesn't have the greatest
alignment requirement.
Change MachineInstr's MachineMemOperand list from a pool-backed
alist to a std::list for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54146 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineBasicBlock.h')
-rw-r--r-- | include/llvm/CodeGen/MachineBasicBlock.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index f0f9d54af5..8ee75c9c9f 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -19,30 +19,34 @@ #include "llvm/Support/Streams.h" namespace llvm { - class MachineFunction; + +class BasicBlock; +class MachineFunction; template <> -struct alist_traits<MachineInstr, MachineInstr> { -protected: +class ilist_traits<MachineInstr> : public ilist_default_traits<MachineInstr> { + mutable MachineInstr Sentinel; + // this is only set by the MachineBasicBlock owning the LiveList friend class MachineBasicBlock; MachineBasicBlock* Parent; - typedef alist_iterator<MachineInstr> iterator; - public: - alist_traits<MachineInstr, MachineInstr>() : Parent(0) { } + MachineInstr *createSentinel() const { return &Sentinel; } + void destroySentinel(MachineInstr *) const {} void addNodeToList(MachineInstr* N); void removeNodeFromList(MachineInstr* N); - void transferNodesFromList(alist_traits &, iterator, iterator); + void transferNodesFromList(ilist_traits &SrcTraits, + ilist_iterator<MachineInstr> first, + ilist_iterator<MachineInstr> last); void deleteNode(MachineInstr *N); +private: + void createNode(const MachineInstr &); }; -class BasicBlock; - -class MachineBasicBlock { - typedef alist<MachineInstr> Instructions; +class MachineBasicBlock : public ilist_node<MachineBasicBlock> { + typedef ilist<MachineInstr> Instructions; Instructions Insts; const BasicBlock *BB; int Number; @@ -65,6 +69,10 @@ class MachineBasicBlock { /// exception handler. bool IsLandingPad; + // Intrusive list support + friend class ilist_sentinel_traits<MachineBasicBlock>; + MachineBasicBlock() {} + explicit MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb); ~MachineBasicBlock(); @@ -287,7 +295,7 @@ public: void setNumber(int N) { Number = N; } private: // Methods used to maintain doubly linked list of blocks... - friend struct alist_traits<MachineBasicBlock>; + friend struct ilist_traits<MachineBasicBlock>; // Machine-CFG mutators |