ir

package
v0.0.0-...-5e90b7b Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(fn *Func) string

Types

type Block

type Block struct {
	Code       []Inst
	NumVarKill uint16
	Label      uint16
	Dirty      bool
}

func (*Block) HasLabel

func (b *Block) HasLabel() bool

func (*Block) LabelID

func (b *Block) LabelID() uint16

type Func

type Func struct {
	Name string

	Code      []Inst
	Blocks    []Block
	NumParams int
	NumLocals int
	NumTemps  int

	StrConstants    []string
	ScalarConstants []uint64

	Debug qruntime.FuncDebugInfo
	Env   *qruntime.Env
}

func (*Func) NewScalarConstant

func (fn *Func) NewScalarConstant(v uint64) int

func (*Func) NumFrameSlots

func (fn *Func) NumFrameSlots() int

func (*Func) SlotIndex

func (fn *Func) SlotIndex(slot Slot) uint8

type Inst

type Inst struct {
	Op     bytecode.Op
	Pseudo PseudoOp
	Arg0   InstArg
	Arg1   InstArg
	Arg2   InstArg
	Arg3   InstArg
}

func (Inst) GetArg

func (inst Inst) GetArg(i int) InstArg

func (Inst) IsEmpty

func (inst Inst) IsEmpty() bool

func (Inst) IsPseudo

func (inst Inst) IsPseudo() bool

func (*Inst) SetArg

func (inst *Inst) SetArg(i int, arg InstArg)

func (*Inst) SetArgSlotKind

func (inst *Inst) SetArgSlotKind(i int, kind SlotKind)

type InstArg

type InstArg uint16

func (InstArg) ToSlot

func (a InstArg) ToSlot() Slot

type PseudoOp

type PseudoOp byte
const (
	OpUnset PseudoOp = iota
	OpLabel
	OpVarKill
)

func (PseudoOp) String

func (i PseudoOp) String() string

type Slot

type Slot struct {
	ID   uint8
	Kind SlotKind
}

func NewCallArgSlot

func NewCallArgSlot(id uint8) Slot

func NewParamSlot

func NewParamSlot(id uint8) Slot

func NewTempSlot

func NewTempSlot(id uint8) Slot

func NewUniqSlot

func NewUniqSlot(id uint8) Slot

func (Slot) IsCallArg

func (s Slot) IsCallArg() bool

func (Slot) IsInvalid

func (s Slot) IsInvalid() bool

func (Slot) IsParam

func (s Slot) IsParam() bool

func (Slot) IsTemp

func (s Slot) IsTemp() bool

func (Slot) IsUniq

func (s Slot) IsUniq() bool

func (Slot) ToInstArg

func (s Slot) ToInstArg() InstArg

type SlotKind

type SlotKind uint8
const (
	SlotInvalid SlotKind = iota
	SlotCallArg
	SlotParam
	SlotTemp
	SlotUniq
	SlotDiscard
)

func (SlotKind) String

func (i SlotKind) String() string

Jump to

Keyboard shortcuts

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