build: support comments in functions (#41)
This commit is contained in:
26
tests/fmt/asm.go
Normal file
26
tests/fmt/asm.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
. "github.com/mmcloughlin/avo/build"
|
||||
. "github.com/mmcloughlin/avo/reg"
|
||||
)
|
||||
|
||||
func main() {
|
||||
TEXT("Formatting", NOSPLIT, "func()")
|
||||
Doc("Formatting contains various cases to test the formatter.")
|
||||
|
||||
ADDQ(R8, R8)
|
||||
Comment("One comment line between instructions.")
|
||||
ADDQ(R8, R8)
|
||||
|
||||
Comment("Comment before label.")
|
||||
Label("label")
|
||||
Comment("Comment after label.")
|
||||
ADDQ(R8, R8)
|
||||
|
||||
RET()
|
||||
|
||||
Generate()
|
||||
}
|
||||
16
tests/fmt/fmt.s
Normal file
16
tests/fmt/fmt.s
Normal file
@@ -0,0 +1,16 @@
|
||||
// Code generated by command: go run asm.go -out fmt.s -stubs stub.go. DO NOT EDIT.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func Formatting()
|
||||
TEXT ·Formatting(SB), NOSPLIT, $0
|
||||
ADDQ R8, R8
|
||||
|
||||
// One comment line between instructions.
|
||||
ADDQ R8, R8
|
||||
|
||||
// Comment before label.
|
||||
label:
|
||||
// Comment after label.
|
||||
ADDQ R8, R8
|
||||
RET
|
||||
4
tests/fmt/gen.go
Normal file
4
tests/fmt/gen.go
Normal file
@@ -0,0 +1,4 @@
|
||||
// Package fmt tests assembly printer formatting.
|
||||
package fmt
|
||||
|
||||
//go:generate go run asm.go -out fmt.s -stubs stub.go
|
||||
6
tests/fmt/stub.go
Normal file
6
tests/fmt/stub.go
Normal file
@@ -0,0 +1,6 @@
|
||||
// Code generated by command: go run asm.go -out fmt.s -stubs stub.go. DO NOT EDIT.
|
||||
|
||||
package fmt
|
||||
|
||||
// Formatting contains various cases to test the formatter.
|
||||
func Formatting()
|
||||
Reference in New Issue
Block a user