This commit is contained in:
nub31
2025-01-27 17:03:53 +01:00
parent 39515e4e32
commit cca7ff5b8e

View File

@@ -90,19 +90,19 @@ public class Generator
strcmp: strcmp:
xor rdx, rdx xor rdx, rdx
strcmp_loop: strcmp_loop:
mov al, [rsi + rdx] mov al, [rsi + rdx]
mov bl, [rdi + rdx] mov bl, [rdi + rdx]
inc rdx inc rdx
cmp al, bl cmp al, bl
jne strcmp_not_equal jne strcmp_not_equal
cmp al, 0 cmp al, 0
je strcmp_equal je strcmp_equal
jmp strcmp_loop jmp strcmp_loop
strcmp_not_equal: strcmp_not_equal:
mov rax, 0 mov rax, 0
ret ret
strcmp_equal: strcmp_equal:
mov rax, 1 mov rax, 1
ret ret
"""); """);
@@ -148,7 +148,7 @@ public class Generator
GenerateBlock(node.Body, func); GenerateBlock(node.Body, func);
_builder.AppendLine($"{func.EndLabel}:"); _builder.AppendLine($"{func.EndLabel}:");
_builder.AppendLine("; Clean up stack frame"); _builder.AppendLine(" ; Clean up stack frame");
_builder.AppendLine(" mov rsp, rbp"); _builder.AppendLine(" mov rsp, rbp");
_builder.AppendLine(" pop rbp"); _builder.AppendLine(" pop rbp");
_builder.AppendLine(" ret"); _builder.AppendLine(" ret");