From 9c0a21f929e1fb5dae27e64668e4dd81eb66df08 Mon Sep 17 00:00:00 2001 From: Fredrik Robertsen Date: Sun, 29 Mar 2026 17:36:19 +0200 Subject: [PATCH] ps5: function epilogue --- ps5/src/generator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ps5/src/generator.c b/ps5/src/generator.c index edabd67..9d17000 100644 --- a/ps5/src/generator.c +++ b/ps5/src/generator.c @@ -148,6 +148,10 @@ static void generate_function(symbol_t* function) // TODO (Task 4): the function body can be sent to generate_statement() // TODO (Task 3.2): Emit the epilogue, including a label and a default return value (0) + LABEL(".%s.epilogue", function->name); + MOVQ(RBP, RSP); + POPQ(RBP); + RET; } // Generates code for a function call, which can either be a statement or an expression