Improved separation of concerns

This commit is contained in:
Eduard Urbach 2024-07-23 16:41:21 +02:00
parent dc5456b820
commit abba962455
Signed by: eduard
GPG key ID: 49226B848C78F6C8
36 changed files with 243 additions and 236 deletions

View file

@ -3,7 +3,6 @@ package core
import (
"git.akyoto.dev/cli/q/src/build/asm"
"git.akyoto.dev/cli/q/src/build/ast"
"git.akyoto.dev/cli/q/src/build/config"
"git.akyoto.dev/cli/q/src/build/cpu"
"git.akyoto.dev/cli/q/src/build/errors"
"git.akyoto.dev/cli/q/src/build/expression"
@ -18,8 +17,8 @@ func (f *Function) ExpressionToRegister(node *expression.Expression, register cp
if ast.IsFunctionCall(node) {
err := f.CompileCall(node)
if register != f.cpu.Output[0] {
f.RegisterRegister(asm.MOVE, register, f.cpu.Output[0])
if register != f.CPU.Output[0] {
f.RegisterRegister(asm.MOVE, register, f.CPU.Output[0])
}
return err
@ -34,11 +33,7 @@ func (f *Function) ExpressionToRegister(node *expression.Expression, register cp
final := register
if f.UsesRegister(right, register) {
register = f.CurrentScope().MustFindFree(f.cpu.General)
if config.Comments {
f.Comment("temporary register %s", register)
}
register = f.CurrentScope().MustFindFree(f.CPU.General)
}
f.CurrentScope().Reserve(register)