[llvm-commits] [llvm] r66026 - in /llvm/trunk/include/llvm/CodeGen: MachineBasicBlock.h MachineFunction.h SelectionDAG.h

Gabor Greif ggreif at gmail.com
Tue Mar 3 22:57:49 PST 2009


Author: ggreif
Date: Wed Mar  4 00:57:48 2009
New Revision: 66026

URL: http://llvm.org/viewvc/llvm-project?rev=66026&view=rev
Log:
"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 :-)

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
    llvm/trunk/include/llvm/CodeGen/MachineFunction.h
    llvm/trunk/include/llvm/CodeGen/SelectionDAG.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=66026&r1=66025&r2=66026&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Wed Mar  4 00:57:48 2009
@@ -26,14 +26,16 @@
 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);

Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=66026&r1=66025&r2=66026&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Mar  4 00:57:48 2009
@@ -37,9 +37,11 @@
 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);

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=66026&r1=66025&r2=66026&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Mar  4 00:57:48 2009
@@ -39,13 +39,10 @@
 
 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 *) {}
 





More information about the llvm-commits mailing list