#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "cpp_io.h"
#include "cc_scan.h"
#include "cc_symtab.h"
#include "cc_code_gen.h"
Functions | |
_codegen * | CodeGen_Create (int fd) |
create a code generator structure | |
void | CodeGen_Destroy (struct _codegen *cg) |
destroy a code generator structure | |
void | CodeGen_Dump (struct _codegen *cg, int fd) |
dump the code generator structure | |
void | Increment_Level (struct _codegen *cg) |
increment the current level by one | |
void | Decrement_Level (struct _codegen *cg) |
decrement the current level by one | |
int | CG_Instr_Parms (int i) |
determine the length of the parameter of an instruction | |
void | CG_Param (struct _codegen *cg, int p, int sz) |
emit a parameter of an instruction | |
void | CG_Put (struct _codegen *cg, int i, int p, int sz) |
emit an instruction | |
void | CG_Put_Cond_Operator (struct _codegen *cg, int i, int p, int sz) |
emit an instruction for conditionals | |
int | CG_Put_Global_Data (struct _codegen *cg, char *dat, int len, int align) |
transfer data into the global data area | |
void | CG_Link_Global_Data (struct _codegen *cg, char *name, int l) |
manage links to global data area | |
void | CG_New_ExpImp (struct _codegen *cg, char *name, st_bind_t b, st_type_t t) |
create or update an entry in the symbol list | |
void | CG_Link_ExpImp (struct _codegen *cg, char *name) |
handle the export and import list for symbols | |
void | CG_Put_Branch (struct _codegen *cg, int i, int p) |
emit an branch instruction | |
void | CG_Load (struct _codegen *cg, struct _item *x) |
load a variable onto the stack | |
int | CG_Read_Short (struct _codegen *cg, int at) |
read two bytes from the code at a given address | |
int | CG_Read_Long (struct _codegen *cg, int at) |
read four bytes from the code at a given address | |
void | CG_Fix (struct _codegen *cg, int at, int with) |
do the branch destination fixup for relative addresses | |
void | CG_Fix_Long (struct _codegen *cg, int at, int with) |
do the branch destination fixup for absolute addresses | |
int | CG_Merged (struct _codegen *cg, int l0, int l1) |
merge two blocks | |
void | CG_Fix_With (struct _codegen *cg, int l0, int l1) |
void | CG_Fix_Link (struct _codegen *cg, int l) |
do the branch destination fixup | |
void | CG_Fix_Link_Long (struct _codegen *cg, int l) |
do the branch destination fixup | |
void | CG_Put_Operator (struct _codegen *cg, int op, struct _item *x, struct _item *y) |
emit code for a logical operator | |
int | CG_Negated_Operator (int op) |
determination of the negation of an operator | |
void | CG_Call (struct _codegen *cg, struct _item *x, char *name) |
emit the code for a function call | |
void | CG_Call_Predefined (struct _codegen *cg, struct _item *x, char *name) |
emit the code for a call of an predefined (builtin) function | |
int | CG_Forward_Jump (struct _codegen *cg, int l) |
handle a forward jump to an (yet) unknown address | |
void | CG_Backward_Jump (struct _codegen *cg, int l) |
handle a backward jump to an already known address | |
int | CG_Function_Prolog (struct _codegen *cg, int par) |
emit code for the function prolog | |
void | CG_Function_Epilog (struct _codegen *cg, int par, int loc, int f) |
emit code for the function epilog |
|
handle a backward jump to an already known address
|
|
emit the code for a function call
|
|
emit the code for a call of an predefined (builtin) function
|
|
do the branch destination fixup for relative addresses
|
|
do the branch destination fixup
|
|
do the branch destination fixup
|
|
do the branch destination fixup for absolute addresses
|
|
|
|
handle a forward jump to an (yet) unknown address
|
|
emit code for the function epilog
|
|
emit code for the function prolog
|
|
determine the length of the parameter of an instruction
|
|
handle the export and import list for symbols
|
|
manage links to global data area
|
|
load a variable onto the stack
|
|
merge two blocks
|
|
determination of the negation of an operator
|
|
create or update an entry in the symbol list
|
|
emit a parameter of an instruction
|
|
emit an instruction
|
|
emit an branch instruction
|
|
emit an instruction for conditionals
|
|
transfer data into the global data area
|
|
emit code for a logical operator
|
|
read four bytes from the code at a given address
|
|
read two bytes from the code at a given address
|
|
create a code generator structure
|
|
destroy a code generator structure
|
|
dump the code generator structure
|
|
decrement the current level by one
|
|
increment the current level by one
|