[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Module.cpp SymbolTable.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 15 16:27:03 PDT 2002


Changes in directory llvm/lib/VMCore:

Function.cpp updated: 1.33 -> 1.34
Module.cpp updated: 1.29 -> 1.30
SymbolTable.cpp updated: 1.25 -> 1.26

---
Log message:

  - Eliminate SymbolTable::ParentSymTab, ST::localLookup, and
    Function::ParentSymTab.  These aren't needed at all.


---
Diffs of the changes:

Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.33 llvm/lib/VMCore/Function.cpp:1.34
--- llvm/lib/VMCore/Function.cpp:1.33	Sun Oct 13 15:53:14 2002
+++ llvm/lib/VMCore/Function.cpp	Tue Oct 15 16:26:29 2002
@@ -84,7 +84,7 @@
   BasicBlocks.setParent(this);
   ArgumentList.setItemParent(this);
   ArgumentList.setParent(this);
-  ParentSymTab = SymTab = 0;
+  SymTab = 0;
 
   // Create the arguments vector, all arguments start out unnamed.
   for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) {
@@ -127,10 +127,6 @@
   Parent = parent;
   if (getParent())
     LeakDetector::removeGarbageObject(this);
-
-  // Relink symbol tables together...
-  ParentSymTab = Parent ? Parent->getSymbolTableSure() : 0;
-  if (SymTab) SymTab->setParentSymTab(ParentSymTab);
 }
 
 const FunctionType *Function::getFunctionType() const {
@@ -142,7 +138,7 @@
 }
 
 SymbolTable *Function::getSymbolTableSure() {
-  if (!SymTab) SymTab = new SymbolTable(ParentSymTab);
+  if (!SymTab) SymTab = new SymbolTable();
   return SymTab;
 }
 


Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.29 llvm/lib/VMCore/Module.cpp:1.30
--- llvm/lib/VMCore/Module.cpp:1.29	Sun Sep  8 13:59:35 2002
+++ llvm/lib/VMCore/Module.cpp	Tue Oct 15 16:26:29 2002
@@ -75,7 +75,7 @@
 }
 
 SymbolTable *Module::getSymbolTableSure() {
-  if (!SymTab) SymTab = new SymbolTable(0);
+  if (!SymTab) SymTab = new SymbolTable();
   return SymTab;
 }
 


Index: llvm/lib/VMCore/SymbolTable.cpp
diff -u llvm/lib/VMCore/SymbolTable.cpp:1.25 llvm/lib/VMCore/SymbolTable.cpp:1.26
--- llvm/lib/VMCore/SymbolTable.cpp:1.25	Tue Jun 25 11:13:00 2002
+++ llvm/lib/VMCore/SymbolTable.cpp	Tue Oct 15 16:26:29 2002
@@ -72,7 +72,7 @@
 
 
 // lookup - Returns null on failure...
-Value *SymbolTable::localLookup(const Type *Ty, const string &Name) {
+Value *SymbolTable::lookup(const Type *Ty, const string &Name) {
   iterator I = find(Ty);
   if (I != end()) {                      // We have symbols in that plane...
     type_iterator J = I->second.find(Name);
@@ -83,13 +83,6 @@
   return 0;
 }
 
-// lookup - Returns null on failure...
-Value *SymbolTable::lookup(const Type *Ty, const string &Name) {
-  Value *LV = localLookup(Ty, Name);
-  if (LV) return LV;
-  return ParentSymTab ? ParentSymTab->lookup(Ty, Name) : 0;
-}
-
 void SymbolTable::remove(Value *N) {
   assert(N->hasName() && "Value doesn't have name!");
   if (InternallyInconsistent) return;
@@ -154,7 +147,7 @@
 void SymbolTable::insertEntry(const string &Name, const Type *VTy, Value *V) {
 
   // Check to see if there is a naming conflict.  If so, rename this value!
-  if (localLookup(VTy, Name)) {
+  if (lookup(VTy, Name)) {
     string UniqueName = getUniqueName(VTy, Name);
     assert(InternallyInconsistent == false && "Infinite loop inserting entry!");
     InternallyInconsistent = true;
@@ -339,9 +332,4 @@
 void SymbolTable::dump() const {
   std::cout << "Symbol table dump:\n";
   for_each(begin(), end(), DumpPlane);
-
-  if (ParentSymTab) {
-    std::cout << "Parent ";
-    ParentSymTab->dump();
-  }
 }





More information about the llvm-commits mailing list