summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-03-20 19:00:34 +0100
committerEugen Wissner <belka@caraus.de>2026-03-20 19:00:34 +0100
commit5230d65efdf829c331a54f6947f383d75b9b1016 (patch)
treeae9e29948a7488f1c96789e10e3a53c27369a583
parent5fb3c910a6a05e1d85f837193a9221bc5ac5f4a6 (diff)
downloadelna-5230d65efdf829c331a54f6947f383d75b9b1016.tar.gz
Reduce the number of used temporary registers
-rw-r--r--boot/stage20/cl.elna17
1 files changed, 8 insertions, 9 deletions
diff --git a/boot/stage20/cl.elna b/boot/stage20/cl.elna
index d0d3adc..21c7259 100644
--- a/boot/stage20/cl.elna
+++ b/boot/stage20/cl.elna
@@ -1444,8 +1444,7 @@ begin
if instruction^.operands[2].kind = ElnaRtlKind.pseudo then
store_instruction := elna_rtl_instruction_create(ElnaRtlOperator.sw);
- elna_rtl_instruction_set_operand(store_instruction, 1, instruction^.operands[1].kind,
- instruction^.operands[1].value, instruction^.operands[1].length);
+ elna_rtl_instruction_set_operand(store_instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.t0, 0);
elna_rtl_instruction_set_operand(store_instruction, 2, ElnaRtlKind.offset, ElnaRtlRegister.t1, 0);
pseudo_symbol := elna_alloc_variable(instruction^.operands[2].value, instruction^.operands[2].length,
@@ -1472,11 +1471,11 @@ begin
memcpy(new_instruction, instruction, #size(ElnaRtlInstruction));
new_instruction^.next := nil;
- elna_rtl_instruction_set_operand(new_instruction, 2, ElnaRtlKind.offset, ElnaRtlRegister.t1, 0);
+ elna_rtl_instruction_set_operand(new_instruction, 2, ElnaRtlKind.offset, ElnaRtlRegister.t0, 0);
instruction^.operator := ElnaRtlOperator.lw;
- elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.t1, 0);
+ elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.t0, 0);
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.offset, ElnaRtlRegister.sp, pseudo_symbol^.counter);
elna_list_insert(instructions, instruction, new_instruction);
instruction := new_instruction
@@ -1494,12 +1493,12 @@ begin
source_pseudo := instruction^.operands[2].kind = ElnaRtlKind.pseudo;
if destination_pseudo & source_pseudo then
- instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t4, variable_map);
+ instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t0, variable_map);
pseudo_symbol := elna_alloc_variable(instruction^.operands[1].value, instruction^.operands[1].length,
variable_map);
instruction^.operator = ElnaRtlOperator.sw;
- elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.t4, 0);
+ elna_rtl_instruction_set_operand(instruction, 1, ElnaRtlKind.register, ElnaRtlRegister.t0, 0);
elna_rtl_instruction_set_operand(instruction, 2, ElnaRtlKind.offset, ElnaRtlRegister.sp, pseudo_symbol^.counter)
elsif destination_pseudo then
pseudo_symbol := elna_alloc_variable(instruction^.operands[1].value, instruction^.operands[1].length,
@@ -1553,8 +1552,8 @@ var
new_instruction: ^ElnaRtlInstruction;
pseudo_symbol: ^ElnaRtlInfo;
begin
- instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t2, variable_map);
- instruction := elna_alloc_operand(instructions, instruction, 3, ElnaRtlRegister.t3, variable_map);
+ instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t0, variable_map);
+ instruction := elna_alloc_operand(instructions, instruction, 3, ElnaRtlRegister.t1, variable_map);
return elna_alloc_operation_target(instructions, instruction, variable_map)
end;
@@ -1563,7 +1562,7 @@ var
new_instruction: ^ElnaRtlInstruction;
pseudo_symbol: ^ElnaRtlInfo;
begin
- instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t2, variable_map);
+ instruction := elna_alloc_operand(instructions, instruction, 2, ElnaRtlRegister.t0, variable_map);
return elna_alloc_operation_target(instructions, instruction, variable_map)
end;