get the basic add example working

This commit is contained in:
Michael McLoughlin
2018-12-08 22:02:02 -08:00
parent 5431f2edef
commit 20525e1437
4 changed files with 63 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import (
"log"
"github.com/mmcloughlin/avo/gotypes"
"github.com/mmcloughlin/avo/pass"
"github.com/mmcloughlin/avo"
"github.com/mmcloughlin/avo/reg"
@@ -84,6 +85,11 @@ func (c *Context) Main(wout, werr io.Writer) int {
return 1
}
if err := pass.Compile.Execute(f); err != nil {
diag.Println(err)
return 1
}
p := avo.NewGoPrinter(wout)
if err := p.Print(f); err != nil {
diag.Println(err)

View File

@@ -6,6 +6,10 @@ import (
"log"
"os"
"github.com/mmcloughlin/avo/gotypes"
"github.com/mmcloughlin/avo/reg"
"github.com/mmcloughlin/avo"
)
@@ -40,3 +44,18 @@ func EOF() {
os.Exit(ctx.Main(w, os.Stderr))
}
func GP8v() reg.Virtual { return ctx.GP8v() }
func GP16v() reg.Virtual { return ctx.GP16v() }
func GP32v() reg.Virtual { return ctx.GP32v() }
func GP64v() reg.Virtual { return ctx.GP64v() }
func Xv() reg.Virtual { return ctx.Xv() }
func Yv() reg.Virtual { return ctx.Yv() }
func Param(name string) gotypes.Component { return ctx.Param(name) }
func ParamIndex(i int) gotypes.Component { return ctx.ParamIndex(i) }
func Return(name string) gotypes.Component { return ctx.Return(name) }
func ReturnIndex(i int) gotypes.Component { return ctx.ReturnIndex(i) }
func Load(src gotypes.Component, dst reg.Register) reg.Register { return ctx.Load(src, dst) }
func Store(src reg.Register, dst gotypes.Component) { ctx.Store(src, dst) }