Reduced usage of temporary registers

This commit is contained in:
Eduard Urbach 2024-07-10 10:48:15 +02:00
parent 3c189a025f
commit 75a8823b13
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 13 additions and 25 deletions

View file

@ -1,8 +1,6 @@
package core
import (
"fmt"
"git.akyoto.dev/cli/q/src/build/ast"
"git.akyoto.dev/cli/q/src/build/config"
"git.akyoto.dev/cli/q/src/build/errors"
@ -43,7 +41,7 @@ func (f *Function) CompileDefinition(node *ast.Define) error {
func (f *Function) AddVariable(variable *Variable) {
if config.Comments {
f.Comment(fmt.Sprintf("%s = %s (%s, %d uses)", variable.Name, variable.Value, variable.Register, variable.Alive))
f.Comment("%s = %s (%s, %d uses)", variable.Name, variable.Value, variable.Register, variable.Alive)
}
f.variables[variable.Name] = variable
@ -60,7 +58,7 @@ func (f *Function) useVariable(variable *Variable) {
if variable.Alive == 0 {
if config.Comments {
f.Comment(fmt.Sprintf("%s died (%s)", variable.Name, variable.Register))
f.Comment("%s died (%s)", variable.Name, variable.Register)
}
f.cpu.Free(variable.Register)