Implemented a basic optimization

This commit is contained in:
2024-07-09 11:43:33 +02:00
parent 4a7bb9500a
commit 59d6653eba
8 changed files with 48 additions and 14 deletions

View File

@ -21,10 +21,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return errors.New(&errors.UnknownIdentifier{Name: name}, f.File, t.Position)
}
if register != variable.Register {
f.assembler.RegisterRegister(asm.MOVE, register, variable.Register)
}
f.assembler.RegisterRegister(asm.MOVE, register, variable.Register)
f.useVariable(variable)
return nil