aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Function.h2
-rw-r--r--include/llvm/SymbolTable.h19
-rw-r--r--lib/VMCore/Function.cpp8
-rw-r--r--lib/VMCore/Module.cpp2
-rw-r--r--lib/VMCore/SymbolTable.cpp16
5 files changed, 7 insertions, 40 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 87e6bad48a..bb2c3ca996 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -57,7 +57,7 @@ private:
BasicBlockListType BasicBlocks; // The basic blocks
ArgumentListType ArgumentList; // The formal arguments
- SymbolTable *SymTab, *ParentSymTab;
+ SymbolTable *SymTab;
friend class SymbolTableListTraits<Function, Module, Module>;
diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h
index 8762b4b581..7e7cb51f20 100644
--- a/include/llvm/SymbolTable.h
+++ b/include/llvm/SymbolTable.h
@@ -25,33 +25,16 @@ class SymbolTable : public AbstractTypeUser,
public:
typedef std::map<const std::string, Value *> VarMap;
typedef std::map<const Type *, VarMap> super;
-private:
-
- SymbolTable *ParentSymTab;
- friend class Function;
- inline void setParentSymTab(SymbolTable *P) { ParentSymTab = P; }
-
-public:
typedef VarMap::iterator type_iterator;
typedef VarMap::const_iterator type_const_iterator;
- inline SymbolTable(SymbolTable *P = 0) {
- ParentSymTab = P;
- InternallyInconsistent = false;
- }
+ inline SymbolTable() : InternallyInconsistent(false) {}
~SymbolTable();
- SymbolTable *getParentSymTab() { return ParentSymTab; }
-
// lookup - Returns null on failure...
Value *lookup(const Type *Ty, const std::string &name);
- // localLookup - Look in this symbol table without falling back on parent,
- // if non-existing. Returns null on failure...
- //
- Value *localLookup(const Type *Ty, const std::string &name);
-
// insert - Add named definition to the symbol table...
inline void insert(Value *N) {
assert(N->hasName() && "Value must be named to go into symbol table!");
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index d03a72a81a..5edd9ae2a6 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -84,7 +84,7 @@ Function::Function(const FunctionType *Ty, bool isInternal,
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 @@ void Function::setParent(Module *parent) {
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 @@ const Type *Function::getReturnType() const {
}
SymbolTable *Function::getSymbolTableSure() {
- if (!SymTab) SymTab = new SymbolTable(ParentSymTab);
+ if (!SymTab) SymTab = new SymbolTable();
return SymTab;
}
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 4bd3a884b3..397b5e2834 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -75,7 +75,7 @@ void Module::dump() const {
}
SymbolTable *Module::getSymbolTableSure() {
- if (!SymTab) SymTab = new SymbolTable(0);
+ if (!SymTab) SymTab = new SymbolTable();
return SymTab;
}
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
index 6d09c7d566..069f711101 100644
--- a/lib/VMCore/SymbolTable.cpp
+++ b/lib/VMCore/SymbolTable.cpp
@@ -72,7 +72,7 @@ string SymbolTable::getUniqueName(const Type *Ty, const string &BaseName) {
// 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 @@ Value *SymbolTable::localLookup(const Type *Ty, const string &Name) {
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 @@ Value *SymbolTable::removeEntry(iterator Plane, type_iterator Entry) {
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 @@ static void DumpPlane(const pair<const Type *, map<const string, Value *> >&P) {
void SymbolTable::dump() const {
std::cout << "Symbol table dump:\n";
for_each(begin(), end(), DumpPlane);
-
- if (ParentSymTab) {
- std::cout << "Parent ";
- ParentSymTab->dump();
- }
}