diff options
author | Tanya Lattner <tonic@nondot.org> | 2004-05-24 06:11:51 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2004-05-24 06:11:51 +0000 |
commit | 792699c46ef9bfc47dd459bbfa7e71bcb2cee29a (patch) | |
tree | 09579fa1fb5054e308cfb202d2c63d643d9b9120 /include/llvm/CodeGen/MachineFunction.h | |
parent | 2b90565e3df82377eaadff30ac0bc5fbb54e91e7 (diff) |
Added MachineFunction parent* to MachineBasicBlock. Customized ilist template
to set the parent when a MachineBasicBlock is added to a MachineFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13716 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index cb9958bb1f..dcec822f8e 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -23,6 +23,39 @@ namespace llvm { +// ilist_traits +template <> +class ilist_traits<MachineBasicBlock> { + // this is only set by the MachineFunction owning the ilist + friend class MachineFunction; + MachineFunction* parent; + +public: + ilist_traits<MachineBasicBlock>() : parent(0) { } + + static MachineBasicBlock* getPrev(MachineBasicBlock* N) { return N->Prev; } + static MachineBasicBlock* getNext(MachineBasicBlock* N) { return N->Next; } + + static const MachineBasicBlock* + getPrev(const MachineBasicBlock* N) { return N->Prev; } + + static const MachineBasicBlock* + getNext(const MachineBasicBlock* N) { return N->Next; } + + static void setPrev(MachineBasicBlock* N, MachineBasicBlock* prev) { N->Prev = prev; } + static void setNext(MachineBasicBlock* N, MachineBasicBlock* next) { N->Next = next; } + + static MachineBasicBlock* createNode(); + void addNodeToList(MachineBasicBlock* N); + void removeNodeFromList(MachineBasicBlock* N); + void transferNodesFromList( + iplist<MachineBasicBlock, ilist_traits<MachineBasicBlock> >& toList, + ilist_iterator<MachineBasicBlock> first, + ilist_iterator<MachineBasicBlock> last); +}; + + + class Function; class TargetMachine; class SSARegMap; |