Added basic support for arm64

This commit is contained in:
2025-03-06 13:40:17 +01:00
parent 14abb8202b
commit 2f09b96f34
25 changed files with 270 additions and 33 deletions

View File

@ -1,7 +1,9 @@
package core
import (
"git.urbach.dev/cli/q/src/arm"
"git.urbach.dev/cli/q/src/asm"
"git.urbach.dev/cli/q/src/config"
"git.urbach.dev/cli/q/src/cpu"
"git.urbach.dev/cli/q/src/fs"
"git.urbach.dev/cli/q/src/register"
@ -11,6 +13,15 @@ import (
// NewFunction creates a new function.
func NewFunction(pkg string, name string, file *fs.File) *Function {
var cpu *cpu.CPU
switch config.TargetArch {
case config.ARM:
cpu = &arm.CPU
case config.X86:
cpu = &x86.CPU
}
return &Function{
Package: pkg,
Name: name,
@ -23,14 +34,7 @@ func NewFunction(pkg string, name string, file *fs.File) *Function {
Stack: scope.Stack{
Scopes: []*scope.Scope{{}},
},
CPU: cpu.CPU{
General: x86.GeneralRegisters,
Input: x86.InputRegisters,
Output: x86.OutputRegisters,
SyscallInput: x86.SyscallInputRegisters,
SyscallOutput: x86.SyscallOutputRegisters,
NumRegisters: 16,
},
CPU: cpu,
},
}
}