A CodeGenerationContext keeps track of the needed stack size of the program, the mapping from variables to stack ddresses, the currently known lists, and the configuration patterns with they indices in the program encountered so far.
More...
#include <RuleBasedProgramTree.h>
A CodeGenerationContext keeps track of the needed stack size of the program, the mapping from variables to stack ddresses, the currently known lists, and the configuration patterns with they indices in the program encountered so far.
◆ CodeGenerationContext()
autopas::RuleSyntax::CodeGenerationContext::CodeGenerationContext |
( |
std::map< std::string, std::pair< const Define *, size_t > > |
initialAddressEnvironment | ) |
|
|
explicit |
Constructs a CodeGenerationContext.
- Parameters
-
initialAddressEnvironment | The predefined variables with their definition and stack address. |
◆ addConfigurationOrder()
size_t autopas::RuleSyntax::CodeGenerationContext::addConfigurationOrder |
( |
const ConfigurationOrder & |
configurationOrder | ) |
|
Adds a configuration order and assigns it an index that can be used to refer to it later.
- Parameters
-
configurationOrder | The new configuration order. |
- Returns
- The index of the new configuration order.
◆ addGlobalVariable()
void autopas::RuleSyntax::CodeGenerationContext::addGlobalVariable |
( |
const Define & |
definition | ) |
|
Adds a global variable definition that can be used in the program later.
- Parameters
-
definition | The definition to add. |
◆ addList()
void autopas::RuleSyntax::CodeGenerationContext::addList |
( |
const std::string & |
name, |
|
|
const DefineList * |
list |
|
) |
| |
Adds a list definition that can be used later in the program.
- Parameters
-
name | The name of the list. |
list | The list definition. |
◆ addLocalVariable()
void autopas::RuleSyntax::CodeGenerationContext::addLocalVariable |
( |
const Define & |
definition | ) |
|
Adds a local variable definition that can be used in the program later.
- Parameters
-
definition | The definition to add. |
◆ addressOf()
size_t autopas::RuleSyntax::CodeGenerationContext::addressOf |
( |
const std::string & |
name | ) |
const |
- Parameters
-
name | The name of a variable. |
- Returns
- the address of the variable on the stack.
◆ allocateStack()
void autopas::RuleSyntax::CodeGenerationContext::allocateStack |
( |
size_t |
num | ) |
|
Allocates the given number of MemoryCells on the stack.
- Parameters
-
num | The number of cells to allocate. |
◆ definitionOf()
const Define * autopas::RuleSyntax::CodeGenerationContext::definitionOf |
( |
const std::string & |
name | ) |
const |
- Parameters
-
name | The name of a variable. |
- Returns
- The definition of the variable.
◆ freeStack()
void autopas::RuleSyntax::CodeGenerationContext::freeStack |
( |
size_t |
num | ) |
|
Frees the given number of MemoryCells on the stack.
- Parameters
-
num | The number of cells to free. |
◆ getConfigurationOrders()
const std::vector< ConfigurationOrder > & autopas::RuleSyntax::CodeGenerationContext::getConfigurationOrders |
( |
| ) |
const |
- Returns
- All configuration orders.
◆ getList()
const DefineList * autopas::RuleSyntax::CodeGenerationContext::getList |
( |
const std::string & |
name | ) |
|
- Parameters
-
name | The name of a defined list. |
- Returns
- the definition of the list with the given name.
◆ getMaxStackSize()
auto autopas::RuleSyntax::CodeGenerationContext::getMaxStackSize |
( |
| ) |
const |
|
inline |
- Returns
- the maximum needed stack size of the program.
◆ getNumLocalVariables()
size_t autopas::RuleSyntax::CodeGenerationContext::getNumLocalVariables |
( |
| ) |
const |
- Returns
- The number of local variables.
◆ smallerConfigurationPatternByIndex()
ConfigurationPattern autopas::RuleSyntax::CodeGenerationContext::smallerConfigurationPatternByIndex |
( |
size_t |
idx | ) |
const |
- Parameters
-
idx | An index of a configuration order. |
- Returns
- The smaller pattern of the configuration order with the given index.
The documentation for this class was generated from the following files:
- autopas/tuning/tuningStrategy/ruleBasedTuning/RuleBasedProgramTree.h
- autopas/tuning/tuningStrategy/ruleBasedTuning/RuleBasedProgramTree.cpp