From 304c7425d22e432b6bba0c2de76f411f1d720335 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Sun, 6 Jan 2019 20:04:51 -0800 Subject: [PATCH] build: add attributes argument to TEXT Brings the TEXT() function signature closer to how the directive works in assembly. Also update almost all examples to use NOSPLIT. Closes #11 --- build/attr.go | 17 +++++++++++++++++ build/global.go | 5 +++-- examples/add/add.s | 4 +++- examples/add/asm.go | 2 +- examples/args/args.s | 38 ++++++++++++++++++++------------------ examples/args/asm.go | 36 ++++++++++++++++++------------------ examples/complex/asm.go | 6 +++--- examples/complex/complex.s | 8 +++++--- examples/data/asm.go | 3 +-- examples/data/data.s | 2 +- examples/dot/asm.go | 2 +- examples/dot/dot.s | 4 +++- examples/fnv1a/asm.go | 2 +- examples/fnv1a/fnv1a.s | 4 +++- examples/geohash/asm.go | 2 +- examples/geohash/geohash.s | 2 +- examples/returns/asm.go | 10 +++++----- examples/returns/returns.s | 10 +++++----- examples/sha1/asm.go | 2 +- examples/stadtx/asm.go | 2 +- examples/stadtx/stadtx.s | 4 +++- examples/sum/asm.go | 2 +- examples/sum/sum.s | 4 +++- tests/cast/asm.go | 2 +- tests/cast/cast.s | 4 +++- 25 files changed, 105 insertions(+), 72 deletions(-) create mode 100644 build/attr.go diff --git a/build/attr.go b/build/attr.go new file mode 100644 index 00000000..56690003 --- /dev/null +++ b/build/attr.go @@ -0,0 +1,17 @@ +package build + +import "github.com/mmcloughlin/avo/attr" + +// TEXT and DATA attribute values included for convenience. +var ( + NOPROF = attr.NOPROF + DUPOK = attr.DUPOK + NOSPLIT = attr.NOSPLIT + RODATA = attr.RODATA + NOPTR = attr.NOPTR + WRAPPER = attr.WRAPPER + NEEDCTXT = attr.NEEDCTXT + TLSBSS = attr.TLSBSS + NOFRAME = attr.NOFRAME + REFLECTMETHOD = attr.REFLECTMETHOD +) diff --git a/build/global.go b/build/global.go index 06f0da40..80885505 100644 --- a/build/global.go +++ b/build/global.go @@ -15,9 +15,10 @@ import ( // ctx provides a global build context. var ctx = NewContext() -// TEXT starts building a new function called name and sets its signature (see SignatureExpr). -func TEXT(name, signature string) { +// TEXT starts building a new function called name, with attributes a, and sets its signature (see SignatureExpr). +func TEXT(name string, a attr.Attribute, signature string) { ctx.Function(name) + ctx.Attributes(a) ctx.SignatureExpr(signature) } diff --git a/examples/add/add.s b/examples/add/add.s index e220a3fe..679dfbf0 100644 --- a/examples/add/add.s +++ b/examples/add/add.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out add.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Add(x uint64, y uint64) uint64 -TEXT ·Add(SB), $0-24 +TEXT ·Add(SB), NOSPLIT, $0-24 MOVQ x(FP), AX MOVQ y+8(FP), CX ADDQ AX, CX diff --git a/examples/add/asm.go b/examples/add/asm.go index 1281eaa4..44c7aa22 100644 --- a/examples/add/asm.go +++ b/examples/add/asm.go @@ -7,7 +7,7 @@ import ( ) func main() { - TEXT("Add", "func(x, y uint64) uint64") + TEXT("Add", NOSPLIT, "func(x, y uint64) uint64") Doc("Add adds x and y.") x := Load(Param("x"), GP64()) y := Load(Param("y"), GP64()) diff --git a/examples/args/args.s b/examples/args/args.s index 59bb1925..cd890aec 100644 --- a/examples/args/args.s +++ b/examples/args/args.s @@ -1,109 +1,111 @@ // Code generated by command: go run asm.go -out args.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Second(x int32, y int32) int32 -TEXT ·Second(SB), $0-12 +TEXT ·Second(SB), NOSPLIT, $0-12 MOVL y+4(FP), AX MOVL AX, ret+8(FP) RET // func StringLen(s string) int -TEXT ·StringLen(SB), $0-24 +TEXT ·StringLen(SB), NOSPLIT, $0-24 MOVQ s_len+8(FP), AX MOVQ AX, ret+16(FP) RET // func SliceLen(s []int) int -TEXT ·SliceLen(SB), $0-32 +TEXT ·SliceLen(SB), NOSPLIT, $0-32 MOVQ s_len+8(FP), AX MOVQ AX, ret+24(FP) RET // func SliceCap(s []int) int -TEXT ·SliceCap(SB), $0-32 +TEXT ·SliceCap(SB), NOSPLIT, $0-32 MOVQ s_cap+16(FP), AX MOVQ AX, ret+24(FP) RET // func ArrayThree(a [7]uint64) uint64 -TEXT ·ArrayThree(SB), $0-64 +TEXT ·ArrayThree(SB), NOSPLIT, $0-64 MOVQ a_3+24(FP), AX MOVQ AX, ret+56(FP) RET // func FieldByte(s Struct) byte -TEXT ·FieldByte(SB), $0-177 +TEXT ·FieldByte(SB), NOSPLIT, $0-177 MOVB s_Byte(FP), AL MOVB AL, ret+176(FP) RET // func FieldInt8(s Struct) int8 -TEXT ·FieldInt8(SB), $0-177 +TEXT ·FieldInt8(SB), NOSPLIT, $0-177 MOVB s_Int8+1(FP), AL MOVB AL, ret+176(FP) RET // func FieldUint16(s Struct) uint16 -TEXT ·FieldUint16(SB), $0-178 +TEXT ·FieldUint16(SB), NOSPLIT, $0-178 MOVW s_Uint16+2(FP), AX MOVW AX, ret+176(FP) RET // func FieldInt32(s Struct) int32 -TEXT ·FieldInt32(SB), $0-180 +TEXT ·FieldInt32(SB), NOSPLIT, $0-180 MOVL s_Int32+4(FP), AX MOVL AX, ret+176(FP) RET // func FieldUint64(s Struct) uint64 -TEXT ·FieldUint64(SB), $0-184 +TEXT ·FieldUint64(SB), NOSPLIT, $0-184 MOVQ s_Uint64+8(FP), AX MOVQ AX, ret+176(FP) RET // func FieldFloat32(s Struct) float32 -TEXT ·FieldFloat32(SB), $0-180 +TEXT ·FieldFloat32(SB), NOSPLIT, $0-180 MOVSS s_Float32+16(FP), X0 MOVSS X0, ret+176(FP) RET // func FieldFloat64(s Struct) float64 -TEXT ·FieldFloat64(SB), $0-184 +TEXT ·FieldFloat64(SB), NOSPLIT, $0-184 MOVSD s_Float64+24(FP), X0 MOVSD X0, ret+176(FP) RET // func FieldStringLen(s Struct) int -TEXT ·FieldStringLen(SB), $0-184 +TEXT ·FieldStringLen(SB), NOSPLIT, $0-184 MOVQ s_String_len+40(FP), AX MOVQ AX, ret+176(FP) RET // func FieldSliceCap(s Struct) int -TEXT ·FieldSliceCap(SB), $0-184 +TEXT ·FieldSliceCap(SB), NOSPLIT, $0-184 MOVQ s_Slice_cap+64(FP), AX MOVQ AX, ret+176(FP) RET // func FieldArrayTwoBTwo(s Struct) byte -TEXT ·FieldArrayTwoBTwo(SB), $0-177 +TEXT ·FieldArrayTwoBTwo(SB), NOSPLIT, $0-177 MOVB s_Array_2_B_2+114(FP), AL MOVB AL, ret+176(FP) RET // func FieldArrayOneC(s Struct) uint16 -TEXT ·FieldArrayOneC(SB), $0-178 +TEXT ·FieldArrayOneC(SB), NOSPLIT, $0-178 MOVW s_Array_1_C+100(FP), AX MOVW AX, ret+176(FP) RET // func FieldComplex64Imag(s Struct) float32 -TEXT ·FieldComplex64Imag(SB), $0-180 +TEXT ·FieldComplex64Imag(SB), NOSPLIT, $0-180 MOVSS s_Complex64_imag+156(FP), X0 MOVSS X0, ret+176(FP) RET // func FieldComplex128Real(s Struct) float64 -TEXT ·FieldComplex128Real(SB), $0-184 +TEXT ·FieldComplex128Real(SB), NOSPLIT, $0-184 MOVSD s_Complex128_real+160(FP), X0 MOVSD X0, ret+176(FP) RET diff --git a/examples/args/asm.go b/examples/args/asm.go index e907d69f..5123f1fc 100644 --- a/examples/args/asm.go +++ b/examples/args/asm.go @@ -9,92 +9,92 @@ import ( func main() { Package("github.com/mmcloughlin/avo/examples/args") - TEXT("Second", "func(x, y int32) int32") + TEXT("Second", NOSPLIT, "func(x, y int32) int32") y := Load(Param("y"), GP32()) Store(y, ReturnIndex(0)) RET() - TEXT("StringLen", "func(s string) int") + TEXT("StringLen", NOSPLIT, "func(s string) int") strlen := Load(Param("s").Len(), GP64()) Store(strlen, ReturnIndex(0)) RET() - TEXT("SliceLen", "func(s []int) int") + TEXT("SliceLen", NOSPLIT, "func(s []int) int") slicelen := Load(Param("s").Len(), GP64()) Store(slicelen, ReturnIndex(0)) RET() - TEXT("SliceCap", "func(s []int) int") + TEXT("SliceCap", NOSPLIT, "func(s []int) int") slicecap := Load(Param("s").Cap(), GP64()) Store(slicecap, ReturnIndex(0)) RET() - TEXT("ArrayThree", "func(a [7]uint64) uint64") + TEXT("ArrayThree", NOSPLIT, "func(a [7]uint64) uint64") a3 := Load(Param("a").Index(3), GP64()) Store(a3, ReturnIndex(0)) RET() - TEXT("FieldByte", "func(s Struct) byte") + TEXT("FieldByte", NOSPLIT, "func(s Struct) byte") b := Load(Param("s").Field("Byte"), GP8()) Store(b, ReturnIndex(0)) RET() - TEXT("FieldInt8", "func(s Struct) int8") + TEXT("FieldInt8", NOSPLIT, "func(s Struct) int8") i8 := Load(Param("s").Field("Int8"), GP8()) Store(i8, ReturnIndex(0)) RET() - TEXT("FieldUint16", "func(s Struct) uint16") + TEXT("FieldUint16", NOSPLIT, "func(s Struct) uint16") u16 := Load(Param("s").Field("Uint16"), GP16()) Store(u16, ReturnIndex(0)) RET() - TEXT("FieldInt32", "func(s Struct) int32") + TEXT("FieldInt32", NOSPLIT, "func(s Struct) int32") i32 := Load(Param("s").Field("Int32"), GP32()) Store(i32, ReturnIndex(0)) RET() - TEXT("FieldUint64", "func(s Struct) uint64") + TEXT("FieldUint64", NOSPLIT, "func(s Struct) uint64") u64 := Load(Param("s").Field("Uint64"), GP64()) Store(u64, ReturnIndex(0)) RET() - TEXT("FieldFloat32", "func(s Struct) float32") + TEXT("FieldFloat32", NOSPLIT, "func(s Struct) float32") f32 := Load(Param("s").Field("Float32"), XMM()) Store(f32, ReturnIndex(0)) RET() - TEXT("FieldFloat64", "func(s Struct) float64") + TEXT("FieldFloat64", NOSPLIT, "func(s Struct) float64") f64 := Load(Param("s").Field("Float64"), XMM()) Store(f64, ReturnIndex(0)) RET() - TEXT("FieldStringLen", "func(s Struct) int") + TEXT("FieldStringLen", NOSPLIT, "func(s Struct) int") l := Load(Param("s").Field("String").Len(), GP64()) Store(l, ReturnIndex(0)) RET() - TEXT("FieldSliceCap", "func(s Struct) int") + TEXT("FieldSliceCap", NOSPLIT, "func(s Struct) int") c := Load(Param("s").Field("Slice").Cap(), GP64()) Store(c, ReturnIndex(0)) RET() - TEXT("FieldArrayTwoBTwo", "func(s Struct) byte") + TEXT("FieldArrayTwoBTwo", NOSPLIT, "func(s Struct) byte") b2 := Load(Param("s").Field("Array").Index(2).Field("B").Index(2), GP8()) Store(b2, ReturnIndex(0)) RET() - TEXT("FieldArrayOneC", "func(s Struct) uint16") + TEXT("FieldArrayOneC", NOSPLIT, "func(s Struct) uint16") c1 := Load(Param("s").Field("Array").Index(1).Field("C"), GP16()) Store(c1, ReturnIndex(0)) RET() - TEXT("FieldComplex64Imag", "func(s Struct) float32") + TEXT("FieldComplex64Imag", NOSPLIT, "func(s Struct) float32") c64i := Load(Param("s").Field("Complex64").Imag(), XMM()) Store(c64i, ReturnIndex(0)) RET() - TEXT("FieldComplex128Real", "func(s Struct) float64") + TEXT("FieldComplex128Real", NOSPLIT, "func(s Struct) float64") c128r := Load(Param("s").Field("Complex128").Real(), XMM()) Store(c128r, ReturnIndex(0)) RET() diff --git a/examples/complex/asm.go b/examples/complex/asm.go index 8114dad1..1b9eecc4 100644 --- a/examples/complex/asm.go +++ b/examples/complex/asm.go @@ -7,19 +7,19 @@ import ( ) func main() { - TEXT("Real", "func(z complex128) float64") + TEXT("Real", NOSPLIT, "func(z complex128) float64") Doc("Real returns the real part of z.") r := Load(Param("z").Real(), XMM()) Store(r, ReturnIndex(0)) RET() - TEXT("Imag", "func(z complex128) float64") + TEXT("Imag", NOSPLIT, "func(z complex128) float64") Doc("Imag returns the imaginary part of z.") i := Load(Param("z").Imag(), XMM()) Store(i, ReturnIndex(0)) RET() - TEXT("Norm", "func(z complex128) float64") + TEXT("Norm", NOSPLIT, "func(z complex128) float64") Doc("Norm returns the complex norm of z.") r = Load(Param("z").Real(), XMM()) i = Load(Param("z").Imag(), XMM()) diff --git a/examples/complex/complex.s b/examples/complex/complex.s index a4462674..aa9e4d68 100644 --- a/examples/complex/complex.s +++ b/examples/complex/complex.s @@ -1,19 +1,21 @@ // Code generated by command: go run asm.go -out complex.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Real(z complex128) float64 -TEXT ·Real(SB), $0-24 +TEXT ·Real(SB), NOSPLIT, $0-24 MOVSD z_real(FP), X0 MOVSD X0, ret+16(FP) RET // func Imag(z complex128) float64 -TEXT ·Imag(SB), $0-24 +TEXT ·Imag(SB), NOSPLIT, $0-24 MOVSD z_imag+8(FP), X0 MOVSD X0, ret+16(FP) RET // func Norm(z complex128) float64 -TEXT ·Norm(SB), $0-24 +TEXT ·Norm(SB), NOSPLIT, $0-24 MOVSD z_real(FP), X0 MOVSD z_imag+8(FP), X1 MULSD X0, X0 diff --git a/examples/data/asm.go b/examples/data/asm.go index 50736fd0..29d703b3 100644 --- a/examples/data/asm.go +++ b/examples/data/asm.go @@ -5,7 +5,6 @@ package main import ( "math" - . "github.com/mmcloughlin/avo/attr" . "github.com/mmcloughlin/avo/build" . "github.com/mmcloughlin/avo/operand" ) @@ -21,7 +20,7 @@ func main() { DATA(38, U8(0x66)) DATA(39, U8(0x77)) - TEXT("DataAt", "func(i int) byte") + TEXT("DataAt", NOSPLIT, "func(i int) byte") Doc("DataAt returns byte i in the 'bytes' global data section.") i := Load(Param("i"), GP64()) ptr := Mem{Base: GP64()} diff --git a/examples/data/data.s b/examples/data/data.s index fb528c1e..c9ce1432 100644 --- a/examples/data/data.s +++ b/examples/data/data.s @@ -13,7 +13,7 @@ DATA bytes<>+39(SB)/1, $0x77 GLOBL bytes<>(SB), RODATA|NOPTR, $40 // func DataAt(i int) byte -TEXT ·DataAt(SB), $0-9 +TEXT ·DataAt(SB), NOSPLIT, $0-9 MOVQ i(FP), AX LEAQ bytes<>(SB), CX MOVB (CX)(AX*1), AL diff --git a/examples/dot/asm.go b/examples/dot/asm.go index 365f3532..62e517ee 100644 --- a/examples/dot/asm.go +++ b/examples/dot/asm.go @@ -11,7 +11,7 @@ import ( var unroll = 6 func main() { - TEXT("Dot", "func(x, y []float32) float32") + TEXT("Dot", NOSPLIT, "func(x, y []float32) float32") x := Mem{Base: Load(Param("x").Base(), GP64())} y := Mem{Base: Load(Param("y").Base(), GP64())} n := Load(Param("x").Len(), GP64()) diff --git a/examples/dot/dot.s b/examples/dot/dot.s index 6297bf9c..609832e9 100644 --- a/examples/dot/dot.s +++ b/examples/dot/dot.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out dot.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Dot(x []float32, y []float32) float32 -TEXT ·Dot(SB), $0-52 +TEXT ·Dot(SB), NOSPLIT, $0-52 MOVQ x_base(FP), AX MOVQ y_base+24(FP), CX MOVQ x_len+8(FP), DX diff --git a/examples/fnv1a/asm.go b/examples/fnv1a/asm.go index fdb10fd1..5c1fb93c 100644 --- a/examples/fnv1a/asm.go +++ b/examples/fnv1a/asm.go @@ -14,7 +14,7 @@ const ( ) func main() { - TEXT("Hash64", "func(data []byte) uint64") + TEXT("Hash64", NOSPLIT, "func(data []byte) uint64") Doc("Hash64 computes the FNV-1a hash of data.") ptr := Load(Param("data").Base(), GP64()) n := Load(Param("data").Len(), GP64()) diff --git a/examples/fnv1a/fnv1a.s b/examples/fnv1a/fnv1a.s index ffa1964e..9df9e01b 100644 --- a/examples/fnv1a/fnv1a.s +++ b/examples/fnv1a/fnv1a.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out fnv1a.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Hash64(data []byte) uint64 -TEXT ·Hash64(SB), $0-32 +TEXT ·Hash64(SB), NOSPLIT, $0-32 MOVQ data_base(FP), CX MOVQ data_len+8(FP), BX MOVQ $0xcbf29ce484222325, AX diff --git a/examples/geohash/asm.go b/examples/geohash/asm.go index d9edc805..4ccd0dd7 100644 --- a/examples/geohash/asm.go +++ b/examples/geohash/asm.go @@ -8,7 +8,7 @@ import ( ) func main() { - TEXT("EncodeInt", "func(lat, lng float64) uint64") + TEXT("EncodeInt", NOSPLIT, "func(lat, lng float64) uint64") Doc("EncodeInt computes the 64-bit integer geohash of (lat, lng).") lat := Load(Param("lat"), XMM()) lng := Load(Param("lng"), XMM()) diff --git a/examples/geohash/geohash.s b/examples/geohash/geohash.s index 494192e4..c724e197 100644 --- a/examples/geohash/geohash.s +++ b/examples/geohash/geohash.s @@ -3,7 +3,7 @@ #include "textflag.h" // func EncodeInt(lat float64, lng float64) uint64 -TEXT ·EncodeInt(SB), $0-24 +TEXT ·EncodeInt(SB), NOSPLIT, $0-24 MOVSD lat(FP), X0 MOVSD lng+8(FP), X1 MULSD reciprocal180<>(SB), X0 diff --git a/examples/returns/asm.go b/examples/returns/asm.go index 8f889d0b..0d635e21 100644 --- a/examples/returns/asm.go +++ b/examples/returns/asm.go @@ -10,7 +10,7 @@ import ( func main() { Package("github.com/mmcloughlin/avo/examples/returns") - TEXT("Interval", "func(start, size uint64) (uint64, uint64)") + TEXT("Interval", NOSPLIT, "func(start, size uint64) (uint64, uint64)") Doc( "Interval returns the (start, end) of an interval with the given start and size.", "Demonstrates multiple unnamed return values.", @@ -23,7 +23,7 @@ func main() { Store(end, ReturnIndex(1)) RET() - TEXT("Butterfly", "func(x0, x1 float64) (y0, y1 float64)") + TEXT("Butterfly", NOSPLIT, "func(x0, x1 float64) (y0, y1 float64)") Doc( "Butterfly performs a 2-dimensional butterfly operation: computes (x0+x1, x0-x1).", "Demonstrates multiple named return values.", @@ -39,7 +39,7 @@ func main() { Store(y1, Return("y1")) RET() - TEXT("Septuple", "func(byte) [7]byte") + TEXT("Septuple", NOSPLIT, "func(byte) [7]byte") Doc( "Septuple returns an array of seven of the given byte.", "Demonstrates returning array values.", @@ -50,7 +50,7 @@ func main() { } RET() - TEXT("CriticalLine", "func(t float64) complex128") + TEXT("CriticalLine", NOSPLIT, "func(t float64) complex128") Doc( "CriticalLine returns the complex value 0.5 + it on Riemann's critical line.", "Demonstrates returning complex values.", @@ -62,7 +62,7 @@ func main() { Store(t, ReturnIndex(0).Imag()) RET() - TEXT("NewStruct", "func(w uint16, p [2]float64, q uint64) Struct") + TEXT("NewStruct", NOSPLIT, "func(w uint16, p [2]float64, q uint64) Struct") Doc( "NewStruct initializes a Struct value.", "Demonstrates returning struct values.", diff --git a/examples/returns/returns.s b/examples/returns/returns.s index fe480554..9c3b6f6d 100644 --- a/examples/returns/returns.s +++ b/examples/returns/returns.s @@ -3,7 +3,7 @@ #include "textflag.h" // func Interval(start uint64, size uint64) (uint64, uint64) -TEXT ·Interval(SB), $0-32 +TEXT ·Interval(SB), NOSPLIT, $0-32 MOVQ start(FP), AX MOVQ size+8(FP), CX ADDQ AX, CX @@ -12,7 +12,7 @@ TEXT ·Interval(SB), $0-32 RET // func Butterfly(x0 float64, x1 float64) (y0 float64, y1 float64) -TEXT ·Butterfly(SB), $0-32 +TEXT ·Butterfly(SB), NOSPLIT, $0-32 MOVSD x0(FP), X0 MOVSD x1+8(FP), X1 MOVSD X0, X2 @@ -24,7 +24,7 @@ TEXT ·Butterfly(SB), $0-32 RET // func Septuple(byte) [7]byte -TEXT ·Septuple(SB), $0-15 +TEXT ·Septuple(SB), NOSPLIT, $0-15 MOVB arg(FP), AL MOVB AL, ret_0+8(FP) MOVB AL, ret_1+9(FP) @@ -36,7 +36,7 @@ TEXT ·Septuple(SB), $0-15 RET // func CriticalLine(t float64) complex128 -TEXT ·CriticalLine(SB), $0-24 +TEXT ·CriticalLine(SB), NOSPLIT, $0-24 MOVSD t(FP), X0 MOVSD half<>(SB), X1 MOVSD X1, ret_real+8(FP) @@ -47,7 +47,7 @@ DATA half<>(SB)/8, $(0.5) GLOBL half<>(SB), RODATA|NOPTR, $8 // func NewStruct(w uint16, p [2]float64, q uint64) Struct -TEXT ·NewStruct(SB), $0-64 +TEXT ·NewStruct(SB), NOSPLIT, $0-64 MOVW w(FP), AX MOVSD p_0+8(FP), X0 MOVSD p_1+16(FP), X1 diff --git a/examples/sha1/asm.go b/examples/sha1/asm.go index 8f37a155..4532c69e 100644 --- a/examples/sha1/asm.go +++ b/examples/sha1/asm.go @@ -9,7 +9,7 @@ import ( ) func main() { - TEXT("block", "func(h *[5]uint32, m []byte)") + TEXT("block", 0, "func(h *[5]uint32, m []byte)") Doc("block SHA-1 hashes the 64-byte message m into the running state h.") h := Mem{Base: Load(Param("h"), GP64())} m := Mem{Base: Load(Param("m").Base(), GP64())} diff --git a/examples/stadtx/asm.go b/examples/stadtx/asm.go index 35bfdabc..696b049c 100644 --- a/examples/stadtx/asm.go +++ b/examples/stadtx/asm.go @@ -38,7 +38,7 @@ func makelabels(name string, n int) []string { func main() { Package("github.com/mmcloughlin/avo/examples/stadtx") - TEXT("Hash", "func(state *State, key []byte) uint64") + TEXT("Hash", NOSPLIT, "func(state *State, key []byte) uint64") Doc("Hash computes the Stadtx hash.") statePtr := Load(Param("state"), GP64()) diff --git a/examples/stadtx/stadtx.s b/examples/stadtx/stadtx.s index 52037062..80ee9e7a 100644 --- a/examples/stadtx/stadtx.s +++ b/examples/stadtx/stadtx.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out stadtx.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Hash(state *State, key []byte) uint64 -TEXT ·Hash(SB), $0-40 +TEXT ·Hash(SB), NOSPLIT, $0-40 MOVQ state(FP), AX MOVQ key_base+8(FP), CX MOVQ key_len+16(FP), DX diff --git a/examples/sum/asm.go b/examples/sum/asm.go index 028119f7..1fd72e0b 100644 --- a/examples/sum/asm.go +++ b/examples/sum/asm.go @@ -8,7 +8,7 @@ import ( ) func main() { - TEXT("Sum", "func(xs []uint64) uint64") + TEXT("Sum", NOSPLIT, "func(xs []uint64) uint64") Doc("Sum returns the sum of the elements in xs.") ptr := Load(Param("xs").Base(), GP64()) n := Load(Param("xs").Len(), GP64()) diff --git a/examples/sum/sum.s b/examples/sum/sum.s index 9862b141..339231a5 100644 --- a/examples/sum/sum.s +++ b/examples/sum/sum.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out sum.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Sum(xs []uint64) uint64 -TEXT ·Sum(SB), $0-32 +TEXT ·Sum(SB), NOSPLIT, $0-32 MOVQ xs_base(FP), AX MOVQ xs_len+8(FP), CX XORQ DX, DX diff --git a/tests/cast/asm.go b/tests/cast/asm.go index e41440c9..6985767d 100644 --- a/tests/cast/asm.go +++ b/tests/cast/asm.go @@ -7,7 +7,7 @@ import ( ) func main() { - TEXT("Split", "func(x uint64) (q uint64, l uint32, w uint16, b uint8)") + TEXT("Split", NOSPLIT, "func(x uint64) (q uint64, l uint32, w uint16, b uint8)") Doc( "Split returns the low 64, 32, 16 and 8 bits of x.", "Tests the As() methods of virtual general-purpose registers.", diff --git a/tests/cast/cast.s b/tests/cast/cast.s index 7fa96e20..7eb51a67 100644 --- a/tests/cast/cast.s +++ b/tests/cast/cast.s @@ -1,7 +1,9 @@ // Code generated by command: go run asm.go -out cast.s -stubs stub.go. DO NOT EDIT. +#include "textflag.h" + // func Split(x uint64) (q uint64, l uint32, w uint16, b uint8) -TEXT ·Split(SB), $0-23 +TEXT ·Split(SB), NOSPLIT, $0-23 MOVQ x(FP), AX MOVQ AX, q+8(FP) MOVL AX, l+16(FP)