A symbol table which can be used to represent a single scoped set of a programs variables. This is simply an unordered map of strings to llvm::Values.
More...
#include <openvdb_ax/codegen/SymbolTable.h>
|
using | MapType = std::unordered_map< std::string, llvm::Value * > |
|
|
| SymbolTable () |
|
| ~SymbolTable ()=default |
|
llvm::Value * | get (const std::string &name) const |
| Get a llvm::Value from this symbol table with the given name mapping. It it does not exist, a nullptr is returned. More...
|
|
bool | exists (const std::string &name) const |
| Returns true if a variable exists in this symbol table with the given name. More...
|
|
bool | insert (const std::string &name, llvm::Value *value) |
| Insert a variable to this symbol table if it does not exist. Returns true if successfully, false if a variable already exists with the given name. More...
|
|
bool | replace (const std::string &name, llvm::Value *value) |
| Replace a variable in this symbol table. Returns true if the variable previously existed and false if not. In both cases, the variable is inserted. More...
|
|
void | clear () |
| Clear all symbols in this table. More...
|
|
const MapType & | map () const |
| Access to the underlying map. More...
|
|
A symbol table which can be used to represent a single scoped set of a programs variables. This is simply an unordered map of strings to llvm::Values.
- Note
- Consider using llvm's ValueSymbolTable
using MapType = std::unordered_map<std::string, llvm::Value*> |
Clear all symbols in this table.
bool exists |
( |
const std::string & |
name | ) |
const |
|
inline |
Returns true if a variable exists in this symbol table with the given name.
- Parameters
-
name | The name of the variable |
llvm::Value* get |
( |
const std::string & |
name | ) |
const |
|
inline |
Get a llvm::Value from this symbol table with the given name mapping. It it does not exist, a nullptr is returned.
- Parameters
-
name | The name of the variable |
bool insert |
( |
const std::string & |
name, |
|
|
llvm::Value * |
value |
|
) |
| |
|
inline |
Insert a variable to this symbol table if it does not exist. Returns true if successfully, false if a variable already exists with the given name.
- Parameters
-
name | The name of the variable |
value | The llvm::Value corresponding to this variable |
Access to the underlying map.
bool replace |
( |
const std::string & |
name, |
|
|
llvm::Value * |
value |
|
) |
| |
|
inline |
Replace a variable in this symbol table. Returns true if the variable previously existed and false if not. In both cases, the variable is inserted.
- Parameters
-
name | The name of the variable |
value | The llvm::Value corresponding to this variable |