aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Module.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-17 03:26:42 +0000
committerChris Lattner <sabre@nondot.org>2007-04-17 03:26:42 +0000
commit17fcdd5e1b78b829068ca657c97357a39d6e768b (patch)
treedb5c01cfda299d428837e2689e9aca31bf1bf556 /include/llvm/Module.h
parent205c27d4a904c12d1bfb0b2961daab70f286cc20 (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/Module.h')
-rw-r--r--include/llvm/Module.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 3d68e736bf..e645f51c1c 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -26,18 +26,20 @@ class GlobalValueRefMap; // Used by ConstantVals.cpp
class FunctionType;
template<> struct ilist_traits<Function>
- : public SymbolTableListTraits<Function, Module, Module> {
+ : public SymbolTableListTraits<Function, Module> {
// createSentinel is used to create a node that marks the end of the list.
static Function *createSentinel();
static void destroySentinel(Function *F) { delete F; }
static iplist<Function> &getList(Module *M);
+ static inline ValueSymbolTable *getSymTab(Module *M);
};
template<> struct ilist_traits<GlobalVariable>
- : public SymbolTableListTraits<GlobalVariable, Module, Module> {
+ : public SymbolTableListTraits<GlobalVariable, Module> {
// createSentinel is used to create a node that marks the end of the list.
static GlobalVariable *createSentinel();
static void destroySentinel(GlobalVariable *GV) { delete GV; }
static iplist<GlobalVariable> &getList(Module *M);
+ static inline ValueSymbolTable *getSymTab(Module *M);
};
/// A Module instance is used to store all the information related to an
@@ -319,6 +321,17 @@ inline std::ostream &operator<<(std::ostream &O, const Module &M) {
return O;
}
+inline ValueSymbolTable *
+ilist_traits<Function>::getSymTab(Module *M) {
+ return M ? &M->getValueSymbolTable() : 0;
+}
+
+inline ValueSymbolTable *
+ilist_traits<GlobalVariable>::getSymTab(Module *M) {
+ return M ? &M->getValueSymbolTable() : 0;
+}
+
+
} // End llvm namespace
#endif