ir

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrevBuildVal

func PrevBuildVal() interface{}

Types

type Block

type Block struct {
	Op op.BlockOp

	Comment string
	Source  string

	Idom     *Block
	Dominees []*Block
	// contains filtered or unexported fields
}

func (*Block) AddPred

func (blk *Block) AddPred(pred *Block)

func (*Block) AddSucc

func (blk *Block) AddSucc(succ *Block)

func (*Block) Control

func (blk *Block) Control(i int) *Value

func (*Block) FindPathTo

func (blk *Block) FindPathTo(fn func(*Block) bool) []*Block

FindPathTo searches the successor graph for a specific block and returns the path to that block

func (*Block) Func

func (blk *Block) Func() *Func

func (*Block) ID

func (blk *Block) ID() ID

func (*Block) InsertControl

func (blk *Block) InsertControl(i int, val *Value)

func (*Block) InsertCopy

func (blk *Block) InsertCopy(i int, val *Value, r reg.Reg) *Value

func (*Block) InsertInstr

func (blk *Block) InsertInstr(i int, val *Value)

func (*Block) Instr

func (blk *Block) Instr(i int) *Value

func (*Block) IsAfter

func (blk *Block) IsAfter(other *Block) bool

func (*Block) LongString

func (blk *Block) LongString() string

func (*Block) NumControls

func (blk *Block) NumControls() int

func (*Block) NumInstrs

func (blk *Block) NumInstrs() int

func (*Block) NumPreds

func (blk *Block) NumPreds() int

func (*Block) NumSuccs

func (blk *Block) NumSuccs() int

func (*Block) OpString

func (blk *Block) OpString() string

func (*Block) Pred

func (blk *Block) Pred(i int) *Block

func (*Block) RemoveControl

func (blk *Block) RemoveControl(i int)

func (*Block) RemoveInstr

func (blk *Block) RemoveInstr(val *Value) bool

func (*Block) ReplaceControl

func (blk *Block) ReplaceControl(i int, val *Value)

func (*Block) SetControls

func (blk *Block) SetControls(ctrls []*Value)

func (*Block) String

func (blk *Block) String() string

func (*Block) Succ

func (blk *Block) Succ(i int) *Block

func (*Block) SwapInstr

func (blk *Block) SwapInstr(a *Value, b *Value)

func (*Block) VisitSuccessors

func (blk *Block) VisitSuccessors(fn func(*Block) bool)

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func BuildAfter

func BuildAfter(val *Value) Builder

func BuildAt

func BuildAt(blk *Block, index int) Builder

func BuildBefore

func BuildBefore(val *Value) Builder

func BuildReplacement

func BuildReplacement(val *Value) Builder

func (Builder) Op

func (bd Builder) Op(o op.Op, typ types.Type, args ...interface{}) Builder

func (Builder) PrevVal

func (bd Builder) PrevVal() *Value

PrevVal returns the previously inserted value

type Func

type Func struct {
	Name string
	Type *types.Signature

	Pkg *Package

	NumCalls   int
	Referenced bool

	Consts  []*Value
	Params  []*Value
	Globals []*Value

	SpillSlots int
	ArgSlots   int
	LocalSlots int
	// contains filtered or unexported fields
}

func (*Func) BlockForID

func (fn *Func) BlockForID(id ID) *Block

func (*Func) BlockIDCount

func (fn *Func) BlockIDCount() int

func (*Func) Blocks

func (fn *Func) Blocks() []*Block

func (*Func) Const

func (fn *Func) Const(typ types.Type, val constant.Value) *Value

func (*Func) FixedReg

func (fn *Func) FixedReg(reg reg.Reg) *Value

func (*Func) InsertBlock

func (fn *Func) InsertBlock(i int, blk *Block)

func (*Func) InstrIDCount

func (fn *Func) InstrIDCount() int

func (*Func) IntConst

func (fn *Func) IntConst(val int64) *Value

func (*Func) LongString

func (fn *Func) LongString() string

func (*Func) NewBlock

func (fn *Func) NewBlock(blk Block) *Block

func (*Func) NewRegValue

func (fn *Func) NewRegValue(op op.Op, typ types.Type, reg reg.Reg, args ...*Value) *Value

func (*Func) NewValue

func (fn *Func) NewValue(op op.Op, typ types.Type, args ...*Value) *Value

func (*Func) NextBlockID

func (fn *Func) NextBlockID() ID

func (*Func) RemoveBlock

func (fn *Func) RemoveBlock(i int)

func (*Func) String

func (fn *Func) String() string

func (*Func) ValueForID

func (fn *Func) ValueForID(id ID) *Value

type ID

type ID int

type Package

type Package struct {
	Funcs   []*Func
	Globals []*Value

	Strings       map[string]*Value
	NextStringNum int
	// contains filtered or unexported fields
}

func (*Package) AddGlobal

func (pkg *Package) AddGlobal(name string, typ types.Type) *Value

func (*Package) LongString

func (pkg *Package) LongString() string

func (*Package) LookupFunc

func (pkg *Package) LookupFunc(name string) *Func

type Value

type Value struct {
	Reg  reg.Reg
	Op   op.Op
	Type types.Type

	Value constant.Value
	// contains filtered or unexported fields
}

func (*Value) Arg

func (val *Value) Arg(i int) *Value

func (*Value) ArgIndex

func (val *Value) ArgIndex(arg *Value) int

func (*Value) ArgUse

func (val *Value) ArgUse(i int) *Value

func (*Value) Block

func (val *Value) Block() *Block

func (*Value) BlockID

func (val *Value) BlockID() ID

func (*Value) BlockUse

func (val *Value) BlockUse(i int) *Block

func (*Value) FindPathTo

func (val *Value) FindPathTo(fn func(*Value) bool) []*Value

FindPathTo traverses the value graph until a certain value is found and returns the path

func (*Value) FindUsageSuccessorPaths

func (val *Value) FindUsageSuccessorPaths() [][]*Block

FindUsageSuccessorPaths will search the successor block graph for all unique paths to each use of this value. These will be the paths through the CFG where the value is live.

func (*Value) Func

func (val *Value) Func() *Func

func (*Value) ID

func (val *Value) ID() ID

func (*Value) IDString

func (val *Value) IDString() string

func (*Value) Index

func (val *Value) Index() int

func (*Value) InsertArg

func (val *Value) InsertArg(i int, arg *Value)

func (*Value) IsAfter

func (val *Value) IsAfter(other *Value) bool

func (*Value) LongString

func (val *Value) LongString() string

func (*Value) NeedsReg

func (val *Value) NeedsReg() bool

func (*Value) NumArgUses

func (val *Value) NumArgUses() int

func (*Value) NumArgs

func (val *Value) NumArgs() int

func (*Value) NumBlockUses

func (val *Value) NumBlockUses() int

func (*Value) NumUses

func (val *Value) NumUses() int

func (*Value) Remove

func (val *Value) Remove()

func (*Value) RemoveArg

func (val *Value) RemoveArg(i int) *Value

func (*Value) ReplaceArg

func (val *Value) ReplaceArg(i int, arg *Value)

func (*Value) ReplaceOtherUsesWith

func (val *Value) ReplaceOtherUsesWith(other *Value) bool

func (*Value) ReplaceWith

func (val *Value) ReplaceWith(other *Value) bool

func (*Value) ShortString

func (val *Value) ShortString() string

func (*Value) String

func (val *Value) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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