Improved separation of concerns

This commit is contained in:
2024-07-23 16:41:21 +02:00
parent d6db1b1096
commit 69245caf62
36 changed files with 243 additions and 236 deletions

View File

@ -0,0 +1,20 @@
package z
import (
"git.akyoto.dev/cli/q/src/build/asm"
"git.akyoto.dev/cli/q/src/build/cpu"
)
func (f *Compiler) RegisterNumber(mnemonic asm.Mnemonic, a cpu.Register, b int) {
if f.CurrentScope().IsUsed(a) && isDestructive(mnemonic) {
f.SaveRegister(a)
}
f.Assembler.RegisterNumber(mnemonic, a, b)
if mnemonic == asm.MOVE {
f.CurrentScope().Use(a)
}
f.postInstruction()
}