[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp StripSymbols.cpp

Reid Spencer reid at x10sys.com
Fri Jan 5 23:25:20 PST 2007



Changes in directory llvm/lib/Transforms/IPO:

DeadTypeElimination.cpp updated: 1.58 -> 1.59
StripSymbols.cpp updated: 1.9 -> 1.10
---
Log message:

For PR411: http://llvm.org/PR411 :
Take an incremental step towards type plane elimination. This change 
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


---
Diffs of the changes:  (+8 -8)

 DeadTypeElimination.cpp |    9 +++++----
 StripSymbols.cpp        |    7 +++----
 2 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.58 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.59
--- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.58	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp	Sat Jan  6 01:24:43 2007
@@ -16,7 +16,7 @@
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Analysis/FindUsedTypes.h"
 #include "llvm/Module.h"
-#include "llvm/SymbolTable.h"
+#include "llvm/TypeSymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/Statistic.h"
 using namespace llvm;
@@ -69,14 +69,15 @@
 bool DTE::runOnModule(Module &M) {
   bool Changed = false;
 
-  SymbolTable &ST = M.getSymbolTable();
+  TypeSymbolTable &ST = M.getTypeSymbolTable();
   std::set<const Type *> UsedTypes = getAnalysis<FindUsedTypes>().getTypes();
 
   // Check the symbol table for superfluous type entries...
   //
   // Grab the 'type' plane of the module symbol...
-  SymbolTable::type_iterator TI = ST.type_begin();
-  while ( TI != ST.type_end() ) {
+  TypeSymbolTable::iterator TI = ST.begin();
+  TypeSymbolTable::iterator TE = ST.end();
+  while ( TI != TE ) {
     // If this entry should be unconditionally removed, or if we detect that
     // the type is not used, remove it.
     const Type *RHS = TI->second;


Index: llvm/lib/Transforms/IPO/StripSymbols.cpp
diff -u llvm/lib/Transforms/IPO/StripSymbols.cpp:1.9 llvm/lib/Transforms/IPO/StripSymbols.cpp:1.10
--- llvm/lib/Transforms/IPO/StripSymbols.cpp:1.9	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/IPO/StripSymbols.cpp	Sat Jan  6 01:24:44 2007
@@ -29,6 +29,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/SymbolTable.h"
+#include "llvm/TypeSymbolTable.h"
 using namespace llvm;
 
 namespace {
@@ -83,13 +84,11 @@
     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->getSymbolTable().strip();
+      I->getValueSymbolTable().strip();
     }
     
     // Remove all names from types.
-    SymbolTable &SymTab = M.getSymbolTable();
-    while (SymTab.type_begin() != SymTab.type_end())
-      SymTab.remove(SymTab.type_begin());
+    M.getTypeSymbolTable().strip();
   }
 
   // Strip debug info in the module if it exists.  To do this, we remove






More information about the llvm-commits mailing list