In jump-table-like constructs, the natural way of writing the code can sometimes produce redundant jumps or labels. Therefore some basic cleanup steps have been proposed. This diff adds two transforms: 1. Remove unconditional jumps to a label immediately following. 2. Remove labels with no references at all. Fixes #75
16 lines
267 B
Go
16 lines
267 B
Go
package labels
|
|
|
|
import (
|
|
"testing"
|
|
"testing/quick"
|
|
)
|
|
|
|
//go:generate go run asm.go -out labels.s -stubs stub.go
|
|
|
|
func TestLabels(t *testing.T) {
|
|
expect := func() uint64 { return 7 }
|
|
if err := quick.CheckEqual(Labels, expect, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|