152 std::map<std::shared_ptr<ast::Statement>,
153 std::vector<std::shared_ptr<ast::ExpressionStatement>>>
Concrete visitor for all AST classes.
Base class for all block scoped nodes.
Represents top level AST node for whole NMODL input.
Represents block encapsulating list of statements.
Wrap any other expression type.
Represent symbol table for a NMODL block.
Concrete visitor for all AST classes.
Visitor to inline local procedure and function calls
static void add_return_variable(ast::StatementBlock &block, std::string &varname)
add assignment statement at end of block (to use as a return statement in case of procedure blocks)
std::map< std::shared_ptr< ast::Statement >, std::vector< std::shared_ptr< ast::ExpressionStatement > > > inlined_statements
map to track statements being prepended before function call (typically for function calls)
static bool can_inline_block(const ast::StatementBlock &block)
true if given statement block can be inlined
void visit_program(ast::Program &node) override
visit node of type ast::Program
bool inline_function_call(ast::Block &callee, ast::FunctionCall &node, ast::StatementBlock &caller)
inline function/procedure into caller block
std::map< std::shared_ptr< ast::Statement >, ast::ExpressionStatement * > replaced_statements
map to track the statements being replaces (typically for procedure calls)
std::shared_ptr< ast::Statement > caller_statement
statement containing current function call
std::map< ast::FunctionCall *, std::string > replaced_fun_calls
map to track replaced function calls (typically for function calls)
symtab::SymbolTable const * program_symtab
symbol table for program node
std::map< std::string, int > inlined_variables
variables currently being renamed and their count (for renaming)
std::stack< std::shared_ptr< ast::Statement > > statement_stack
statements being executed in call hierarchy
std::stack< ast::StatementBlock * > statementblock_stack
statement blocks in call hierarchy
void visit_statement_block(ast::StatementBlock &node) override
visit node of type ast::StatementBlock
void visit_function_call(ast::FunctionCall &node) override
visit node of type ast::FunctionCall
ast::StatementBlock * caller_block
statement block containing current function call
bool can_replace_statement(const std::shared_ptr< ast::Statement > &statement)
true if statement can be replaced with inlined body this is possible for standalone function/procedur...
void visit_wrapped_expression(ast::WrappedExpression &node) override
Visit all wrapped expressions which can contain function calls.
void inline_arguments(ast::StatementBlock &inlined_block, const ast::ArgumentVector &callee_parameters, const ast::ExpressionVector &caller_expressions)
add assignment statements into given statement block to inline arguments
std::vector< std::shared_ptr< Argument > > ArgumentVector
std::vector< std::shared_ptr< Expression > > ExpressionVector
encapsulates code generation backend implementations
static Node * node(Object *)
Forward declarations of symbols in namespace nmodl::symtab.