asm

package
v0.0.0-...-45c0841 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code struct {
	Type CodeType

	Instruction lvm2.InstructionType
	Operands    []Operand

	Label string
	Data  []byte
}

func DATA

func DATA(b []byte) Code

func INST

func INST(t lvm2.InstructionType, ops ...Operand) Code

func LABEL

func LABEL(l string) Code

func (Code) String

func (v Code) String() string

type CodeType

type CodeType byte
const (
	CODE_INST CodeType = iota
	CODE_DATA
	CODE_LABEL
)

type Encoder

type Encoder struct {
	Dst []byte
	PC  uint64

	Labels map[string]uint64
}

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) Bytes

func (e *Encoder) Bytes() []byte

func (*Encoder) Encode

func (e *Encoder) Encode(c Code) uint64

type Operand

type Operand struct {
	Type        OperandType
	Value       uint64
	Value_Label string
}

func OPCONST

func OPCONST(v uint64) Operand

func OPLABEL

func OPLABEL(l string) Operand

func OPREG

func OPREG(r uint64) Operand

func (Operand) String

func (v Operand) String() string

type OperandType

type OperandType byte
const (
	OperandType_None OperandType = iota
	OperandType_RegisterValue
	OperandType_ConstantValue
	OperandType_Label
)

Jump to

Keyboard shortcuts

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