Implemented data labels

This commit is contained in:
2024-07-13 00:13:13 +02:00
parent 7b18056006
commit 9df899cb52
18 changed files with 428 additions and 327 deletions

View File

@ -53,6 +53,20 @@ func (f *Function) RegisterNumber(mnemonic asm.Mnemonic, a cpu.Register, b int)
f.postInstruction()
}
func (f *Function) RegisterLabel(mnemonic asm.Mnemonic, register cpu.Register, label string) {
if f.cpu.IsUsed(register) && isDestructive(mnemonic) {
f.SaveRegister(register)
}
f.assembler.RegisterLabel(mnemonic, register, label)
if mnemonic == asm.MOVE {
f.cpu.Use(register)
}
f.postInstruction()
}
func (f *Function) RegisterRegister(mnemonic asm.Mnemonic, a cpu.Register, b cpu.Register) {
if mnemonic == asm.MOVE && a == b {
return