api

package
v0.0.0-...-81a76c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package api determines the API of avo instruction constructors.

Index

Constants

View Source
const (
	// Package is the avo package import path.
	Package = "catinello.eu/x/avo"

	// IRPackage is the package that defines intermediate representation types.
	IRPackage = "ir"

	// OperandPackage is the package for operand types.
	OperandPackage = "operand"

	// OperandType is the type used for operands.
	OperandType = OperandPackage + ".Op"

	// RegisterPackage is the name of the package containing register types.
	RegisterPackage = "reg"

	// RegisterType is the type used for registers.
	RegisterType = RegisterPackage + ".Register"
)

Variables

This section is empty.

Functions

func CheckerName

func CheckerName(t string) string

CheckerName returns the name of the function that checks an operand of type t.

func ISAsIdentifier

func ISAsIdentifier(isas []string) string

ISAsIdentifier returns a string representation of an ISA list that suitable for use in a Go identifier.

func ImplicitRegister

func ImplicitRegister(r string) string

ImplicitRegister returns avo syntax for the given implicit register type (from Opcodes XML).

func ImplicitRegisterIdentifier

func ImplicitRegisterIdentifier(r string) string

ImplicitRegisterIdentifier maps an implicit register name to a string suitable for a related Go identifier.

func ImportPath

func ImportPath(pkg string) string

ImportPath returns the full import path for an avo subpackage.

func OperandTypeIdentifier

func OperandTypeIdentifier(t string) string

OperandTypeIdentifier maps an operand type to a string suitable for a related Go identifier.

func SortFunctions

func SortFunctions(fns []*Function)

SortFunctions sorts a list of functions by name.

func SuffixesClassIdentifier

func SuffixesClassIdentifier(c string) string

SuffixesClassIdentifier returns a string representation of a suffix class that's suitable for use in a Go identifier.

Types

type Function

type Function struct {
	Instruction inst.Instruction
	Suffixes    inst.Suffixes
	inst.Forms
}

Function represents a function that constructs some collection of instruction forms.

func InstructionFunctions

func InstructionFunctions(i inst.Instruction) []*Function

InstructionFunctions builds the list of all functions for a given instruction.

func InstructionsFunctions

func InstructionsFunctions(is []inst.Instruction) []*Function

InstructionsFunctions builds all functions for a list of instructions.

func (*Function) Doc

func (f *Function) Doc() []string

Doc returns the function document comment as a list of lines.

func (*Function) HasSuffix

func (f *Function) HasSuffix(suffix inst.Suffix) bool

HasSuffix reports whether the function has the provided suffix.

func (*Function) Name

func (f *Function) Name() string

Name returns the function name.

func (*Function) Opcode

func (f *Function) Opcode() string

Opcode returns the full Go opcode of the instruction built by this function. Includes any suffixes.

func (*Function) Signature

func (f *Function) Signature() Signature

Signature of the function. Derived from the instruction forms generated by this function.

func (*Function) Summary

func (f *Function) Summary() string

Summary returns a summary of the instruction this function constructs.

type Signature

type Signature interface {
	ParameterList() string
	Arguments() string
	ParameterName(int) string
	ParameterSlice() string
	Length() string
}

Signature provides access to details about the signature of an instruction function.

func ArgsList

func ArgsList(args []string) Signature

ArgsList builds a signature for a function with the named parameters.

func Niladic

func Niladic() Signature

Niladic is the signature for a function with no arguments.

func Variadic

func Variadic(name string) Signature

Variadic is the signature for a variadic function with the named argument slice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL