|
Nearly CC
An educational compiler skeleton
|
Function encapsulates all of the information needed to generate and optimize code for a function. More...
#include "function.h"
Public Member Functions | |
| Function (const std::string &name, Node *funcdef_ast, Symbol *symbol) | |
| Constructor. More... | |
| std::string | get_name () const |
| Get the function name. More... | |
| Node * | get_funcdef_ast () const |
| Get the function definition AST. More... | |
| Symbol * | get_symbol () const |
| Get the function's symbol table entry. More... | |
| std::shared_ptr< InstructionSequence > | get_hl_iseq () const |
| Get the high-level InstructionSequence. More... | |
| void | set_hl_iseq (const std::shared_ptr< InstructionSequence > &hl_iseq) |
| Set the high-level InstructionSequence. More... | |
| std::shared_ptr< InstructionSequence > | get_ll_iseq () const |
| Get the low-level InstructionSequence. More... | |
| void | set_ll_iseq (const std::shared_ptr< InstructionSequence > &ll_iseq) |
| Set the low-level InstructionSequence. More... | |
Function encapsulates all of the information needed to generate and optimize code for a function.
This includes (at a minimum) the function name, function definition AST, the symbol table entry, generated high-level code, and generated low-level code. However, you can add any additional fields that would be helpful. In particular, any information about a function that needs to be communicated between phases, such as storage allocation decisions, can also be collected in the Function object.
Constructor.
| name | the name of the function |
| funcdef_ast | the function definition AST |
| symbol | the function's symbol table entry |
| Node * Function::get_funcdef_ast | ( | ) | const |
Get the function definition AST.
| std::shared_ptr< InstructionSequence > Function::get_hl_iseq | ( | ) | const |
Get the high-level InstructionSequence.
| std::shared_ptr< InstructionSequence > Function::get_ll_iseq | ( | ) | const |
Get the low-level InstructionSequence.
| std::string Function::get_name | ( | ) | const |
Get the function name.
| Symbol * Function::get_symbol | ( | ) | const |
Get the function's symbol table entry.
| void Function::set_hl_iseq | ( | const std::shared_ptr< InstructionSequence > & | hl_iseq | ) |
Set the high-level InstructionSequence.
| shared | pointer to the high-level InstructionSequence |
| void Function::set_ll_iseq | ( | const std::shared_ptr< InstructionSequence > & | ll_iseq | ) |
Set the low-level InstructionSequence.
| shared | pointer to the low-level InstructionSequence |