summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-05-07 07:57:16 +0200
committerEugen Wissner <belka@caraus.de>2026-05-07 07:57:16 +0200
commit92e88cfcb2b6b8258f68945a0be8846cffa72c6a (patch)
treee8c9e00539715bc7504a810c2e92ac8b0b7bdbda /boot
parenteaef813be1d9e4a9c014d03ed7bbef6a82c5ab54 (diff)
downloadelna-92e88cfcb2b6b8258f68945a0be8846cffa72c6a.tar.gz
Implement aggregate values assignment
Diffstat (limited to 'boot')
-rw-r--r--boot/stage21/cl.elna52
1 files changed, 39 insertions, 13 deletions
diff --git a/boot/stage21/cl.elna b/boot/stage21/cl.elna
index b8672f9..35777ba 100644
--- a/boot/stage21/cl.elna
+++ b/boot/stage21/cl.elna
@@ -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);