User Guide
|
Helper visitor to replace index of array variable with integer. More...
Helper visitor to replace index of array variable with integer.
When loop is unrolled, the index variable like i
:
ca[i] <-> ca[i+1]
has type Name
in the AST. This needs to be replaced with Integer
for optimizations like constant folding. This pass look at name and binary expressions under index variables.
Definition at line 28 of file index_remover.hpp.
#include <index_remover.hpp>
Private Attributes | |
std::string | index |
index variable name More... | |
int | value |
integer value of index variable More... | |
bool | under_indexed_name = false |
true if we are visiting index variable More... | |
nmodl::visitor::IndexRemover::IndexRemover | ( | std::string | index, |
int | value | ||
) |
Definition at line 9 of file index_remover.cpp.
std::shared_ptr< ast::Expression > nmodl::visitor::IndexRemover::replace_for_name | ( | const std::shared_ptr< ast::Expression > & | node | ) | const |
if expression we are visiting is Name
then return new Integer
node
Definition at line 14 of file index_remover.cpp.
|
overridevirtual |
visit node of type ast::BinaryExpression
first recursively replaces children replace lhs & rhs if they have matching index variable
Implements nmodl::visitor::Visitor.
Definition at line 25 of file index_remover.cpp.
|
overridevirtual |
visit node of type ast::IndexedName
once all children are replaced, do the same for index
Implements nmodl::visitor::Visitor.
Definition at line 37 of file index_remover.cpp.
|
private |
index variable name
Definition at line 31 of file index_remover.hpp.
|
private |
true if we are visiting index variable
Definition at line 37 of file index_remover.hpp.
|
private |
integer value of index variable
Definition at line 34 of file index_remover.hpp.