"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
This commit is contained in:
Gabor Greif
2009-03-04 06:57:48 +00:00
parent ae3f2b6c77
commit c7f6b8c5d4
3 changed files with 10 additions and 9 deletions

View File

@ -37,9 +37,11 @@ class TargetMachine;
template <>
struct ilist_traits<MachineBasicBlock>
: public ilist_default_traits<MachineBasicBlock> {
mutable MachineBasicBlock Sentinel;
mutable ilist_node<MachineBasicBlock> Sentinel;
public:
MachineBasicBlock *createSentinel() const { return &Sentinel; }
MachineBasicBlock *createSentinel() const {
return static_cast<MachineBasicBlock*>(&Sentinel);
}
void destroySentinel(MachineBasicBlock *) const {}
void addNodeToList(MachineBasicBlock* MBB);