Skip to content
Snippets Groups Projects
Commit 86f0d9f4 authored by FlorianKrull's avatar FlorianKrull
Browse files

Data structure offset

parent d9353a98
No related branches found
No related tags found
No related merge requests found
......@@ -4,16 +4,21 @@
#include "mcc/dynamic_array.h"
struct mcc_assembly_offset {
char *variable;
int offset;
};
struct mcc_assembly_data {
int stack_size;
int stack_offset;
int array_index;
int parameter_counter;
int arg_counter;
int is_main;
int param_offset;
struct mcc_assembly_offset **offsets;
};
};
enum mcc_asm_contant_type {MCC_ASM_CONST_FLOAT, MCC_ASM_CONST_STRING};
......@@ -28,4 +33,6 @@ struct mcc_asm_constant {
};
}
void mcc_asm_print_constant(FILE *out, struct mcc_asm_constant *constant);
#endif //MCC_ASSEMBLY_GEN_H
......@@ -9,7 +9,7 @@
#define VARIABLE_SIZE 4
int compute_stack(int variable_size)
int mcc_compute_stack(int variable_size)
{
int stack_size = variable_size * VARIABLE_SIZE;
if (stack_size % 16 != 0) {
......@@ -18,7 +18,7 @@ int compute_stack(int variable_size)
return stack_size;
}
void mcc_asm_add_constant(struct mcc_asm_constant **entries, enum mcc_asm_constant_type type, int *counter, void *value ){
void mcc_asm_add_constant(struct mcc_asm_constant **entries, enum mcc_asm_contant_type type, int *counter, void *value ){
struct mcc_asm_constant *add_const = (struct mcc_asm_constant *)malloc(sizeof(*add_const));
add_const->const_type = type;
......@@ -407,5 +407,5 @@ char *mcc_asm_gen(FILE *out, struct mcc_tac *tac)
mcc_asm_print_constant(out,constants);
//fprintf(out, ".LCONST%d:\n", i);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment