LLVM API Documentation

llvm::ValueSymbolTable Class Reference

#include <ValueSymbolTable.h>

Collaboration diagram for llvm::ValueSymbolTable:

Collaboration graph
[legend]
List of all members.

Public Types

Types
typedef std::map< const std::string,
Value * > 
ValueMap
 A mapping of names to values.
typedef ValueMap::iterator iterator
 An iterator over a ValueMap.
typedef ValueMap::const_iterator const_iterator
 A const_iterator over a ValueMap.

Public Member Functions

Accessors
Valuelookup (const std::string &name) const
 Lookup a named Value.
bool empty () const
 Determine if the symbol table is empty.
unsigned size () const
 The number of name/type pairs is returned.
std::string getUniqueName (const std::string &BaseName) const
 Get a name unique to this symbol table.
void dump () const
 Print out symbol table on stderr.
Iteration
iterator begin ()
 Get an iterator that from the beginning of the symbol table.
const_iterator begin () const
 Get a const_iterator that from the beginning of the symbol table.
iterator end ()
 Get an iterator to the end of the symbol table.
const_iterator end () const
 Get a const_iterator to the end of the symbol table.
Mutators
bool strip ()
 Strip the symbol table.
void insert (Value *Val)
 Add a named value to the symbol table.
bool erase (Value *Val)
 Remove a value from the symbol table.
bool rename (Value *V, const std::string &Name)
 Rename a value in the symbol table.

Detailed Description

This class provides a symbol table of name/value pairs. It is essentially a std::map<std::string,Value*> but has a controlled interface provided by LLVM as well as ensuring uniqueness of names.

Definition at line 28 of file ValueSymbolTable.h.


Member Typedef Documentation

typedef std::map<const std::string, Value *> llvm::ValueSymbolTable::ValueMap

A mapping of names to values.

Definition at line 35 of file ValueSymbolTable.h.

typedef ValueMap::iterator llvm::ValueSymbolTable::iterator

An iterator over a ValueMap.

Definition at line 38 of file ValueSymbolTable.h.

typedef ValueMap::const_iterator llvm::ValueSymbolTable::const_iterator

A const_iterator over a ValueMap.

Definition at line 41 of file ValueSymbolTable.h.


Constructor & Destructor Documentation

llvm::ValueSymbolTable::ValueSymbolTable (  )  [inline]

Definition at line 48 of file ValueSymbolTable.h.

ValueSymbolTable::~ValueSymbolTable (  ) 

Definition at line 27 of file ValueSymbolTable.cpp.

llvm::ValueSymbolTable::ValueSymbolTable (  )  [inline]

Definition at line 48 of file ValueSymbolTable.h.

ValueSymbolTable::~ValueSymbolTable (  ) 

Definition at line 27 of file ValueSymbolTable.cpp.


Member Function Documentation

Value * ValueSymbolTable::lookup ( const std::string &  name  )  const

Lookup a named Value.

This method finds the value with the given name in the the symbol table.

Returns:
the value associated with the name

Definition at line 58 of file ValueSymbolTable.cpp.

bool llvm::ValueSymbolTable::empty (  )  const [inline]

Determine if the symbol table is empty.

Returns:
true iff the symbol table is empty

Definition at line 64 of file ValueSymbolTable.h.

unsigned llvm::ValueSymbolTable::size (  )  const [inline]

The number of name/type pairs is returned.

Definition at line 67 of file ValueSymbolTable.h.

std::string ValueSymbolTable::getUniqueName ( const std::string &  BaseName  )  const

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 45 of file ValueSymbolTable.cpp.

References llvm::utostr().

Referenced by insert(), and rename().

void ValueSymbolTable::dump (  )  const

Print out symbol table on stderr.

This function can be used from the debugger to display the content of the symbol table while debugging.

Definition at line 163 of file ValueSymbolTable.cpp.

References DumpVal().

Referenced by erase(), and insert().

iterator llvm::ValueSymbolTable::begin (  )  [inline]

Get an iterator that from the beginning of the symbol table.

Definition at line 86 of file ValueSymbolTable.h.

const_iterator llvm::ValueSymbolTable::begin (  )  const [inline]

Get a const_iterator that from the beginning of the symbol table.

Definition at line 89 of file ValueSymbolTable.h.

iterator llvm::ValueSymbolTable::end (  )  [inline]

Get an iterator to the end of the symbol table.

Definition at line 92 of file ValueSymbolTable.h.

const_iterator llvm::ValueSymbolTable::end (  )  const [inline]

Get a const_iterator to the end of the symbol table.

Definition at line 95 of file ValueSymbolTable.h.

bool ValueSymbolTable::strip (  ) 

Strip the symbol table.

This method will strip the symbol table of its names.

Definition at line 67 of file ValueSymbolTable.cpp.

References V.

void ValueSymbolTable::insert ( Value Val  ) 

Add a named value to the symbol table.

This method adds the provided value N to the symbol table. The Value must have a name which is used to place the value in the symbol table.

Definition at line 83 of file ValueSymbolTable.cpp.

References dump(), getUniqueName(), and V.

bool ValueSymbolTable::erase ( Value Val  ) 

Remove a value from the symbol table.

This method removes a value from the symbol table. The name of the Value is extracted from Val and used to lookup the Value in the symbol table. If the Value is not in the symbol table, this method returns false.

Returns:
true if Val was successfully erased, false otherwise

Definition at line 100 of file ValueSymbolTable.cpp.

References dump(), and V.

bool ValueSymbolTable::rename ( Value V,
const std::string &  Name 
)

Rename a value in the symbol table.

Given a value with a non-empty name, remove its existing entry from the symbol table and insert a new one for Name. This is equivalent to doing "remove(V), V->Name = Name, insert(V)".

Definition at line 121 of file ValueSymbolTable.cpp.

References getUniqueName(), and V.


The documentation for this class was generated from the following files: