Loading...
Searching...
No Matches
SymbolTable Struct Reference

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>`

## Public Types

using | MapType = std::unordered_map<std::string, llvm::Value*>

## Public Member Functions

| 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.
bool | exists (const std::string &name) const
| Returns true if a variable exists in this symbol table with the given name.
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.
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.
void | clear ()
| Clear all symbols in this table.
const MapType & | map () const
| Access to the underlying map.

## Detailed Description

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

## Member Typedef Documentation

## MapType

using MapType = std::unordered_map<std::string, llvm::Value*>

## Constructor & Destructor Documentation

## SymbolTable()

SymbolTable | ( |  | ) |

inline

## ~SymbolTable()

~SymbolTable | ( |  | ) |

default

## Member Function Documentation

## clear()

void clear | ( |  | ) |

inline

Clear all symbols in this table.

## exists()

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

## get()

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

## insert()

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

## map()

const MapType & map | ( |  | ) | const

inline

Access to the underlying map.

## replace()

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