Parse parameter list

This commit is contained in:
2024-03-28 00:55:13 +01:00
parent 12869f0ec7
commit 90430c47f4
10 changed files with 76 additions and 14 deletions

View File

@ -157,6 +157,8 @@ namespace elna::riscv
void visitor::prologue()
{
this->variable_counter = 1;
this->instructions.push_back(instruction(base_opcode::opImm));
this->instructions.push_back(instruction(base_opcode::store));
this->instructions.push_back(instruction(base_opcode::store));
@ -195,7 +197,7 @@ namespace elna::riscv
this->instructions.push_back(instruction(base_opcode::op)
.r(x_register::a0, funct3_t::_and, x_register::zero, x_register::zero));
epilogue(static_cast<std::uint32_t>(variable_counter * 4 + 8 + main_symbol->stack_size()));
epilogue(static_cast<std::uint32_t>(this->variable_counter * 4 + 8 + main_symbol->stack_size()));
this->writer->sink(definition->identifier(),
reinterpret_cast<const std::byte *>(this->instructions.data()),
this->instructions.size() * sizeof(instruction));
@ -224,7 +226,7 @@ namespace elna::riscv
this->instructions.push_back(instruction(base_opcode::op)
.r(x_register::a0, funct3_t::_and, x_register::zero, x_register::zero));
epilogue(static_cast<std::uint32_t>(variable_counter * 4 + 8 + main_symbol->stack_size()));
epilogue(static_cast<std::uint32_t>(this->variable_counter * 4 + 8 + main_symbol->stack_size()));
this->writer->sink("main", reinterpret_cast<const std::byte *>(this->instructions.data()),
this->instructions.size() * sizeof(instruction));
}