diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-07 06:22:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-07 06:22:45 +0000 |
commit | 7f1444bc0aefdd924e9b231e20d4c0529311e141 (patch) | |
tree | 0e1008865a141be2a99c669820f50e4074f98144 /lib | |
parent | a3832fd46af09872a9c6322b9d23df8b4934c897 (diff) | |
download | external_llvm-7f1444bc0aefdd924e9b231e20d4c0529311e141.zip external_llvm-7f1444bc0aefdd924e9b231e20d4c0529311e141.tar.gz external_llvm-7f1444bc0aefdd924e9b231e20d4c0529311e141.tar.bz2 |
shrink vmcore by moving symbol table stripping support out of VMCore into
the one IPO pass that uses it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/StripSymbols.cpp | 25 | ||||
-rw-r--r-- | lib/VMCore/TypeSymbolTable.cpp | 11 | ||||
-rw-r--r-- | lib/VMCore/ValueSymbolTable.cpp | 16 |
3 files changed, 23 insertions, 29 deletions
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp index 4c0b35a..58b7b71 100644 --- a/lib/Transforms/IPO/StripSymbols.cpp +++ b/lib/Transforms/IPO/StripSymbols.cpp @@ -73,6 +73,27 @@ static void RemoveDeadConstant(Constant *C) { } } +// Strip the symbol table of its names. +// +static void StripSymtab(ValueSymbolTable &ST) { + for (ValueSymbolTable::iterator VI = ST.begin(), VE = ST.end(); VI != VE; ) { + Value *V = VI->second; + ++VI; + if (!isa<GlobalValue>(V) || cast<GlobalValue>(V)->hasInternalLinkage()) { + // Set name to "", removing from symbol table! + V->setName(""); + } + } +} + +// Strip the symbol table of its names. +static void StripTypeSymtab(TypeSymbolTable &ST) { + for (TypeSymbolTable::iterator TI = ST.begin(), E = ST.end(); TI != E; ) + ST.remove(TI++); +} + + + bool StripSymbols::runOnModule(Module &M) { // If we're not just stripping debug info, strip all symbols from the // functions and the names from any internal globals. @@ -85,11 +106,11 @@ bool StripSymbols::runOnModule(Module &M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { if (I->hasInternalLinkage()) I->setName(""); // Internal symbols can't participate in linkage - I->getValueSymbolTable().strip(); + StripSymtab(I->getValueSymbolTable()); } // Remove all names from types. - M.getTypeSymbolTable().strip(); + StripTypeSymtab(M.getTypeSymbolTable()); } // Strip debug info in the module if it exists. To do this, we remove diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp index b145adc..7eaa63a 100644 --- a/lib/VMCore/TypeSymbolTable.cpp +++ b/lib/VMCore/TypeSymbolTable.cpp @@ -111,17 +111,6 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) { } } -// Strip the symbol table of its names. -bool TypeSymbolTable::strip() { - bool RemovedSymbol = false; - for (iterator TI = tmap.begin(); TI != tmap.end(); ) { - remove(TI++); - RemovedSymbol = true; - } - - return RemovedSymbol; -} - // This function is called when one of the types in the type plane are refined void TypeSymbolTable::refineAbstractType(const DerivedType *OldType, const Type *NewType) { diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp index 41b6d7b..142b9f9 100644 --- a/lib/VMCore/ValueSymbolTable.cpp +++ b/lib/VMCore/ValueSymbolTable.cpp @@ -59,22 +59,6 @@ Value *ValueSymbolTable::lookup(const std::string &Name) const { return 0; } -// Strip the symbol table of its names. -// -bool ValueSymbolTable::strip() { - bool RemovedSymbol = false; - for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ) { - Value *V = VI->second; - ++VI; - if (!isa<GlobalValue>(V) || cast<GlobalValue>(V)->hasInternalLinkage()) { - // Set name to "", removing from symbol table! - V->setName(""); - RemovedSymbol = true; - } - } - return RemovedSymbol; -} - // Insert a value into the symbol table with the specified name... // void ValueSymbolTable::insert(Value* V) { |