diff options
Diffstat (limited to 'c_compiler/src/expression.cpp')
-rw-r--r-- | c_compiler/src/expression.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/c_compiler/src/expression.cpp b/c_compiler/src/expression.cpp index fd78799..e65d2f7 100644 --- a/c_compiler/src/expression.cpp +++ b/c_compiler/src/expression.cpp @@ -689,12 +689,13 @@ VariableStackBindings AssignmentExpression::printAsm(VariableStackBindings bindi // evaluate rhs and get the result back at the stack position I assigned // don't have to change the stack position as there is no lhs to evaluate rhs_->printAsm(bindings, label_count); - - // now the result of the rhs will be in that stack position, so we can load it into $2 - printf("\tlw\t$2,%d($fp)\n", expression_stack_position); + bindings.nextExpressionStackPosition(); // we are assigning so we don't have to evaluate the lhs as it will be overwritten anyways lhs_postfix->stackPosition(bindings, label_count); + + // now the result of the rhs will be in that stack position, so we can load it into $2 + printf("\tlw\t$2,%d($fp)\n", expression_stack_position); printf("\tsw\t$2,0($t0)\n"); return bindings; } |