Implemented a basic optimization
This commit is contained in:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user