mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user