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
This commit is contained in:
Michael McLoughlin
2019-01-06 20:04:51 -08:00
parent 76db5bb03f
commit 304c7425d2
25 changed files with 105 additions and 72 deletions

View File

@@ -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())

View File

@@ -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