1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

"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 :-)

llvm-svn: 66026
This commit is contained in:
Gabor Greif 2009-03-04 06:57:48 +00:00
parent 7d9019d0f3
commit f8d2f7429d
3 changed files with 10 additions and 9 deletions

View File

@ -26,14 +26,16 @@ class MachineFunction;
template <>
struct ilist_traits<MachineInstr> : public ilist_default_traits<MachineInstr> {
private:
mutable MachineInstr Sentinel;
mutable ilist_node<MachineInstr> Sentinel;
// this is only set by the MachineBasicBlock owning the LiveList
friend class MachineBasicBlock;
MachineBasicBlock* Parent;
public:
MachineInstr *createSentinel() const { return &Sentinel; }
MachineInstr *createSentinel() const {
return static_cast<MachineInstr*>(&Sentinel);
}
void destroySentinel(MachineInstr *) const {}
void addNodeToList(MachineInstr* N);

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);

View File

@ -39,13 +39,10 @@ class FunctionLoweringInfo;
template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
private:
mutable SDNode Sentinel;
mutable ilist_node<SDNode> Sentinel;
public:
ilist_traits() : Sentinel(ISD::DELETED_NODE, DebugLoc::getUnknownLoc(),
SDVTList()) {}
SDNode *createSentinel() const {
return &Sentinel;
return static_cast<SDNode*>(&Sentinel);
}
static void destroySentinel(SDNode *) {}