From 10a1fc0bc485cb0ac20aff586182a66932d3be64 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 13 Mar 2017 19:34:53 +0000 Subject: Reformatted and working --- c_compiler/src/expression.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'c_compiler/src/expression.cpp') diff --git a/c_compiler/src/expression.cpp b/c_compiler/src/expression.cpp index 5e15f42..7c0bd8b 100644 --- a/c_compiler/src/expression.cpp +++ b/c_compiler/src/expression.cpp @@ -40,17 +40,17 @@ VariableStackBindings AssignmentExpression::printAsm(VariableStackBindings bindi { // TODO // the lhs is forced to have a stack position due to it being a function, array or other type of variable - /*unsigned current_stack = bindings.currentRegister(); + // unsigned current_stack = bindings.currentRegister(); // std::cout << "Current Register: " << current_reg << std::endl; - bindings.increaseRegister(); + // bindings.increaseRegister(); - int store_stack_position = lhs->getPostfixStackPosition(bindings); + int store_stack_position = lhs_->postfixStackPosition(bindings); - rhs->printAsm(bindings); + rhs_->printAsm(bindings); // we are assigning so we don't have to evaluate the lhs as it will be overwritten anyways - std::cout << "\tsw\t$" << current_reg << "," << store_stack_position - << "($fp)" << std::endl; */ + std::cout << "\tsw\t$" << 2 << "," << store_stack_position + << "($fp)" << std::endl; return bindings; } @@ -145,13 +145,13 @@ int Identifier::postfixStackPosition(VariableStackBindings bindings) const // Constant definition Constant::Constant(const int32_t& constant) - : m_constant(constant) + : constant_(constant) {} VariableStackBindings Constant::printAsm(VariableStackBindings bindings) const { // constant only has to load to $2 because the other expression will take care of the rest - std::cout << "\tli\t$2," << m_constant << std::endl; + std::cout << "\tli\t$2," << constant_ << std::endl; return bindings; } -- cgit