Improved code generation
This commit is contained in:
@ -25,18 +25,21 @@ func (f *Function) CompileCall(root *expression.Expression) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Push
|
||||
for _, register := range f.cpu.General {
|
||||
if !f.cpu.IsFree(register) {
|
||||
f.assembler.Register(asm.PUSH, register)
|
||||
}
|
||||
}
|
||||
|
||||
// Call
|
||||
if isSyscall {
|
||||
f.assembler.Syscall()
|
||||
} else {
|
||||
f.assembler.Call(funcName)
|
||||
}
|
||||
|
||||
// Pop
|
||||
for i := len(f.cpu.General) - 1; i >= 0; i-- {
|
||||
register := f.cpu.General[i]
|
||||
|
||||
|
Reference in New Issue
Block a user