Parse reference and dereference operators
This commit is contained in:
@ -398,6 +398,17 @@ namespace elna::riscv
|
||||
}
|
||||
}
|
||||
|
||||
void visitor::visit(source::unary_expression *expression)
|
||||
{
|
||||
const auto free_register = this->register_in_use ? x_register::a0 : x_register::t0;
|
||||
auto operand_identifier = dynamic_cast<source::variable_expression&>(expression->operand()).name();
|
||||
auto variable_symbol =
|
||||
std::dynamic_pointer_cast<source::variable_info>(this->table->lookup(operand_identifier));
|
||||
|
||||
this->instructions.push_back(instruction(base_opcode::opImm)
|
||||
.i(free_register, funct3_t::addi, x_register::s0, variable_symbol->offset));
|
||||
}
|
||||
|
||||
void visitor::visit(source::integer_literal *number)
|
||||
{
|
||||
const auto free_register = this->register_in_use ? x_register::a0 : x_register::t0;
|
||||
|
Reference in New Issue
Block a user