llvm.org GIT mirror llvm / c7f6b8c
"Ghostify" embedded sentinels. This is a real win in all cases because less bytes are allocated and subobject construction is gone. For reference how it works, see BasicBlock.h. Btw. it is very assuring to see that somebody has invented this ilist-embedded sentinel technique before me :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66026 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 11 years ago
3 changed file(s) with 10 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2525 template <>
2626 struct ilist_traits : public ilist_default_traits {
2727 private:
28 mutable MachineInstr Sentinel;
28 mutable ilist_node Sentinel;
2929
3030 // this is only set by the MachineBasicBlock owning the LiveList
3131 friend class MachineBasicBlock;
3232 MachineBasicBlock* Parent;
3333
3434 public:
35 MachineInstr *createSentinel() const { return &Sentinel; }
35 MachineInstr *createSentinel() const {
36 return static_cast(&Sentinel);
37 }
3638 void destroySentinel(MachineInstr *) const {}
3739
3840 void addNodeToList(MachineInstr* N);
3636 template <>
3737 struct ilist_traits
3838 : public ilist_default_traits {
39 mutable MachineBasicBlock Sentinel;
39 mutable ilist_node Sentinel;
4040 public:
41 MachineBasicBlock *createSentinel() const { return &Sentinel; }
41 MachineBasicBlock *createSentinel() const {
42 return static_cast(&Sentinel);
43 }
4244 void destroySentinel(MachineBasicBlock *) const {}
4345
4446 void addNodeToList(MachineBasicBlock* MBB);
3838
3939 template<> struct ilist_traits : public ilist_default_traits {
4040 private:
41 mutable SDNode Sentinel;
41 mutable ilist_node Sentinel;
4242 public:
43 ilist_traits() : Sentinel(ISD::DELETED_NODE, DebugLoc::getUnknownLoc(),
44 SDVTList()) {}
45
4643 SDNode *createSentinel() const {
47 return &Sentinel;
44 return static_cast(&Sentinel);
4845 }
4946 static void destroySentinel(SDNode *) {}
5047