From 5bff8c38a48bcafbad1388e84fdf7940a28dece8 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 10 Apr 2026 06:02:14 +0200 Subject: [PATCH] Swap source and target operands for unary TAC operators --- boot/stage21/cl.elna | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boot/stage21/cl.elna b/boot/stage21/cl.elna index 67b785a..b7cb3de 100644 --- a/boot/stage21/cl.elna +++ b/boot/stage21/cl.elna @@ -1123,11 +1123,11 @@ var instruction: ^ElnaRtlInstruction; rtl_operand: ElnaRtlOperand; begin - elna_rtl_operand_value(instructions, @tac_instruction^.operands[2], variable_map, @rtl_operand); + elna_rtl_operand_value(instructions, @tac_instruction^.operands[1], variable_map, @rtl_operand); instruction := elna_rtl_instruction_create(rtl_operator); elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.pseudo, - tac_instruction^.operands[1].value, tac_instruction^.operands[1].length, 0); + tac_instruction^.operands[2].value, tac_instruction^.operands[2].length, 0); elna_rtl_instruction_set_operand(instruction, 2, rtl_operand.kind, rtl_operand.value, rtl_operand.length, 0); elna_list_append(instructions, instruction) @@ -2331,15 +2331,15 @@ begin elna_tac_make_variable(@operand^.kind, @operand^.value, @operand^.length, symbol_table); instruction := elna_tac_instruction_create(ElnaTacOperator.negate); - elna_tac_instruction_set_operand(instruction, 1, operand^.kind, operand^.value, operand^.length); - elna_tac_instruction_set_operand(instruction, 2, base.kind, base.value, base.length); + elna_tac_instruction_set_operand(instruction, 1, base.kind, base.value, base.length); + elna_tac_instruction_set_operand(instruction, 2, operand^.kind, operand^.value, operand^.length); elna_list_append(instructions, instruction) elsif operator = '~' then elna_tac_make_variable(@operand^.kind, @operand^.value, @operand^.length, symbol_table); instruction := elna_tac_instruction_create(ElnaTacOperator.complement); - elna_tac_instruction_set_operand(instruction, 1, operand^.kind, operand^.value, operand^.length); - elna_tac_instruction_set_operand(instruction, 2, base.kind, base.value, base.length); + elna_tac_instruction_set_operand(instruction, 1, base.kind, base.value, base.length); + elna_tac_instruction_set_operand(instruction, 2, operand^.kind, operand^.value, operand^.length); elna_list_append(instructions, instruction) elsif operand_result.kind = ElnaTacOperandType.dereferenced_pointer then elna_tac_make_variable(@operand^.kind, @operand^.value, @operand^.length, symbol_table);