forked from toolshed/abra
chore: go mod vendor / tidy
This commit is contained in:
18
vendor/github.com/mmcloughlin/avo/build/attr.go
generated
vendored
Normal file
18
vendor/github.com/mmcloughlin/avo/build/attr.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
package build
|
||||
|
||||
import "github.com/mmcloughlin/avo/attr"
|
||||
|
||||
// TEXT and DATA attribute values included for convenience.
|
||||
const (
|
||||
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
|
||||
TOPFRAME = attr.TOPFRAME
|
||||
)
|
171
vendor/github.com/mmcloughlin/avo/build/cli.go
generated
vendored
Normal file
171
vendor/github.com/mmcloughlin/avo/build/cli.go
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
|
||||
"github.com/mmcloughlin/avo/pass"
|
||||
"github.com/mmcloughlin/avo/printer"
|
||||
)
|
||||
|
||||
// Config contains options for an avo main function.
|
||||
type Config struct {
|
||||
ErrOut io.Writer
|
||||
MaxErrors int // max errors to report; 0 means unlimited
|
||||
CPUProfile io.WriteCloser
|
||||
Passes []pass.Interface
|
||||
}
|
||||
|
||||
// Main is the standard main function for an avo program. This extracts the
|
||||
// result from the build Context (logging and exiting on error), and performs
|
||||
// configured passes.
|
||||
func Main(cfg *Config, context *Context) int {
|
||||
diag := log.New(cfg.ErrOut, "", 0)
|
||||
|
||||
if cfg.CPUProfile != nil {
|
||||
defer cfg.CPUProfile.Close()
|
||||
if err := pprof.StartCPUProfile(cfg.CPUProfile); err != nil {
|
||||
diag.Println("could not start CPU profile: ", err)
|
||||
return 1
|
||||
}
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
||||
f, err := context.Result()
|
||||
if err != nil {
|
||||
LogError(diag, err, cfg.MaxErrors)
|
||||
return 1
|
||||
}
|
||||
|
||||
p := pass.Concat(cfg.Passes...)
|
||||
if err := p.Execute(f); err != nil {
|
||||
diag.Println(err)
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// Flags represents CLI flags for an avo program.
|
||||
type Flags struct {
|
||||
errout *outputValue
|
||||
allerrors bool
|
||||
cpuprof *outputValue
|
||||
pkg string
|
||||
printers []*printerValue
|
||||
}
|
||||
|
||||
// NewFlags initializes avo flags for the given FlagSet.
|
||||
func NewFlags(fs *flag.FlagSet) *Flags {
|
||||
f := &Flags{}
|
||||
|
||||
f.errout = newOutputValue(os.Stderr)
|
||||
fs.Var(f.errout, "log", "diagnostics output")
|
||||
|
||||
fs.BoolVar(&f.allerrors, "e", false, "no limit on number of errors reported")
|
||||
|
||||
f.cpuprof = newOutputValue(nil)
|
||||
fs.Var(f.cpuprof, "cpuprofile", "write cpu profile to `file`")
|
||||
|
||||
fs.StringVar(&f.pkg, "pkg", "", "package name (defaults to current directory name)")
|
||||
|
||||
goasm := newPrinterValue(printer.NewGoAsm, os.Stdout)
|
||||
fs.Var(goasm, "out", "assembly output")
|
||||
f.printers = append(f.printers, goasm)
|
||||
|
||||
stubs := newPrinterValue(printer.NewStubs, nil)
|
||||
fs.Var(stubs, "stubs", "go stub file")
|
||||
f.printers = append(f.printers, stubs)
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
// Config builds a configuration object based on flag values.
|
||||
func (f *Flags) Config() *Config {
|
||||
pc := printer.NewGoRunConfig()
|
||||
if f.pkg != "" {
|
||||
pc.Pkg = f.pkg
|
||||
}
|
||||
passes := []pass.Interface{pass.Compile}
|
||||
for _, pv := range f.printers {
|
||||
p := pv.Build(pc)
|
||||
if p != nil {
|
||||
passes = append(passes, p)
|
||||
}
|
||||
}
|
||||
|
||||
cfg := &Config{
|
||||
ErrOut: f.errout.w,
|
||||
MaxErrors: 10,
|
||||
CPUProfile: f.cpuprof.w,
|
||||
Passes: passes,
|
||||
}
|
||||
|
||||
if f.allerrors {
|
||||
cfg.MaxErrors = 0
|
||||
}
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
type outputValue struct {
|
||||
w io.WriteCloser
|
||||
filename string
|
||||
}
|
||||
|
||||
func newOutputValue(dflt io.WriteCloser) *outputValue {
|
||||
return &outputValue{w: dflt}
|
||||
}
|
||||
|
||||
func (o *outputValue) String() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.filename
|
||||
}
|
||||
|
||||
func (o *outputValue) Set(s string) error {
|
||||
o.filename = s
|
||||
if s == "-" {
|
||||
o.w = nopwritecloser{os.Stdout}
|
||||
return nil
|
||||
}
|
||||
f, err := os.Create(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.w = f
|
||||
return nil
|
||||
}
|
||||
|
||||
type printerValue struct {
|
||||
*outputValue
|
||||
Builder printer.Builder
|
||||
}
|
||||
|
||||
func newPrinterValue(b printer.Builder, dflt io.WriteCloser) *printerValue {
|
||||
return &printerValue{
|
||||
outputValue: newOutputValue(dflt),
|
||||
Builder: b,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *printerValue) Build(cfg printer.Config) pass.Interface {
|
||||
if p.outputValue.w == nil {
|
||||
return nil
|
||||
}
|
||||
return &pass.Output{
|
||||
Writer: p.outputValue.w,
|
||||
Printer: p.Builder(cfg),
|
||||
}
|
||||
}
|
||||
|
||||
// nopwritecloser wraps a Writer and provides a null implementation of Close().
|
||||
type nopwritecloser struct {
|
||||
io.Writer
|
||||
}
|
||||
|
||||
func (nopwritecloser) Close() error { return nil }
|
224
vendor/github.com/mmcloughlin/avo/build/context.go
generated
vendored
Normal file
224
vendor/github.com/mmcloughlin/avo/build/context.go
generated
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go/types"
|
||||
|
||||
"golang.org/x/tools/go/packages"
|
||||
|
||||
"github.com/mmcloughlin/avo/attr"
|
||||
"github.com/mmcloughlin/avo/buildtags"
|
||||
"github.com/mmcloughlin/avo/gotypes"
|
||||
"github.com/mmcloughlin/avo/ir"
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
"github.com/mmcloughlin/avo/reg"
|
||||
)
|
||||
|
||||
//go:generate avogen -output zinstructions.go build
|
||||
//go:generate avogen -output zinstructions_test.go buildtest
|
||||
|
||||
// Context maintains state for incrementally building an avo File.
|
||||
type Context struct {
|
||||
pkg *packages.Package
|
||||
file *ir.File
|
||||
function *ir.Function
|
||||
global *ir.Global
|
||||
errs ErrorList
|
||||
reg.Collection
|
||||
}
|
||||
|
||||
// NewContext initializes an empty build Context.
|
||||
func NewContext() *Context {
|
||||
return &Context{
|
||||
file: ir.NewFile(),
|
||||
Collection: *reg.NewCollection(),
|
||||
}
|
||||
}
|
||||
|
||||
// Package sets the package the generated file will belong to. Required to be able to reference types in the package.
|
||||
func (c *Context) Package(path string) {
|
||||
cfg := &packages.Config{
|
||||
Mode: packages.NeedTypes | packages.NeedDeps | packages.NeedImports,
|
||||
}
|
||||
pkgs, err := packages.Load(cfg, path)
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
pkg := pkgs[0]
|
||||
if len(pkg.Errors) > 0 {
|
||||
for _, err := range pkg.Errors {
|
||||
c.adderror(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
c.pkg = pkg
|
||||
}
|
||||
|
||||
// Constraints sets build constraints for the file.
|
||||
func (c *Context) Constraints(t buildtags.ConstraintsConvertable) {
|
||||
cs := t.ToConstraints()
|
||||
if err := cs.Validate(); err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
c.file.Constraints = cs
|
||||
}
|
||||
|
||||
// Constraint appends a constraint to the file's build constraints.
|
||||
func (c *Context) Constraint(t buildtags.ConstraintConvertable) {
|
||||
c.Constraints(append(c.file.Constraints, t.ToConstraint()))
|
||||
}
|
||||
|
||||
// ConstraintExpr appends a constraint to the file's build constraints. The
|
||||
// constraint to add is parsed from the given expression. The expression should
|
||||
// look the same as the content following "// +build " in regular build
|
||||
// constraint comments.
|
||||
func (c *Context) ConstraintExpr(expr string) {
|
||||
constraint, err := buildtags.ParseConstraint(expr)
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
c.Constraint(constraint)
|
||||
}
|
||||
|
||||
// Function starts building a new function with the given name.
|
||||
func (c *Context) Function(name string) {
|
||||
c.function = ir.NewFunction(name)
|
||||
c.file.AddSection(c.function)
|
||||
}
|
||||
|
||||
// Doc sets documentation comment lines for the currently active function.
|
||||
func (c *Context) Doc(lines ...string) {
|
||||
c.activefunc().Doc = lines
|
||||
}
|
||||
|
||||
// Pragma adds a compiler directive to the currently active function.
|
||||
func (c *Context) Pragma(directive string, args ...string) {
|
||||
c.activefunc().AddPragma(directive, args...)
|
||||
}
|
||||
|
||||
// Attributes sets function attributes for the currently active function.
|
||||
func (c *Context) Attributes(a attr.Attribute) {
|
||||
c.activefunc().Attributes = a
|
||||
}
|
||||
|
||||
// Signature sets the signature for the currently active function.
|
||||
func (c *Context) Signature(s *gotypes.Signature) {
|
||||
c.activefunc().SetSignature(s)
|
||||
}
|
||||
|
||||
// SignatureExpr parses the signature expression and sets it as the active function's signature.
|
||||
func (c *Context) SignatureExpr(expr string) {
|
||||
s, err := gotypes.ParseSignatureInPackage(c.types(), expr)
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
c.Signature(s)
|
||||
}
|
||||
|
||||
// Implement starts building a function of the given name, whose type is
|
||||
// specified by a stub in the containing package.
|
||||
func (c *Context) Implement(name string) {
|
||||
pkg := c.types()
|
||||
if pkg == nil {
|
||||
c.adderrormessage("no package specified")
|
||||
return
|
||||
}
|
||||
s, err := gotypes.LookupSignature(pkg, name)
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
c.Function(name)
|
||||
c.Signature(s)
|
||||
}
|
||||
|
||||
func (c *Context) types() *types.Package {
|
||||
if c.pkg == nil {
|
||||
return nil
|
||||
}
|
||||
return c.pkg.Types
|
||||
}
|
||||
|
||||
// AllocLocal allocates size bytes in the stack of the currently active function.
|
||||
// Returns a reference to the base pointer for the newly allocated region.
|
||||
func (c *Context) AllocLocal(size int) operand.Mem {
|
||||
return c.activefunc().AllocLocal(size)
|
||||
}
|
||||
|
||||
// Instruction adds an instruction to the active function.
|
||||
func (c *Context) Instruction(i *ir.Instruction) {
|
||||
c.activefunc().AddInstruction(i)
|
||||
}
|
||||
|
||||
// Label adds a label to the active function.
|
||||
func (c *Context) Label(name string) {
|
||||
c.activefunc().AddLabel(ir.Label(name))
|
||||
}
|
||||
|
||||
// Comment adds comment lines to the active function.
|
||||
func (c *Context) Comment(lines ...string) {
|
||||
c.activefunc().AddComment(lines...)
|
||||
}
|
||||
|
||||
// Commentf adds a formtted comment line.
|
||||
func (c *Context) Commentf(format string, a ...any) {
|
||||
c.Comment(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func (c *Context) activefunc() *ir.Function {
|
||||
if c.function == nil {
|
||||
c.adderrormessage("no active function")
|
||||
return ir.NewFunction("")
|
||||
}
|
||||
return c.function
|
||||
}
|
||||
|
||||
// StaticGlobal adds a new static data section to the file and returns a pointer to it.
|
||||
func (c *Context) StaticGlobal(name string) operand.Mem {
|
||||
c.global = ir.NewStaticGlobal(name)
|
||||
c.file.AddSection(c.global)
|
||||
return c.global.Base()
|
||||
}
|
||||
|
||||
// DataAttributes sets the attributes on the current active global data section.
|
||||
func (c *Context) DataAttributes(a attr.Attribute) {
|
||||
c.activeglobal().Attributes = a
|
||||
}
|
||||
|
||||
// AddDatum adds constant v at offset to the current active global data section.
|
||||
func (c *Context) AddDatum(offset int, v operand.Constant) {
|
||||
if err := c.activeglobal().AddDatum(ir.NewDatum(offset, v)); err != nil {
|
||||
c.adderror(err)
|
||||
}
|
||||
}
|
||||
|
||||
// AppendDatum appends a constant to the current active global data section.
|
||||
func (c *Context) AppendDatum(v operand.Constant) {
|
||||
c.activeglobal().Append(v)
|
||||
}
|
||||
|
||||
func (c *Context) activeglobal() *ir.Global {
|
||||
if c.global == nil {
|
||||
c.adderrormessage("no active global")
|
||||
return ir.NewStaticGlobal("")
|
||||
}
|
||||
return c.global
|
||||
}
|
||||
|
||||
func (c *Context) adderror(err error) {
|
||||
c.errs.addext(err)
|
||||
}
|
||||
|
||||
func (c *Context) adderrormessage(msg string) {
|
||||
c.adderror(errors.New(msg))
|
||||
}
|
||||
|
||||
// Result returns the built file and any accumulated errors.
|
||||
func (c *Context) Result() (*ir.File, error) {
|
||||
return c.file, c.errs.Err()
|
||||
}
|
2
vendor/github.com/mmcloughlin/avo/build/doc.go
generated
vendored
Normal file
2
vendor/github.com/mmcloughlin/avo/build/doc.go
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// Package build provides an assembly-like interface for incremental building of avo Files.
|
||||
package build
|
91
vendor/github.com/mmcloughlin/avo/build/error.go
generated
vendored
Normal file
91
vendor/github.com/mmcloughlin/avo/build/error.go
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/mmcloughlin/avo/internal/stack"
|
||||
"github.com/mmcloughlin/avo/src"
|
||||
)
|
||||
|
||||
// Error represents an error during building, optionally tagged with the position at which it happened.
|
||||
type Error struct {
|
||||
Position src.Position
|
||||
Err error
|
||||
}
|
||||
|
||||
// exterr constructs an Error with position derived from the first frame in the
|
||||
// call stack outside this package.
|
||||
func exterr(err error) Error {
|
||||
e := Error{Err: err}
|
||||
if f := stack.ExternalCaller(); f != nil {
|
||||
e.Position = src.FramePosition(*f).Relwd()
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
msg := e.Err.Error()
|
||||
if e.Position.IsValid() {
|
||||
return e.Position.String() + ": " + msg
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
// ErrorList is a collection of errors for a source file.
|
||||
type ErrorList []Error
|
||||
|
||||
// Add appends an error to the list.
|
||||
func (e *ErrorList) Add(err Error) {
|
||||
*e = append(*e, err)
|
||||
}
|
||||
|
||||
// AddAt appends an error at position p.
|
||||
func (e *ErrorList) AddAt(p src.Position, err error) {
|
||||
e.Add(Error{p, err})
|
||||
}
|
||||
|
||||
// addext appends an error to the list, tagged with the first external position
|
||||
// outside this package.
|
||||
func (e *ErrorList) addext(err error) {
|
||||
e.Add(exterr(err))
|
||||
}
|
||||
|
||||
// Err returns an error equivalent to this error list.
|
||||
// If the list is empty, Err returns nil.
|
||||
func (e ErrorList) Err() error {
|
||||
if len(e) == 0 {
|
||||
return nil
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e ErrorList) Error() string {
|
||||
switch len(e) {
|
||||
case 0:
|
||||
return "no errors"
|
||||
case 1:
|
||||
return e[0].Error()
|
||||
}
|
||||
return fmt.Sprintf("%s (and %d more errors)", e[0], len(e)-1)
|
||||
}
|
||||
|
||||
// LogError logs a list of errors, one error per line, if the err parameter is
|
||||
// an ErrorList. Otherwise it just logs the err string. Reports at most max
|
||||
// errors, or unlimited if max is 0.
|
||||
func LogError(l *log.Logger, err error, max int) {
|
||||
var list ErrorList
|
||||
if errors.As(err, &list) {
|
||||
for i, e := range list {
|
||||
if max > 0 && i == max {
|
||||
l.Print("too many errors")
|
||||
return
|
||||
}
|
||||
l.Printf("%s\n", e)
|
||||
}
|
||||
} else if err != nil {
|
||||
l.Printf("%s\n", err)
|
||||
}
|
||||
}
|
163
vendor/github.com/mmcloughlin/avo/build/global.go
generated
vendored
Normal file
163
vendor/github.com/mmcloughlin/avo/build/global.go
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"github.com/mmcloughlin/avo/attr"
|
||||
"github.com/mmcloughlin/avo/buildtags"
|
||||
"github.com/mmcloughlin/avo/gotypes"
|
||||
"github.com/mmcloughlin/avo/ir"
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
"github.com/mmcloughlin/avo/reg"
|
||||
)
|
||||
|
||||
// ctx provides a global build context.
|
||||
var ctx = NewContext()
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// GLOBL declares a new static global data section with the given attributes.
|
||||
func GLOBL(name string, a attr.Attribute) operand.Mem {
|
||||
// TODO(mbm): should this be static?
|
||||
g := ctx.StaticGlobal(name)
|
||||
ctx.DataAttributes(a)
|
||||
return g
|
||||
}
|
||||
|
||||
// DATA adds a data value to the active data section.
|
||||
func DATA(offset int, v operand.Constant) {
|
||||
ctx.AddDatum(offset, v)
|
||||
}
|
||||
|
||||
var flags = NewFlags(flag.CommandLine)
|
||||
|
||||
// Generate builds and compiles the avo file built with the global context. This
|
||||
// should be the final line of any avo program. Configuration is determined from command-line flags.
|
||||
func Generate() {
|
||||
if !flag.Parsed() {
|
||||
flag.Parse()
|
||||
}
|
||||
cfg := flags.Config()
|
||||
|
||||
status := Main(cfg, ctx)
|
||||
|
||||
// To record coverage of integration tests we wrap main() functions in a test
|
||||
// functions. In this case we need the main function to terminate, therefore we
|
||||
// only exit for failure status codes.
|
||||
if status != 0 {
|
||||
os.Exit(status)
|
||||
}
|
||||
}
|
||||
|
||||
// Package sets the package the generated file will belong to. Required to be able to reference types in the package.
|
||||
func Package(path string) { ctx.Package(path) }
|
||||
|
||||
// Constraints sets build constraints for the file.
|
||||
func Constraints(t buildtags.ConstraintsConvertable) { ctx.Constraints(t) }
|
||||
|
||||
// Constraint appends a constraint to the file's build constraints.
|
||||
func Constraint(t buildtags.ConstraintConvertable) { ctx.Constraint(t) }
|
||||
|
||||
// ConstraintExpr appends a constraint to the file's build constraints. The
|
||||
// constraint to add is parsed from the given expression. The expression should
|
||||
// look the same as the content following "// +build " in regular build
|
||||
// constraint comments.
|
||||
func ConstraintExpr(expr string) { ctx.ConstraintExpr(expr) }
|
||||
|
||||
// GP8L allocates and returns a general-purpose 8-bit register (low byte).
|
||||
func GP8L() reg.GPVirtual { return ctx.GP8L() }
|
||||
|
||||
// GP8H allocates and returns a general-purpose 8-bit register (high byte).
|
||||
func GP8H() reg.GPVirtual { return ctx.GP8H() }
|
||||
|
||||
// GP8 allocates and returns a general-purpose 8-bit register (low byte).
|
||||
func GP8() reg.GPVirtual { return ctx.GP8() }
|
||||
|
||||
// GP16 allocates and returns a general-purpose 16-bit register.
|
||||
func GP16() reg.GPVirtual { return ctx.GP16() }
|
||||
|
||||
// GP32 allocates and returns a general-purpose 32-bit register.
|
||||
func GP32() reg.GPVirtual { return ctx.GP32() }
|
||||
|
||||
// GP64 allocates and returns a general-purpose 64-bit register.
|
||||
func GP64() reg.GPVirtual { return ctx.GP64() }
|
||||
|
||||
// XMM allocates and returns a 128-bit vector register.
|
||||
func XMM() reg.VecVirtual { return ctx.XMM() }
|
||||
|
||||
// YMM allocates and returns a 256-bit vector register.
|
||||
func YMM() reg.VecVirtual { return ctx.YMM() }
|
||||
|
||||
// ZMM allocates and returns a 512-bit vector register.
|
||||
func ZMM() reg.VecVirtual { return ctx.ZMM() }
|
||||
|
||||
// K allocates and returns an opmask register.
|
||||
func K() reg.OpmaskVirtual { return ctx.K() }
|
||||
|
||||
// Param returns a the named argument of the active function.
|
||||
func Param(name string) gotypes.Component { return ctx.Param(name) }
|
||||
|
||||
// ParamIndex returns the ith argument of the active function.
|
||||
func ParamIndex(i int) gotypes.Component { return ctx.ParamIndex(i) }
|
||||
|
||||
// Return returns a the named return value of the active function.
|
||||
func Return(name string) gotypes.Component { return ctx.Return(name) }
|
||||
|
||||
// ReturnIndex returns the ith argument of the active function.
|
||||
func ReturnIndex(i int) gotypes.Component { return ctx.ReturnIndex(i) }
|
||||
|
||||
// Load the function argument src into register dst. Returns the destination
|
||||
// register. This is syntactic sugar: it will attempt to select the right MOV
|
||||
// instruction based on the types involved.
|
||||
func Load(src gotypes.Component, dst reg.Register) reg.Register { return ctx.Load(src, dst) }
|
||||
|
||||
// Store register src into return value dst. This is syntactic sugar: it will
|
||||
// attempt to select the right MOV instruction based on the types involved.
|
||||
func Store(src reg.Register, dst gotypes.Component) { ctx.Store(src, dst) }
|
||||
|
||||
// Dereference loads a pointer and returns its element type.
|
||||
func Dereference(ptr gotypes.Component) gotypes.Component { return ctx.Dereference(ptr) }
|
||||
|
||||
// Function starts building a new function with the given name.
|
||||
func Function(name string) { ctx.Function(name) }
|
||||
|
||||
// Doc sets documentation comment lines for the currently active function.
|
||||
func Doc(lines ...string) { ctx.Doc(lines...) }
|
||||
|
||||
// Pragma adds a compiler directive to the currently active function.
|
||||
func Pragma(directive string, args ...string) { ctx.Pragma(directive, args...) }
|
||||
|
||||
// Attributes sets function attributes for the currently active function.
|
||||
func Attributes(a attr.Attribute) { ctx.Attributes(a) }
|
||||
|
||||
// SignatureExpr parses the signature expression and sets it as the active function's signature.
|
||||
func SignatureExpr(expr string) { ctx.SignatureExpr(expr) }
|
||||
|
||||
// Implement starts building a function of the given name, whose type is
|
||||
// specified by a stub in the containing package.
|
||||
func Implement(name string) { ctx.Implement(name) }
|
||||
|
||||
// AllocLocal allocates size bytes in the stack of the currently active function.
|
||||
// Returns a reference to the base pointer for the newly allocated region.
|
||||
func AllocLocal(size int) operand.Mem { return ctx.AllocLocal(size) }
|
||||
|
||||
// Label adds a label to the active function.
|
||||
func Label(name string) { ctx.Label(name) }
|
||||
|
||||
// Comment adds comment lines to the active function.
|
||||
func Comment(lines ...string) { ctx.Comment(lines...) }
|
||||
|
||||
// Commentf adds a formtted comment line.
|
||||
func Commentf(format string, a ...any) { ctx.Commentf(format, a...) }
|
||||
|
||||
// ConstData builds a static data section containing just the given constant.
|
||||
func ConstData(name string, v operand.Constant) operand.Mem { return ctx.ConstData(name, v) }
|
||||
|
||||
// Instruction adds an instruction to the active function.
|
||||
func Instruction(i *ir.Instruction) { ctx.Instruction(i) }
|
69
vendor/github.com/mmcloughlin/avo/build/pseudo.go
generated
vendored
Normal file
69
vendor/github.com/mmcloughlin/avo/build/pseudo.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"github.com/mmcloughlin/avo/attr"
|
||||
"github.com/mmcloughlin/avo/gotypes"
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
"github.com/mmcloughlin/avo/reg"
|
||||
)
|
||||
|
||||
//go:generate avogen -output zmov.go mov
|
||||
|
||||
// Param returns a the named argument of the active function.
|
||||
func (c *Context) Param(name string) gotypes.Component {
|
||||
return c.activefunc().Signature.Params().Lookup(name)
|
||||
}
|
||||
|
||||
// ParamIndex returns the ith argument of the active function.
|
||||
func (c *Context) ParamIndex(i int) gotypes.Component {
|
||||
return c.activefunc().Signature.Params().At(i)
|
||||
}
|
||||
|
||||
// Return returns a the named return value of the active function.
|
||||
func (c *Context) Return(name string) gotypes.Component {
|
||||
return c.activefunc().Signature.Results().Lookup(name)
|
||||
}
|
||||
|
||||
// ReturnIndex returns the ith argument of the active function.
|
||||
func (c *Context) ReturnIndex(i int) gotypes.Component {
|
||||
return c.activefunc().Signature.Results().At(i)
|
||||
}
|
||||
|
||||
// Load the function argument src into register dst. Returns the destination
|
||||
// register. This is syntactic sugar: it will attempt to select the right MOV
|
||||
// instruction based on the types involved.
|
||||
func (c *Context) Load(src gotypes.Component, dst reg.Register) reg.Register {
|
||||
b, err := src.Resolve()
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return dst
|
||||
}
|
||||
c.mov(b.Addr, dst, int(gotypes.Sizes.Sizeof(b.Type)), int(dst.Size()), b.Type)
|
||||
return dst
|
||||
}
|
||||
|
||||
// Store register src into return value dst. This is syntactic sugar: it will
|
||||
// attempt to select the right MOV instruction based on the types involved.
|
||||
func (c *Context) Store(src reg.Register, dst gotypes.Component) {
|
||||
b, err := dst.Resolve()
|
||||
if err != nil {
|
||||
c.adderror(err)
|
||||
return
|
||||
}
|
||||
c.mov(src, b.Addr, int(src.Size()), int(gotypes.Sizes.Sizeof(b.Type)), b.Type)
|
||||
}
|
||||
|
||||
// Dereference loads a pointer and returns its element type.
|
||||
func (c *Context) Dereference(ptr gotypes.Component) gotypes.Component {
|
||||
r := c.GP64()
|
||||
c.Load(ptr, r)
|
||||
return ptr.Dereference(r)
|
||||
}
|
||||
|
||||
// ConstData builds a static data section containing just the given constant.
|
||||
func (c *Context) ConstData(name string, v operand.Constant) operand.Mem {
|
||||
g := c.StaticGlobal(name)
|
||||
c.DataAttributes(attr.RODATA | attr.NOPTR)
|
||||
c.AppendDatum(v)
|
||||
return g
|
||||
}
|
86852
vendor/github.com/mmcloughlin/avo/build/zinstructions.go
generated
vendored
Normal file
86852
vendor/github.com/mmcloughlin/avo/build/zinstructions.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
294
vendor/github.com/mmcloughlin/avo/build/zmov.go
generated
vendored
Normal file
294
vendor/github.com/mmcloughlin/avo/build/zmov.go
generated
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
// Code generated by command: avogen -output zmov.go mov. DO NOT EDIT.
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
"go/types"
|
||||
|
||||
"github.com/mmcloughlin/avo/operand"
|
||||
)
|
||||
|
||||
func (c *Context) mov(a, b operand.Op, an, bn int, t *types.Basic) {
|
||||
switch {
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVB(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 1 && operand.IsM8(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVB(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVB(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVB(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVB(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVD(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 4 && operand.IsM32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVD(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVD(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVD(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVD(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVQ(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsM64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVQ(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVQ(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVQ(a, b)
|
||||
case an == 8 && operand.IsR64(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVQ(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVW(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 2 && operand.IsM16(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVW(a, b)
|
||||
case an == 8 && operand.IsK(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVW(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVW(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 8 && operand.IsK(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.KMOVW(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 1 && operand.IsR8(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVB(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 1 && operand.IsM8(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVB(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 1 && operand.IsR8(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVB(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBLSX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBLSX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBLZX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBLZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBLZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 4 && operand.IsR32(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBLZX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBQSX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBQSX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBQZX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBQZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBQZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 8 && operand.IsR64(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBQZX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBWSX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVBWSX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBWZX(a, b)
|
||||
case an == 1 && operand.IsM8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBWZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVBWZX(a, b)
|
||||
case an == 1 && operand.IsR8(a) && bn == 2 && operand.IsR16(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVBWZX(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVL(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 4 && operand.IsM32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVL(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVL(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVLQSX(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVLQSX(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVLQZX(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 8 && operand.IsR64(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVLQZX(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVOU(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVOU(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVOU(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsR64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsM32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsM64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsR64(a) && bn == 8 && operand.IsM64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsR64(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVQ(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSD(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsM64(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSD(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSD(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSS(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsM32(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSS(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.MOVSS(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVW(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 2 && operand.IsM16(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVW(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 2 && operand.IsR16(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.MOVW(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVWLSX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVWLSX(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVWLZX(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVWLZX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVWLZX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 4 && operand.IsR32(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVWLZX(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVWQSX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == types.IsInteger:
|
||||
c.MOVWQSX(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVWQZX(a, b)
|
||||
case an == 2 && operand.IsM16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVWQZX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsUnsigned)) == (types.IsInteger|types.IsUnsigned):
|
||||
c.MOVWQZX(a, b)
|
||||
case an == 2 && operand.IsR16(a) && bn == 8 && operand.IsR64(b) && (t.Info()&types.IsBoolean) != 0:
|
||||
c.MOVWQZX(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVD(a, b)
|
||||
case an == 4 && operand.IsR32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVD(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsM32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVD(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsR32(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVD(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 32 && operand.IsM256(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsM256(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 32 && operand.IsM256(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsM256(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 64 && operand.IsM512(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsM512(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU16(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 32 && operand.IsM256(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsM256(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 64 && operand.IsM512(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsM512(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU32(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 32 && operand.IsM256(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsM256(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 64 && operand.IsM512(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsM512(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU64(a, b)
|
||||
case an == 16 && operand.IsM128(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 32 && operand.IsM256(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsM128(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsM256(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 32 && operand.IsYMM(a) && bn == 32 && operand.IsYMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 64 && operand.IsM512(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsM512(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 64 && operand.IsZMM(a) && bn == 64 && operand.IsZMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVDQU8(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVQ(a, b)
|
||||
case an == 8 && operand.IsR64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsM64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsR64(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVQ(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&(types.IsInteger|types.IsBoolean)) != 0:
|
||||
c.VMOVQ(a, b)
|
||||
case an == 8 && operand.IsM64(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.VMOVSD(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 8 && operand.IsM64(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.VMOVSD(a, b)
|
||||
case an == 4 && operand.IsM32(a) && bn == 16 && operand.IsXMM(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.VMOVSS(a, b)
|
||||
case an == 16 && operand.IsXMM(a) && bn == 4 && operand.IsM32(b) && (t.Info()&types.IsFloat) != 0:
|
||||
c.VMOVSS(a, b)
|
||||
default:
|
||||
c.adderrormessage("could not deduce mov instruction")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user