From: Chris Lattner Date: Fri, 7 Sep 2001 16:21:36 +0000 (+0000) Subject: Support abstract types by keeping on the use list of the abstract type. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=46b23d92e31abc5923ea9da40cc60e5d6cdbb3fb;p=oota-llvm.git 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 --- diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index 58e606f5e52..a53608f1d95 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 #include -#include 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 > { +class SymbolTable : public AbstractTypeUser, + public map > { typedef map VarMap; typedef map 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