Added CPU type

This commit is contained in:
2024-06-21 22:16:42 +02:00
parent 1058970be3
commit 4faa1641c6
10 changed files with 92 additions and 28 deletions

View File

@ -4,8 +4,8 @@ import (
"fmt"
"strconv"
"git.akyoto.dev/cli/q/src/build/arch/x64"
"git.akyoto.dev/cli/q/src/build/asm"
"git.akyoto.dev/cli/q/src/build/cpu"
"git.akyoto.dev/cli/q/src/build/expression"
"git.akyoto.dev/cli/q/src/build/fs"
"git.akyoto.dev/cli/q/src/build/token"
@ -21,6 +21,7 @@ type Function struct {
Body token.List
Variables map[string]*Variable
Assembler asm.Assembler
CPU cpu.CPU
Error error
}
@ -169,12 +170,12 @@ func (f *Function) CompileFunctionCall(expr *expression.Expression) error {
}
n, _ := strconv.Atoi(variable.Value.Token.Text())
f.Assembler.MoveRegisterNumber(x64.SyscallArgs[i], uint64(n))
f.Assembler.MoveRegisterNumber(f.CPU.Syscall[i], uint64(n))
case token.Number:
value := parameter.Token.Text()
n, _ := strconv.Atoi(value)
f.Assembler.MoveRegisterNumber(x64.SyscallArgs[i], uint64(n))
f.Assembler.MoveRegisterNumber(f.CPU.Syscall[i], uint64(n))
default:
panic("Unknown expression")