LLVM API Documentation
#include <SymbolTable.h>
Inheritance diagram for llvm::SymbolTable:
Public Types | |
Types | |
typedef std::map< const std::string, const Type * > | TypeMap |
A mapping of names to types. | |
typedef TypeMap::iterator | type_iterator |
An iterator over the TypeMap. | |
typedef TypeMap::const_iterator | type_const_iterator |
A const_iterator over the TypeMap. | |
typedef std::map< const std::string, Value * > | ValueMap |
A mapping of names to values. | |
typedef ValueMap::iterator | value_iterator |
An iterator over a ValueMap. | |
typedef ValueMap::const_iterator | value_const_iterator |
A const_iterator over a ValueMap. | |
typedef std::map< const Type *, ValueMap > | PlaneMap |
A mapping of types to names to values (type planes). | |
typedef PlaneMap::iterator | plane_iterator |
An iterator over the type planes. | |
typedef PlaneMap::const_iterator | plane_const_iterator |
A const_iterator over the type planes. | |
Public Member Functions | |
Constructors | |
SymbolTable () | |
~SymbolTable () | |
Accessors | |
Value * | lookup (const Type *Ty, const std::string &name) const |
Lookup a named, typed value. | |
Type * | lookupType (const std::string &name) const |
Lookup a type by name. | |
bool | hasTypes () const |
Determine if there are types in the symbol table. | |
bool | isEmpty () const |
Determine if the symbol table is empty. | |
unsigned | type_size (const Type *TypeID) const |
Get the size of a type plane. | |
unsigned | num_types () const |
The number of name/type pairs is returned. | |
std::string | get_name (const Value *Val) const |
Return the name of a value. | |
std::string | get_name (const Type *Ty) const |
Return the name of a type. | |
std::string | getUniqueName (const Type *Ty, const std::string &BaseName) const |
Get a name unique to this symbol table. | |
void | dump () const |
Print out symbol table on stderr. | |
Mutators | |
void | insert (Value *Val) |
Add a named value to the symbol table. | |
void | insert (const std::string &Name, Value *Val) |
Insert a constant or type. | |
void | insert (const std::string &Name, const Type *Typ) |
Insert a type under a new name. | |
void | remove (Value *Val) |
Remove a named value from the symbol table. | |
void | remove (const Type *Typ) |
Remove a named type from the symbol table. | |
Value * | remove (const std::string &Name, Value *Val) |
Remove a constant or type from the symbol table. | |
Type * | remove (type_iterator TI) |
Value * | value_remove (const value_iterator &It) |
Remove a specific value given by an iterator. | |
bool | strip () |
Strip the symbol table. | |
void | clear () |
Empty the symbol table completely. | |
Iteration | |
plane_iterator | plane_begin () |
plane_const_iterator | plane_begin () const |
plane_iterator | plane_end () |
plane_const_iterator | plane_end () const |
value_iterator | value_begin (const Type *Typ) |
value_const_iterator | value_begin (const Type *Typ) const |
value_iterator | value_end (const Type *Typ) |
value_const_iterator | value_end (const Type *Typ) const |
type_iterator | type_begin () |
Get an iterator to the start of the name/Type map. | |
type_const_iterator | type_begin () const |
Get a const_iterator to the start of the name/Type map. | |
type_iterator | type_end () |
type_const_iterator | type_end () const |
plane_const_iterator | find (const Type *Typ) const |
Find a type plane. | |
plane_iterator | find (const Type *Typ) |
Find a type plane. | |
const ValueMap * | findPlane (const Type *Typ) const |
Find a type plane. |
The SymbolTable provides several utility functions for answering common questions about its contents as well as an iterator interface for directly iterating over the contents. To reduce confusion, the terms "type", "value", and "plane" are used consistently. For example, There is a TypeMap typedef that is the mapping of names to Types. Similarly there is a ValueMap typedef that is the mapping of names to Values. Finally, there is a PlaneMap typedef that is the mapping of types to planes of ValueMap. This is the basic structure of the symbol table. When you call type_begin() you're asking for an iterator at the start of the TypeMap. When you call plane_begin(), you're asking for an iterator at the start of the PlaneMap. Finally, when you call value_begin(), you're asking for an iterator at the start of a ValueMap for a specific type plane.
Definition at line 44 of file SymbolTable.h.
|
A const_iterator over the type planes.
Definition at line 75 of file SymbolTable.h. |
|
An iterator over the type planes.
Definition at line 72 of file SymbolTable.h. |
|
A mapping of types to names to values (type planes).
Definition at line 69 of file SymbolTable.h. |
|
A const_iterator over the TypeMap.
Definition at line 57 of file SymbolTable.h. |
|
An iterator over the TypeMap.
Definition at line 54 of file SymbolTable.h. |
|
A mapping of names to types.
Definition at line 51 of file SymbolTable.h. |
|
A const_iterator over a ValueMap.
Definition at line 66 of file SymbolTable.h. |
|
An iterator over a ValueMap.
Definition at line 63 of file SymbolTable.h. |
|
A mapping of names to values.
Definition at line 60 of file SymbolTable.h. |
|
Definition at line 82 of file SymbolTable.h. |
|
Definition at line 27 of file SymbolTable.cpp. |
|
Empty the symbol table completely.
Definition at line 226 of file SymbolTable.h. References llvm::TypeMap< ValType, TypeClass >::clear(). |
|
Print out symbol table on stderr. This function can be used from the debugger to display the content of the symbol table while debugging. Implements llvm::AbstractTypeUser. Definition at line 494 of file SymbolTable.cpp. References DumpPlane(), and DumpTypes(). |
|
Find a type plane.
This method returns a plane_iterator for iteration over the type planes starting at a specific plane, given by Definition at line 308 of file SymbolTable.h. |
|
Find a type plane.
This method returns a plane_const_iterator for iteration over the type planes starting at a specific plane, given by Definition at line 300 of file SymbolTable.h. Referenced by llvm::Function::renameLocalSymbols(). |
|
Find a type plane. This method returns a ValueMap* for a specific type plane. This interface is deprecated and may go away in the future. Definition at line 317 of file SymbolTable.h. References I. |
|
Return the name of a type.
Finds the type Definition at line 284 of file SymbolTable.cpp. |
|
Return the name of a value.
Finds the value Definition at line 268 of file SymbolTable.cpp. References llvm::Value::getType(), value_begin(), and value_end(). |
|
Get a name unique to this symbol table. 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. Definition at line 57 of file SymbolTable.cpp. References llvm::utostr(). |
|
Determine if there are types in the symbol table.
Definition at line 108 of file SymbolTable.h. |
|
Insert a type under a new name. Inserts a type into the symbol table with the specified name. There can be a many-to-one mapping between names and types. This method allows a type with an existing entry in the symbol table to get a new name. Definition at line 177 of file SymbolTable.h. |
|
Insert a constant or type. Inserts a constant into the symbol table with the specified name. There can be a many to one mapping between names and constants. Definition at line 165 of file SymbolTable.h. |
|
Add a named value to the symbol table.
This method adds the provided value Definition at line 156 of file SymbolTable.h. References llvm::Value::getName(), llvm::Value::getType(), and llvm::Value::hasName(). Referenced by llvm::Module::addTypeName(), llvm::BytecodeReader::ParseSymbolTable(), ResolveTypes(), llvm::Instruction::setName(), llvm::GlobalVariable::setName(), llvm::Function::setName(), llvm::Argument::setName(), llvm::Constant::setName(), llvm::BasicBlock::setName(), and llvm::SymbolTableListTraits< ValueSubClass, ItemParentClass, SymTabClass, SubClass >::setParent(). |
|
Determine if the symbol table is empty.
Definition at line 113 of file SymbolTable.h. |
|
Lookup a named, typed value.
This method finds the value with the given
Definition at line 75 of file SymbolTable.cpp. Referenced by ForceRenaming(), llvm::Module::getFunction(), llvm::Module::getOrInsertFunction(), lookupInSymbolTable(), and setValueName(). |
|
Lookup a type by name.
This method finds the type with the given
Definition at line 87 of file SymbolTable.cpp. Referenced by llvm::Module::addTypeName(), llvm::Module::getTypeByName(), and LinkTypes(). |
|
The number of name/type pairs is returned.
Definition at line 122 of file SymbolTable.h. |
|
Get a const_iterator that starts at the beginning of the type planes. The iterator will iterate over the Type/ValueMap pairs in the type planes. Definition at line 241 of file SymbolTable.h. |
|
Get an iterator that starts at the beginning of the type planes. The iterator will iterate over the Type/ValueMap pairs in the type planes. Definition at line 236 of file SymbolTable.h. Referenced by llvm::Function::renameLocalSymbols(). |
|
Get a const_iterator at the end of the type planes. This serves as the marker for end of iteration over the type planes. Definition at line 249 of file SymbolTable.h. |
|
Get an iterator at the end of the type planes. This serves as the marker for end of iteration over the type planes. Definition at line 245 of file SymbolTable.h. Referenced by llvm::Function::renameLocalSymbols(). |
|
Remove a type at the specified position in the symbol table.
Definition at line 209 of file SymbolTable.h. |
|
Remove a constant or type from the symbol table. Remove a constant or type with the specified name from the symbol table.
Definition at line 201 of file SymbolTable.h. References llvm::Value::getType(). |
|
Remove a named type from the symbol table.
This method removes a named type from the symbol table. The name of the type is extracted from Definition at line 141 of file SymbolTable.cpp. References type_begin(), and type_end(). |
|
Remove a named value from the symbol table.
This method removes a named value from the symbol table. The type and name of the Value are extracted from Definition at line 95 of file SymbolTable.cpp. References llvm::Value::getName(), llvm::Value::getType(), and llvm::Value::hasName(). Referenced by llvm::Instruction::setName(), llvm::GlobalVariable::setName(), llvm::Function::setName(), llvm::Argument::setName(), llvm::BasicBlock::setName(), llvm::SymbolTableListTraits< ValueSubClass, ItemParentClass, SymTabClass, SubClass >::setParent(), and strip(). |
|
Strip the symbol table. This method will strip the symbol table of its names leaving the type and values. Definition at line 301 of file SymbolTable.cpp. References B, I, remove(), and llvm::Value::setName(). |
|
Get a const_iterator to the start of the name/Type map.
Definition at line 287 of file SymbolTable.h. |
|
Get an iterator to the start of the name/Type map.
Definition at line 284 of file SymbolTable.h. Referenced by llvm::CloneModule(), fillTypeNameTable(), llvm::Module::getTypeName(), LinkTypes(), and remove(). |
|
Get a const-iterator to the end of the name/Type map. This serves as the marker for end of iteration of the types. Definition at line 295 of file SymbolTable.h. |
|
Get an iterator to the end of the name/Type map. This serves as the marker for end of iteration of the types. Definition at line 291 of file SymbolTable.h. Referenced by llvm::CloneModule(), fillTypeNameTable(), llvm::Module::getTypeName(), LinkTypes(), and remove(). |
|
Get the size of a type plane.
The plane associated with the
Definition at line 260 of file SymbolTable.cpp. |
|
Get a const_iterator that starts at the beginning of a type plane. The iterator will iterate over the name/value pairs in the type plane.
Definition at line 262 of file SymbolTable.h. |
|
Get an iterator that starts at the beginning of a type plane. The iterator will iterate over the name/value pairs in the type plane.
Definition at line 254 of file SymbolTable.h. Referenced by get_name(). |
|
Get a const_iterator to the end of a type plane. This serves as the marker for end of iteration of the type plane.
Definition at line 278 of file SymbolTable.h. |
|
Get an iterator to the end of a type plane. This serves as the marker for end of iteration of the type plane.
Definition at line 270 of file SymbolTable.h. Referenced by get_name(). |
|
Remove a specific value given by an iterator. Removes a specific value from the symbol table.
Definition at line 216 of file SymbolTable.h. |