From 58b50ccb63856aed6a1c7ccf1c62478eedbd63ab Mon Sep 17 00:00:00 2001 From: Meyer Simon Date: Fri, 4 Apr 2025 18:06:01 -0400 Subject: [PATCH] Added some of the implementation but not complete #t51 --- src/intermediate_code.c | 2 ++ src/intermediate_code.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/intermediate_code.c b/src/intermediate_code.c index 38cbe10..c1e5980 100644 --- a/src/intermediate_code.c +++ b/src/intermediate_code.c @@ -100,6 +100,8 @@ void emit_function_call(char* result, char* name){ } void emit_return(char* value){ emit_helper(); + current->opcode = RETURN; + current->operand1 = look_up(cur, name); return; } void emit_reserve(char* result, char* type_name, int size){ diff --git a/src/intermediate_code.h b/src/intermediate_code.h index 464d331..499d4c3 100644 --- a/src/intermediate_code.h +++ b/src/intermediate_code.h @@ -29,8 +29,10 @@ typedef enum { CGOTO, // 5 LESSTHEN, // 6 rule 1 + 5 EQUALTO, // 6 rule 1 + 5 + CALL, // 7 PARAM, // 7 - CALL // 7 + RETURN // 7 + } Op; typedef struct Instruction {