implemented annies and meyers stuff

This commit is contained in:
Scarlett
2025-04-25 23:09:46 -04:00
parent 74dc4f568f
commit 747a48b211
4 changed files with 199 additions and 176 deletions

View File

@ -278,11 +278,11 @@ void emit_conditional_jump(Op condition, int label, ...) {
va_end(argptr);
}
void emit_function_start(int name) {
void emit_function_start(TNodeOrConst * name) {
emit_helper();
current->opcode = E_LABEL; // I think this is right TODO: ask
current->label = name;
// this is probabaly a func decleration
current->operand1 = name;
// this is probabaly a func declaration
}
void emit_parameter(TNodeOrConst* param) {
@ -380,11 +380,9 @@ char * temp_var_gen(){
return ret;
}
*/
char* label_gen() {
char* ret = calloc(9, sizeof(*ret));
sprintf(ret, "L_%d", label_count);
int label_gen(){
label_count++;
return ret;
return label_count;
}
TableNode* getTN(TNodeOrConst* tnc) {
@ -393,7 +391,7 @@ TableNode* getTN(TNodeOrConst* tnc) {
}
return NULL;
}
//we must fix this
int getConst(TNodeOrConst* tnc) {
if (tnc->d == INTEGER) {
return tnc->tnc_union->integer;