diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-17 03:26:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-17 03:26:42 +0000 |
commit | 17fcdd5e1b78b829068ca657c97357a39d6e768b (patch) | |
tree | db5c01cfda299d428837e2689e9aca31bf1bf556 /include/llvm/SymbolTableListTraits.h | |
parent | 205c27d4a904c12d1bfb0b2961daab70f286cc20 (diff) | |
download | llvm-17fcdd5e1b78b829068ca657c97357a39d6e768b.tar.gz llvm-17fcdd5e1b78b829068ca657c97357a39d6e768b.tar.bz2 llvm-17fcdd5e1b78b829068ca657c97357a39d6e768b.tar.xz |
Refactor SymbolTableListTraits to only have a single pointer in it, instead
of two. This shrinkifies Function by 8 bytes (104->96) and Module by 8
bytes (68->60). On a testcase of mine, this reduces the memory used to
read a module header from 565680b to 561024, a little over 4K.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/SymbolTableListTraits.h')
-rw-r--r-- | include/llvm/SymbolTableListTraits.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/include/llvm/SymbolTableListTraits.h b/include/llvm/SymbolTableListTraits.h index 969c03fc55..099cfe0ca7 100644 --- a/include/llvm/SymbolTableListTraits.h +++ b/include/llvm/SymbolTableListTraits.h @@ -31,24 +31,17 @@ template<typename NodeTy> class ilist_iterator; template<typename NodeTy, typename Traits> class iplist; template<typename Ty> struct ilist_traits; -// ValueSubClass - The type of objects that I hold -// ItemParentType - I call setParent() on all of my "ValueSubclass" items, and -// this is the value that I pass in. -// SymTabType - This is the class type, whose symtab I insert my -// ValueSubClass items into. Most of the time it is -// ItemParentType, but Instructions have item parents of BB's -// but symtabtype's of a Function +// ValueSubClass - The type of objects that I hold, e.g. Instruction. +// ItemParentType - The type of object that owns the list, e.g. BasicBlock. +// TraitBaseClass - The class this trait should inherit from, it should +// inherit from ilist_traits<ValueSubClass> // -template<typename ValueSubClass, typename ItemParentClass, typename SymTabClass, - typename SubClass=ilist_traits<ValueSubClass> > +template<typename ValueSubClass, typename ItemParentClass> class SymbolTableListTraits { - SymTabClass *SymTabObject; + typedef ilist_traits<ValueSubClass> TraitsClass; ItemParentClass *ItemParent; public: - SymbolTableListTraits() : SymTabObject(0), ItemParent(0) {} - - SymTabClass *getParent() { return SymTabObject; } - const SymTabClass *getParent() const { return SymTabObject; } + SymbolTableListTraits() : ItemParent(0) {} static ValueSubClass *getPrev(ValueSubClass *V) { return V->getPrev(); } static ValueSubClass *getNext(ValueSubClass *V) { return V->getNext(); } @@ -68,10 +61,10 @@ public: ilist_traits<ValueSubClass> > &L2, ilist_iterator<ValueSubClass> first, ilist_iterator<ValueSubClass> last); - //private: - void setItemParent(ItemParentClass *IP) { ItemParent = IP; }//This is private! - void setParent(SymTabClass *Parent); // This is private! + void setItemParent(ItemParentClass *IP) { ItemParent = IP; } + template<typename TPtr> + void setSymTabObject(TPtr *, TPtr); }; } // End llvm namespace |