Improved separation of concerns
This commit is contained in:
20
src/build/z/RegisterNumber.go
Normal file
20
src/build/z/RegisterNumber.go
Normal 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()
|
||||
}
|
Reference in New Issue
Block a user