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/Function.h | |
parent | 205c27d4a904c12d1bfb0b2961daab70f286cc20 (diff) |
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/Function.h')
-rw-r--r-- | include/llvm/Function.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 90a8275bec..d42c8d8aa2 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -30,21 +30,23 @@ class ParamAttrsList; // Traits for intrusive list of instructions... template<> struct ilist_traits<BasicBlock> - : public SymbolTableListTraits<BasicBlock, Function, Function> { + : public SymbolTableListTraits<BasicBlock, Function> { // createSentinel is used to create a node that marks the end of the list... static BasicBlock *createSentinel(); static void destroySentinel(BasicBlock *BB) { delete BB; } static iplist<BasicBlock> &getList(Function *F); + static ValueSymbolTable *getSymTab(Function *ItemParent); }; template<> struct ilist_traits<Argument> - : public SymbolTableListTraits<Argument, Function, Function> { + : public SymbolTableListTraits<Argument, Function> { // createSentinel is used to create a node that marks the end of the list... static Argument *createSentinel(); static void destroySentinel(Argument *A) { delete A; } static iplist<Argument> &getList(Function *F); + static ValueSymbolTable *getSymTab(Function *ItemParent); }; class Function : public GlobalValue, public Annotable { @@ -67,7 +69,7 @@ private: ParamAttrsList *ParamAttrs; ///< Parameter attributes unsigned CallingConvention; ///< Calling convention to use - friend class SymbolTableListTraits<Function, Module, Module>; + friend class SymbolTableListTraits<Function, Module>; void setParent(Module *parent); Function *Prev, *Next; @@ -238,6 +240,16 @@ public: void dropAllReferences(); }; +inline ValueSymbolTable * +ilist_traits<BasicBlock>::getSymTab(Function *F) { + return F ? &F->getValueSymbolTable() : 0; +} + +inline ValueSymbolTable * +ilist_traits<Argument>::getSymTab(Function *F) { + return F ? &F->getValueSymbolTable() : 0; +} + } // End llvm namespace #endif |