From 9ab7f5825f225cb42a6a0e8950f841a10db82f1b Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 16 Mar 2017 17:29:33 +0000 Subject: working, added function calls --- c_compiler/src/function.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'c_compiler/src/function.cpp') diff --git a/c_compiler/src/function.cpp b/c_compiler/src/function.cpp index 24cea4c..2686287 100644 --- a/c_compiler/src/function.cpp +++ b/c_compiler/src/function.cpp @@ -62,6 +62,8 @@ VariableStackBindings Function::printAsm(VariableStackBindings bindings) const // This adds 2 to store the frame pointer and the return address unsigned memory_needed = 4*(variable_count + max_argument_count + 2); + if(memory_needed % 8 != 0) + memory_needed += 4; std::cout << "\t.text\n\t.globl\t" << id_ << "\n" << id_ << ":\n\taddiu\t$sp,$sp,-" << memory_needed << "\n\tsw\t$31," << memory_needed-4 << "($sp)\n" << "\tsw\t$fp," -- cgit