shrink vmcore by moving symbol table stripping support out of VMCore into
authorChris Lattner <sabre@nondot.org>
Wed, 7 Feb 2007 06:22:45 +0000 (06:22 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 7 Feb 2007 06:22:45 +0000 (06:22 +0000)
the one IPO pass that uses it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33990 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/TypeSymbolTable.h
include/llvm/ValueSymbolTable.h
lib/Transforms/IPO/StripSymbols.cpp
lib/VMCore/TypeSymbolTable.cpp
lib/VMCore/ValueSymbolTable.cpp

index dd2600142228a71c7a99b72e80aa1208f18e9ae4..abe312ec242428a7e48c775b5a929c8f4c424fe1 100644 (file)
@@ -98,10 +98,6 @@ public:
 /// @{
 public:
 
-  /// This method will strip the symbol table of its names 
-  /// @brief Strip the symbol table.
-  bool strip();
-
   /// Inserts a type into the symbol table with the specified name. There can be
   /// a many-to-one mapping between names and types. This method allows a type
   /// with an existing entry in the symbol table to get a new name.
index d17cd7729c19e6177811dd615991569ae79a4701..b05e404a44203961cf888e0974878e94b30d4f57 100644 (file)
@@ -120,12 +120,6 @@ public:
 /// @}
 /// @name Mutators
 /// @{
-public:
-
-  /// This method will strip the symbol table of its names.
-  /// @brief Strip the symbol table.
-  bool strip();
-  
 private:
   /// This method adds the provided value \p N to the symbol table.  The Value
   /// must have a name which is used to place the value in the symbol table. 
index 4c0b35a1a4e78ee597c6d5fd1f602b4765000d04..58b7b7146703faa31ab27eadca82e56fc3fee59a 100644 (file)
@@ -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
index b145adc23880a2001b75c38d97d7db559310d601..7eaa63a342c535c18c529f6b37258c922dd9d4ac 100644 (file)
@@ -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) {
index 41b6d7b5a3feaac39314f9942b15194a7cfcf483..142b9f9f085ef98efee52ac3a6fbafe128f9975b 100644 (file)
@@ -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) {