Moved register state to scopes

This commit is contained in:
Eduard Urbach 2024-07-16 15:30:28 +02:00
parent 3bd5b20af3
commit 545c8dd4f6
Signed by: eduard
GPG key ID: 49226B848C78F6C8
22 changed files with 230 additions and 129 deletions

View file

@ -39,7 +39,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
// Push
for _, register := range f.cpu.General {
if f.cpu.IsUsed(register) {
if f.Scope().IsUsed(register) {
f.Register(asm.PUSH, register)
}
}
@ -55,7 +55,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
for i := len(f.cpu.General) - 1; i >= 0; i-- {
register := f.cpu.General[i]
if f.cpu.IsUsed(register) {
if f.Scope().IsUsed(register) {
f.Register(asm.POP, register)
}
}