examples/geohash: first version
Adds helper for constants as DATA sections.
This commit is contained in:
@@ -58,3 +58,5 @@ func Load(src gotypes.Component, dst reg.Register) reg.Register { return ctx.Loa
|
||||
func Store(src reg.Register, dst gotypes.Component) { ctx.Store(src, dst) }
|
||||
|
||||
func AllocLocal(size int) operand.Mem { return ctx.AllocLocal(size) }
|
||||
|
||||
func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
"github.com/mmcloughlin/avo/reg"
|
||||
|
||||
"github.com/mmcloughlin/avo/gotypes"
|
||||
@@ -42,3 +43,9 @@ func (c *Context) Store(src reg.Register, dst gotypes.Component) {
|
||||
}
|
||||
c.mov(src, b.Addr, int(src.Bytes()), int(gotypes.Sizes.Sizeof(b.Type)), b.Type)
|
||||
}
|
||||
|
||||
func (c *Context) ConstData(name string, v operand.Constant) operand.Mem {
|
||||
g := c.StaticGlobal(name)
|
||||
c.AppendDatum(v)
|
||||
return g
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user