Reduced usage of temporary registers
This commit is contained in:
parent
3c189a025f
commit
75a8823b13
6 changed files with 13 additions and 25 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue