Improved code generation
This commit is contained in:
parent
6e22febc01
commit
3c189a025f
23 changed files with 201 additions and 95 deletions
|
@ -10,8 +10,8 @@ import (
|
|||
// CompileLoop compiles a loop instruction.
|
||||
func (f *Function) CompileLoop(loop *ast.Loop) error {
|
||||
label := fmt.Sprintf("%s_loop_%d", f.Name, f.count.loop)
|
||||
f.assembler.Label(asm.LABEL, label)
|
||||
defer f.assembler.Jump(label)
|
||||
f.AddLabel(label)
|
||||
defer f.Jump(asm.JUMP, label)
|
||||
f.count.loop++
|
||||
return f.CompileAST(loop.Body)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue