aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/src/function.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-03-20 13:11:19 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-03-20 13:11:19 +0000
commitaf8b76d0a83813b3cebac7468db4bd64e534c235 (patch)
treee387cec775526f4b0eaea5ab333baf0ae5afdb0b /c_compiler/src/function.cpp
parentb0caad48b1a2c90a03f5d130a50f3fdee1c097a5 (diff)
downloadCompiler-af8b76d0a83813b3cebac7468db4bd64e534c235.tar.gz
Compiler-af8b76d0a83813b3cebac7468db4bd64e534c235.zip
global vars work and changing to printf
Diffstat (limited to 'c_compiler/src/function.cpp')
-rw-r--r--c_compiler/src/function.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/c_compiler/src/function.cpp b/c_compiler/src/function.cpp
index 35e02f4..c1f60cd 100644
--- a/c_compiler/src/function.cpp
+++ b/c_compiler/src/function.cpp
@@ -47,6 +47,7 @@ void Function::printXml() const
VariableStackBindings Function::printAsm(VariableStackBindings bindings, unsigned& label_count) const
{
+ VariableStackBindings original_bindings = bindings;
// Counting all the variables being declared in the function
unsigned variable_count = 0;
if(statement_ != nullptr)
@@ -90,7 +91,7 @@ VariableStackBindings Function::printAsm(VariableStackBindings bindings, unsigne
<< memory_needed-8 << "($sp)\n\taddiu\t$sp,$sp," << memory_needed
<< "\n\tjr\t$31\n\tnop\n";
- return bindings;
+ return original_bindings;
}
void Function::printParameterAsm(VariableStackBindings& bindings, unsigned& stack_offset,