Moved register state to scopes
This commit is contained in:
parent
3bd5b20af3
commit
545c8dd4f6
22 changed files with 230 additions and 129 deletions
|
@ -39,7 +39,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
|
||||
// Push
|
||||
for _, register := range f.cpu.General {
|
||||
if f.cpu.IsUsed(register) {
|
||||
if f.Scope().IsUsed(register) {
|
||||
f.Register(asm.PUSH, register)
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
|||
for i := len(f.cpu.General) - 1; i >= 0; i-- {
|
||||
register := f.cpu.General[i]
|
||||
|
||||
if f.cpu.IsUsed(register) {
|
||||
if f.Scope().IsUsed(register) {
|
||||
f.Register(asm.POP, register)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue