diff options
author | Chris Lattner <sabre@nondot.org> | 2001-09-07 16:21:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-09-07 16:21:36 +0000 |
commit | 46b23d92e31abc5923ea9da40cc60e5d6cdbb3fb (patch) | |
tree | de2889f57b52bab9c7afb90676bdb691b02baf43 | |
parent | 810affe04950e4f8e612a96b6c065448bc85d441 (diff) |
Support abstract types by keeping on the use list of the abstract type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@425 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/SymbolTable.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index 58e606f5e5..a53608f1d9 100644 --- a/include/llvm/SymbolTable.h +++ b/include/llvm/SymbolTable.h @@ -16,9 +16,9 @@ #ifndef LLVM_SYMBOL_TABLE_H #define LLVM_SYMBOL_TABLE_H +#include "llvm/Value.h" #include <vector> #include <map> -#include <string> class Value; class Type; @@ -27,7 +27,8 @@ class Type; // Make the vector be a data member, and base it on UniqueID's // That should be much more efficient! // -class SymbolTable : public map<const Type *, map<const string, Value *> > { +class SymbolTable : public AbstractTypeUser, + public map<const Type *, map<const string, Value *> > { typedef map<const string, Value *> VarMap; typedef map<const Type *, VarMap> super; @@ -53,7 +54,20 @@ public: type_iterator type_find(const Value *D); // insert - Add named definition to the symbol table... - void insert(Value *N); + inline void insert(Value *N) { + assert(N->hasName() && "Value must be named to go into symbol table!"); + insertEntry(N->getName(), N); + } + + // insert - Insert a constant or type into the symbol table with the specified + // name... There can be a many to one mapping between names and + // (constant/type)s. + // + inline void insert(const string &Name, Value *V) { + assert((V->isType() || V->isConstant()) && + "Can only insert types and constants here!"); + insertEntry(Name, V); + } void remove(Value *N); Value *type_remove(const type_iterator &It); @@ -84,6 +98,15 @@ public: inline type_const_iterator type_end(const Type *TypeID) const { return find(TypeID)->second.end(); } + +private: + // insertEntry - Insert a value into the symbol table with the specified + // name... + // + void insertEntry(const string &Name, Value *V); + + // This function is called when one of the types in the type plane are refined + virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy); }; #endif |