X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSymbolTable.h;h=a53608f1d955b01fa963fb463f9e60cb2ae30596;hb=46b23d92e31abc5923ea9da40cc60e5d6cdbb3fb;hp=dfb78eee822ad1767b27e1a692af20e9ff147e4a;hpb=009505452b713ed2e3a8e99c5545a6e721c65495;p=oota-llvm.git diff --git a/include/llvm/SymbolTable.h b/include/llvm/SymbolTable.h index dfb78eee822..a53608f1d95 100644 --- a/include/llvm/SymbolTable.h +++ b/include/llvm/SymbolTable.h @@ -1,4 +1,4 @@ -//===-- llvm/SymbolTable.h - Implement a type planed symtab -------*- C++ -*-=// +//===-- llvm/SymbolTable.h - Implement a type planned symtab ------*- C++ -*-=// // // This file implements a symbol table that has planed broken up by type. // Identical types may have overlapping symbol names as long as they are @@ -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,11 +54,30 @@ 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); + // getUniqueName - Given a base name, return a string that is either equal to + // it (or derived from it) that does not already occur in the symbol table for + // the specified type. + // + string getUniqueName(const Type *Ty, const string &BaseName); + inline unsigned type_size(const Type *TypeID) const { return find(TypeID)->second.size(); } @@ -78,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