Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2021-2024 ChilliBits. All rights reserved. | ||
2 | |||
3 | #include "IRGenerator.h" | ||
4 | |||
5 | #include <driver/Driver.h> | ||
6 | |||
7 | namespace spice::compiler { | ||
8 | |||
9 | 1 | const char *IRGenerator::getSysCallAsmString() const { | |
10 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | if (cliOptions.targetArch == "x86_64" || cliOptions.targetArch == "amd64") |
11 | return "movq $0, %rax\n" | ||
12 | "movq $1, %rdi\n" | ||
13 | "movq $2, %rsi\n" | ||
14 | "movq $3, %rdx\n" | ||
15 | "movq $4, %r10\n" | ||
16 | "movq $5, %r8\n" | ||
17 | "movq $6, %r9\n" | ||
18 | 1 | "syscall\n"; | |
19 | |||
20 | ✗ | if (cliOptions.targetArch == "x86" || cliOptions.targetArch == "i386") // ToDo: Test this on an actual 32 bit x86 CPU | |
21 | return "movq $0, %eax\n" | ||
22 | "movq $1, %ebx\n" | ||
23 | "movq $2, %ecx\n" | ||
24 | "movq $3, %edx\n" | ||
25 | "movq $4, %esi\n" | ||
26 | "movq $5, %edi\n" | ||
27 | "movq $6, %ebp\n" | ||
28 | ✗ | "syscall\n"; | |
29 | |||
30 | ✗ | if (cliOptions.targetArch == "aarch64" || cliOptions.targetArch == "arm64") // ToDo: Test this on an actual AArch64 CPU | |
31 | return "movq $0, %rax\n" | ||
32 | "movq $1, %rdi\n" | ||
33 | "movq $2, %rsi\n" | ||
34 | "movq $3, %rdx\n" | ||
35 | "movq $4, %r10\n" | ||
36 | "movq $5, %r8\n" | ||
37 | "movq $6, %r9\n" | ||
38 | ✗ | "syscall\n"; | |
39 | |||
40 | − | assert_fail("Unsupported target for inline assembly"); // LCOV_EXCL_LINE | |
41 | return nullptr; // LCOV_EXCL_LINE | ||
42 | } | ||
43 | |||
44 | 1 | const char *IRGenerator::getSysCallConstraintString() const { | |
45 |
2/6✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1 | if (cliOptions.targetArch == "x86_64" || cliOptions.targetArch == "amd64") |
46 | 1 | return "r,r,r,r,r,r,r,~{rax},~{rdi},~{rsi},~{rdx},~{r10},~{r8},~{r9},~{dirflag},~{fpsr},~{flags}"; | |
47 | ✗ | if (cliOptions.targetArch == "x86" || cliOptions.targetArch == "i386") | |
48 | ✗ | return "r,r,r,r,r,r,r,~{eax},~{ebx},~{ecx},~{edx},~{esi},~{edi},~{ebp},~{dirflag},~{fpsr},~{flags}"; | |
49 | ✗ | if (cliOptions.targetArch == "aarch64" || cliOptions.targetArch == "arm64") | |
50 | ✗ | return "r,r,r,r,r,r,r,~{x8},~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{dirflag},~{fpsr},~{flags}"; | |
51 | − | assert_fail("Unsupported target for inline assembly"); // LCOV_EXCL_LINE | |
52 | return nullptr; // LCOV_EXCL_LINE | ||
53 | } | ||
54 | |||
55 | } // namespace spice::compiler | ||
56 |