93 std::unique_ptr<printer::JSONPrinter>
printer;
139 bool symbol_to_skip(
const std::shared_ptr<symtab::Symbol>& symbol)
const;
252 void print(std::ostream& ss)
const {
Concrete visitor for all AST classes.
Represents a AFTER block in NMODL.
Represents a block to be executed before or after another block.
Represents a BEFORE block in NMODL.
Represents binary expression in the NMODL.
Represents a BREAKPOINT block in NMODL.
Represents CONDUCTANCE statement in NMODL.
Represents a CONSTRUCTOR block in the NMODL.
Represents DERIVATIVE block in the NMODL.
Represents a DESTRUCTOR block in the NMODL.
Represents a INITIAL block in the NMODL.
Represents LINEAR block in the NMODL.
Represents NONLINEAR block in the NMODL.
Represents a prime variable (for ODE)
Represents top level AST node for whole NMODL input.
Represents block encapsulating list of statements.
Represents SUFFIX statement in NMODL.
Represents USEION statement in NMODL.
Represent symbol table for a NMODL block.
Concrete constant visitor for all AST classes.
Visitor for measuring performance related information
int get_const_global_variable_count() const noexcept
void visit_valence(const ast::Valence &) override
visit node of type ast::Valence
void visit_ba_block(const ast::BABlock &node) override
visit node of type ast::BABlock
std::string global_memw_key
void visit_program(const ast::Program &node) override
visit node of type ast::Program
static bool is_constant_variable(const std::shared_ptr< symtab::Symbol > &symbol)
void compact_json(bool flag)
void visit_local_list_statement(const ast::LocalListStatement &) override
visit node of type ast::LocalListStatement
void visit_initial_block(const ast::InitialBlock &node) override
skip initial block under net_receive block
int num_pointer_variables
count of pointer / bbcorepointer variables
void visit_useion(const ast::Useion &) override
visit node of type ast::Useion
int get_state_variable_count() const noexcept
void visit_constructor_block(const ast::ConstructorBlock &node) override
visit node of type ast::ConstructorBlock
int num_random_variables
count of RANDOM variables
int num_localized_global_variables
subset of global variables which are localized
const utils::PerfStat & get_total_perfstat() const noexcept
void print(std::ostream &ss) const
int get_instance_variable_count() const noexcept
symtab::SymbolTable * current_symtab
symbol table of current block being visited
std::string const_memw_key
std::string global_memr_key
void visit_breakpoint_block(const ast::BreakpointBlock &node) override
visit node of type ast::BreakpointBlock
void update_memory_ops(const std::string &name)
Find symbol in closest scope (up to parent) and update read/write count.
void visit_if_statement(const ast::IfStatement &node) override
visit node of type ast::IfStatement
int get_global_variable_count() const noexcept
void visit_name(const ast::Name &node) override
every variable used is of type name, update counters
bool visiting_lhs_expression
true while visiting lhs of binary expression (to count write operations)
utils::PerfStat total_perf
total performance of mod file
void measure_performance(const ast::Ast &node)
Helper function used by all ast nodes : visit all children recursively and performance stats get adde...
void visit_destructor_block(const ast::DestructorBlock &node) override
visit node of type ast::DestructorBlock
void visit_discrete_block(const ast::DiscreteBlock &node) override
visit node of type ast::DiscreteBlock
utils::PerfStat current_block_perf
performance of current block
int num_constant_instance_variables
subset of instance variables which are constant
void visit_derivative_block(const ast::DerivativeBlock &node) override
visit node of type ast::DerivativeBlock
int num_localized_instance_variables
subset of instance variables which are localized
std::string const_memr_key
keys used in map to track var usage
std::stack< utils::PerfStat > blocks_perf
performance stats of all blocks being visited in recursive chain
std::unique_ptr< printer::JSONPrinter > printer
to print to json file
void visit_unary_expression(const ast::UnaryExpression &node) override
visit node of type ast::UnaryExpression
void print_memory_usage()
void visit_prime_name(const ast::PrimeName &node) override
prime name derived from identifier and hence need to be handled here
void visit_function_table_block(const ast::FunctionTableBlock &node) override
visit node of type ast::FunctionTableBlock
std::map< std::string, std::set< std::string > > var_usage
map of variables to count unique read-writes
int get_const_instance_variable_count() const noexcept
void add_perf_to_printer(const utils::PerfStat &perf) const
add performance stats to json printer
void visit_statement_block(const ast::StatementBlock &node) override
Blocks like function can have multiple statement blocks and blocks like net receive has nested initia...
void visit_before_block(const ast::BeforeBlock &node) override
visit node of type ast::BeforeBlock
void visit_function_call(const ast::FunctionCall &node) override
count function calls and "most useful" or "commonly used" math functions
void visit_solve_block(const ast::SolveBlock &node) override
solve is not a statement but could have associated block and hence could/should not be skipped comple...
void visit_else_if_statement(const ast::ElseIfStatement &node) override
visit node of type ast::ElseIfStatement
void visit_for_netcon(const ast::ForNetcon &node) override
visit node of type ast::ForNetcon
std::stringstream stream
if not json, all goes to string
void visit_binary_expression(const ast::BinaryExpression &node) override
count math operations from all binary expressions
std::stack< utils::PerfStat > children_blocks_perf
performance of current all childrens
bool under_function_call
whether function call is being visited
void visit_after_block(const ast::AfterBlock &node) override
visit node of type ast::AfterBlock
void visit_net_receive_block(const ast::NetReceiveBlock &node) override
visit node of type ast::NetReceiveBlock
int num_global_variables
count of global variables
void visit_kinetic_block(const ast::KineticBlock &node) override
visit node of type ast::KineticBlock
void visit_suffix(const ast::Suffix &) override
visit node of type ast::Suffix
void visit_linear_block(const ast::LinearBlock &node) override
visit node of type ast::LinearBlock
int num_state_variables
count of state variables
void visit_non_linear_block(const ast::NonLinearBlock &node) override
visit node of type ast::NonLinearBlock
int num_instance_variables
count of per channel instance variables
void visit_procedure_block(const ast::ProcedureBlock &node) override
visit node of type ast::ProcedureBlock
bool under_solve_block
whether solve block is being visited
static bool is_local_variable(const std::shared_ptr< symtab::Symbol > &symbol)
bool under_net_receive_block
whether net receive block is being visited
bool start_measurement
whether to measure performance for current block
void visit_function_block(const ast::FunctionBlock &node) override
visit node of type ast::FunctionBlock
int num_constant_global_variables
subset of global variables which are constant
bool symbol_to_skip(const std::shared_ptr< symtab::Symbol > &symbol) const
Certain statements / symbols needs extra check while measuring read/write operations.
void visit_conductance_hint(const ast::ConductanceHint &) override
certain constructs needs to be excluded from usage counting and hence need to provide empty implement...
encapsulates code generation backend implementations
static Node * node(Object *)
Implement class for performance statistics.
Forward references of symbols defined in namespace nmodl::printer.
Base class for all Abstract Syntax Tree node types.
Helper class to collect performance statistics.
Forward declarations of symbols in namespace nmodl::symtab.