This commit is contained in:
2026-03-06 20:14:02 +00:00
parent 39eaafea25
commit 33208a2356
146 changed files with 673 additions and 1986 deletions

View File

@@ -8,7 +8,7 @@ import (
"strings"
"text/tabwriter"
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/inst"
)
// Function represents a function that constructs some collection of

View File

@@ -4,7 +4,7 @@ import (
"strings"
"testing"
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/inst"
)
func TestFunctionsDuplicateFormSignatures(t *testing.T) {

View File

@@ -8,7 +8,7 @@ import (
const (
// Package is the avo package import path.
Package = "github.com/mmcloughlin/avo"
Package = "sources.truenas.cloud/code/avo"
// IRPackage is the package that defines intermediate representation types.
IRPackage = "ir"

View File

@@ -4,7 +4,7 @@ import (
"go/token"
"testing"
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/inst"
)
func TestISAsIdentifier(t *testing.T) {

View File

@@ -9,10 +9,10 @@ import (
"os"
"path/filepath"
"github.com/mmcloughlin/avo/internal/gen"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/load"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/gen"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/load"
"sources.truenas.cloud/code/avo/printer"
)
var generators = map[string]gen.Builder{
@@ -34,7 +34,7 @@ var (
bootstrap = flag.Bool("bootstrap", false, "regenerate instruction list from original data")
datadir = flag.String(
"data",
filepath.Join(build.Default.GOPATH, "src/github.com/mmcloughlin/avo/internal/data"),
filepath.Join(build.Default.GOPATH, "src/sources.truenas.cloud/code/avo/internal/data"),
"path to data directory",
)
output = flag.String("output", "", "path to output file (default stdout)")

View File

@@ -17,7 +17,7 @@ import (
"strings"
"text/template"
"github.com/mmcloughlin/avo/tests/thirdparty"
"sources.truenas.cloud/code/avo/tests/thirdparty"
)
func main() {

View File

@@ -2,7 +2,7 @@
<img src="logo.svg" width="40%" border="0" alt="avo" />
<br />
<img src="https://img.shields.io/github/actions/workflow/status/mmcloughlin/avo/ci.yml?style=flat-square" alt="Build Status" />
<a href="https://pkg.go.dev/github.com/mmcloughlin/avo"><img src="https://img.shields.io/badge/doc-reference-007d9b?logo=go&style=flat-square" alt="go.dev" /></a>
<a href="https://sources.truenas.cloud/code"><img src="https://img.shields.io/badge/doc-reference-007d9b?logo=go&style=flat-square" alt="go.dev" /></a>
<a href="https://goreportcard.com/report/github.com/mmcloughlin/avo"><img src="https://goreportcard.com/badge/github.com/mmcloughlin/avo?style=flat-square" alt="Go Report Card" /></a>
</p>

View File

@@ -5,8 +5,8 @@ import (
"sort"
"strings"
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
)
// Enum is a generated enumeration type. This assists with mapping between the

View File

@@ -6,9 +6,9 @@ import (
"strconv"
"strings"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type asmtest struct {

View File

@@ -3,10 +3,10 @@ package gen
import (
"fmt"
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type build struct {

View File

@@ -1,10 +1,10 @@
package gen
import (
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type buildtest struct {

View File

@@ -1,10 +1,10 @@
package gen
import (
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type ctors struct {

View File

@@ -5,10 +5,10 @@ import (
"fmt"
"strings"
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type ctorstest struct {

View File

@@ -3,8 +3,8 @@ package gen
import (
"go/format"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/printer"
)
// Interface of an instruction code generator.

View File

@@ -1,10 +1,10 @@
package gen
import (
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type godata struct {

View File

@@ -5,10 +5,10 @@ import (
"fmt"
"strings"
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type mov struct {

View File

@@ -6,10 +6,10 @@ import (
"strconv"
"strings"
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
"sources.truenas.cloud/code/avo/printer"
)
type optab struct {

View File

@@ -1,9 +1,9 @@
package gen
import (
"github.com/mmcloughlin/avo/internal/api"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/prnt"
"sources.truenas.cloud/code/avo/internal/api"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/prnt"
)
// DeclareTestArguments prints a block of variables declaring a valid operand of

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"testing"
"github.com/mmcloughlin/avo/internal/test"
"sources.truenas.cloud/code/avo/internal/test"
)
func TestClientRepository(t *testing.T) {

View File

@@ -7,10 +7,10 @@ import (
"strings"
"testing"
"github.com/mmcloughlin/avo/internal/gen"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/test"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/gen"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/test"
"sources.truenas.cloud/code/avo/printer"
)
func TestHaveInstructions(t *testing.T) {

View File

@@ -10,17 +10,17 @@ import (
"strconv"
"strings"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/opcodescsv"
"github.com/mmcloughlin/avo/internal/opcodesextra"
"github.com/mmcloughlin/avo/internal/opcodesxml"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/opcodescsv"
"sources.truenas.cloud/code/avo/internal/opcodesextra"
"sources.truenas.cloud/code/avo/internal/opcodesxml"
)
// This file is a mess. Some of this complexity is unavoidable, since the state
// of x86 instruction databases is also a mess, especially when it comes to
// idiosyncrasies of the Go assembler implementation. Some of the complexity is
// probably avoidable by migrating to using Intel XED
// (https://github.com/mmcloughlin/avo/issues/23), but for now this is an unholy
// (https://sources.truenas.cloud/code/avo/issues/23), but for now this is an unholy
// mix of PeachPy's Opcodes database and Go's x86 CSV file.
//
// The goal is simply to keep as much of the uglyness in this file as possible,
@@ -796,7 +796,7 @@ func evexLLsize(f opcodesxml.Form) int {
// version is to encode suffixes, and these are represented by other instruction
// forms.
//
// TODO(mbm): restrict use of vector registers https://github.com/mmcloughlin/avo/issues/146
// TODO(mbm): restrict use of vector registers https://sources.truenas.cloud/code/avo/issues/146
func vexevex(fs []inst.Form) ([]inst.Form, error) {
// Group forms by deduping ID.
byid := map[string][]inst.Form{}

View File

@@ -3,11 +3,11 @@ package load_test
import (
"testing"
"github.com/mmcloughlin/avo/internal/gen"
"github.com/mmcloughlin/avo/internal/inst"
"github.com/mmcloughlin/avo/internal/load"
"github.com/mmcloughlin/avo/internal/test"
"github.com/mmcloughlin/avo/printer"
"sources.truenas.cloud/code/avo/internal/gen"
"sources.truenas.cloud/code/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/load"
"sources.truenas.cloud/code/avo/internal/test"
"sources.truenas.cloud/code/avo/printer"
)
func Load(t *testing.T) []inst.Instruction {

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// bitalg is the "Bit Algorithms" instruction set.
var bitalg = []*inst.Instruction{

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// Reference: https://github.com/golang/go/blob/go1.19.3/src/cmd/internal/obj/x86/avx_optabs.go#L376-L383
//

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// gfni is the "Galois Field New Instructions" instruction set.
var gfni = []*inst.Instruction{

View File

@@ -4,7 +4,7 @@ package opcodesextra
import (
"sort"
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/inst"
)
// sets of extra instructions.

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// MOVLQZX does not appear in either x86 CSV or Opcodes, but does appear in stdlib assembly.
//

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// vaes is the "Vector Advanced Encryption Standard" instruction set.
var vaes = []*inst.Instruction{

View File

@@ -1,7 +1,7 @@
package opcodesextra
import (
"github.com/mmcloughlin/avo/internal/inst"
"sources.truenas.cloud/code/avo/internal/inst"
)
// vbmi2 is the "Vector Bit Manipulation Instructions 2" instruction set.

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// vnni is the "Vector Neural Network Instructions" instruction set.
var vnni = []*inst.Instruction{

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// vpclmulqdq is the "Vector Carry-less Multiplication" instruction set.
var vpclmulqdq = []*inst.Instruction{

View File

@@ -1,6 +1,6 @@
package opcodesextra
import "github.com/mmcloughlin/avo/internal/inst"
import "sources.truenas.cloud/code/avo/internal/inst"
// vpopcntdq is the "Vector Population Count" instruction set.
var vpopcntdq = []*inst.Instruction{

View File

@@ -4,10 +4,10 @@ import (
"runtime"
"testing"
"github.com/mmcloughlin/avo/internal/stack"
"sources.truenas.cloud/code/avo/internal/stack"
)
const pkg = "github.com/mmcloughlin/avo/internal/stack_test"
const pkg = "sources.truenas.cloud/code/avo/internal/stack_test"
func TestFramesFirst(t *testing.T) {
fs := stack.Frames(0, 1)