summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-03-04 06:57:48 +0000
committerGabor Greif <ggreif@gmail.com>2009-03-04 06:57:48 +0000
commita954a99c403432338406da3752a2ab5da598f2b0 (patch)
tree7fe5253eec70c6aaaa1f4311ddd756366f1cb795 /llvm
parent8322dc809e2e1c8477c68eb5e778e2646c8faf8e (diff)
downloadbcm5719-llvm-a954a99c403432338406da3752a2ab5da598f2b0.tar.gz
bcm5719-llvm-a954a99c403432338406da3752a2ab5da598f2b0.zip
"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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/CodeGen/MachineBasicBlock.h6
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h6
-rw-r--r--llvm/include/llvm/CodeGen/SelectionDAG.h7
3 files changed, 10 insertions, 9 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 54ac47008f2..5a9f3991f2c 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -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);
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index 689e4357b1d..1371f1d0cdf 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -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);
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 9ecba590dd4..fe89fe05460 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -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 *) {}
OpenPOWER on IntegriCloud