Decaf Compiler
|
Compiler phase 4: code generation. More...
#include "p4-codegen.h"
Classes | |
struct | CodeGenData |
State/data for the code generator visitor. More... | |
Macros | |
#define | DATA ((CodeGenData*)visitor->data) |
Macro for more convenient access to the error list inside a visitor data structure. | |
Typedefs | |
typedef struct CodeGenData | CodeGenData |
State/data for the code generator visitor. | |
Functions | |
CodeGenData * | CodeGenData_new (void) |
Allocate memory for code gen data. | |
void | CodeGenData_free (CodeGenData *data) |
Deallocate memory for code gen data. | |
Operand | var_base (ASTNode *node, Symbol *variable) |
Fills a register with the base address of a variable. | |
Operand | var_offset (ASTNode *node, Symbol *variable) |
Calculates the offset of a scalar variable reference and fills a register with that offset. | |
InsnList * | generate_code (ASTNode *tree) |
Convert an AST into linear ILOC code. | |
Compiler phase 4: code generation.
void CodeGenData_free | ( | CodeGenData * | data | ) |
Deallocate memory for code gen data.
data | Pointer to the structure to be deallocated |
CodeGenData * CodeGenData_new | ( | void | ) |
Allocate memory for code gen data.
Convert an AST into linear ILOC code.
tree | Root of AST |
Fills a register with the base address of a variable.
node | AST node to emit code into (if needed) |
variable | Desired variable |