Implement aggregate values assignment
This commit is contained in:
+39
-13
@@ -1229,7 +1229,7 @@ begin
|
||||
if pseudo_symbol^.rtl_type^.kind = ElnaRtlTypeKind.byte_array then
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.la);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.a0, 0, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo,
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo_mem,
|
||||
tac_instruction^.operands[2].value, tac_instruction^.operands[2].length, 0);
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
@@ -1245,7 +1245,6 @@ begin
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
elna_rtl_memcpy(instructions, pseudo_symbol^.rtl_type)
|
||||
|
||||
else
|
||||
pseudo_symbol := nil
|
||||
end
|
||||
@@ -1299,19 +1298,46 @@ proc elna_rtl_copy_from_offset(instructions: ^ElnaList, tac_instruction: ^ElnaTa
|
||||
var
|
||||
instruction: ^ElnaRtlInstruction;
|
||||
rtl_operand: ElnaRtlOperand;
|
||||
pseudo_symbol: ^ElnaRtlObjectInfo;
|
||||
begin
|
||||
rtl_operand.kind := ElnaRtlKind.pseudo;
|
||||
rtl_operand.value := tac_instruction^.operands[3].value;
|
||||
rtl_operand.length := tac_instruction^.operands[3].length;
|
||||
instruction := elna_rtl_operand_address(variable_map, @tac_instruction^.operands[1], @rtl_operand);
|
||||
elna_list_append(instructions, instruction);
|
||||
pseudo_symbol := elna_symbol_table_lookup(variable_map,
|
||||
tac_instruction^.operands[3].value, tac_instruction^.operands[3].length);
|
||||
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.lw);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.pseudo,
|
||||
tac_instruction^.operands[3].value, tac_instruction^.operands[3].length, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo, tac_instruction^.operands[3].value,
|
||||
tac_instruction^.operands[3].length, tac_instruction^.operands[2].value);
|
||||
elna_list_append(instructions, instruction)
|
||||
if pseudo_symbol^.rtl_type^.kind = ElnaRtlTypeKind.byte_array then
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.la);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.a0, 0, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo_mem,
|
||||
tac_instruction^.operands[3].value, tac_instruction^.operands[3].length, 0);
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.la);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.a1, 0, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo_mem,
|
||||
tac_instruction^.operands[1].value, tac_instruction^.operands[1].length, 0);
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.addi);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.a1, 0, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.register, ElnaRtlRegister.a1, 0, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 3, ElnaRtlKind.immediate, tac_instruction^.operands[2].value, 0, 0);
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
elna_rtl_memcpy(instructions, pseudo_symbol^.rtl_type)
|
||||
else
|
||||
rtl_operand.kind := ElnaRtlKind.pseudo;
|
||||
rtl_operand.value := tac_instruction^.operands[3].value;
|
||||
rtl_operand.length := tac_instruction^.operands[3].length;
|
||||
|
||||
instruction := elna_rtl_operand_address(variable_map, @tac_instruction^.operands[1], @rtl_operand);
|
||||
elna_list_append(instructions, instruction);
|
||||
|
||||
instruction := elna_rtl_instruction_create(ElnaRtlOperator.lw);
|
||||
elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.pseudo,
|
||||
tac_instruction^.operands[3].value, tac_instruction^.operands[3].length, 0);
|
||||
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.pseudo, tac_instruction^.operands[3].value,
|
||||
tac_instruction^.operands[3].length, tac_instruction^.operands[2].value);
|
||||
elna_list_append(instructions, instruction)
|
||||
end
|
||||
end;
|
||||
|
||||
proc elna_rtl_memcpy(instructions: ^ElnaList, byte_array: ^ElnaRtlTypeByteArray);
|
||||
|
||||
Reference in New Issue
Block a user