diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-04-29 22:57:01 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-04-29 22:57:01 +0200 |
| commit | 14d130f2854a119de69475e6f48f51ed6659953a (patch) | |
| tree | 9b9232187bc375c82d74772bb00aa3b7e8ffa1bd /boot/stage21 | |
| parent | 2342dd8429e4e6243c820c187664113557edd336 (diff) | |
| download | elna-14d130f2854a119de69475e6f48f51ed6659953a.tar.gz | |
Allow assigning variables refering to aggregates
Diffstat (limited to 'boot/stage21')
| -rw-r--r-- | boot/stage21/cl.elna | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/boot/stage21/cl.elna b/boot/stage21/cl.elna index 3e9c47a..c2d9ad1 100644 --- a/boot/stage21/cl.elna +++ b/boot/stage21/cl.elna @@ -7,6 +7,8 @@ program; (* Stage 21 compiler. *) +(* - Allow assigning variables refering to aggregates. *) + type ElnaListNode = record next: Word @@ -1284,7 +1286,7 @@ begin elna_rtl_instruction_set_operand(instruction, 2, source_operand.kind, source_operand.value, source_operand.length, 0); elna_list_append(instructions, instruction); else - elna_rtl_memcpy(instructions, @source_operand, pseudo_symbol^.rtl_type, ElnaRtlKind.pseudo, + elna_rtl_memcpy(instructions, @source_operand, pseudo_symbol^.rtl_type, source_operand.kind, tac_instruction^.operands[2].value, tac_instruction^.operands[2].length) end end; @@ -1548,12 +1550,16 @@ var begin (* pseudo or pseudo_mem. *) if instruction^.operands[2].kind <> ElnaRtlKind.data then - pseudo_symbol := elna_alloc_variable(instruction^.operands[2].value, instruction^.operands[2].length, - variable_map); - instruction^.operator := ElnaRtlOperator.addi; + pseudo_symbol := elna_symbol_table_lookup(variable_map, instruction^.operands[2].value, instruction^.operands[2].length); - elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.register, ElnaRtlRegister.sp, 0, 0); - elna_rtl_instruction_set_operand(instruction, 3, ElnaRtlKind.immediate, pseudo_symbol^.counter, 0, 0) + if pseudo_symbol^.kind = ElnaRtlInfoKind.object_info then + pseudo_symbol := elna_alloc_variable(instruction^.operands[2].value, instruction^.operands[2].length, + variable_map); + instruction^.operator := ElnaRtlOperator.addi; + + elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.register, ElnaRtlRegister.sp, 0, 0); + elna_rtl_instruction_set_operand(instruction, 3, ElnaRtlKind.immediate, pseudo_symbol^.counter, 0, 0) + end end; if instruction^.operands[1].kind = ElnaRtlKind.pseudo then elna_alloc_operation_target(instructions, instruction, variable_map) |
