ir

package
v0.0.0-...-8880984 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Kind  ArgKind
	Value int64
}

Arg is an instruction argument (sometimes called operand). Value bits (int64) should be interpreted differently depending on the Kind.

func (Arg) DoubleValue

func (arg Arg) DoubleValue() float64

func (Arg) FloatValue

func (arg Arg) FloatValue() float32

func (Arg) String

func (arg Arg) String() string

func (Arg) SymbolID

func (arg Arg) SymbolID() symbol.ID

type ArgKind

type ArgKind int

ArgKind describes an argument category. Most kinds change how Arg value should be interpreted.

const (
	ArgInvalid ArgKind = iota

	ArgEnv
	ArgBranch
	ArgFlags
	ArgReg
	ArgIntConst
	ArgFloatConst
	ArgDoubleConst
	ArgSymbolID
)

type Class

type Class struct {
	Name string

	Methods []Method

	File *jclass.File
	Out  *vmdat.Class
}

type Inst

type Inst struct {
	Kind  InstKind
	Dst   Arg
	Args  []Arg
	Flags InstFlags
}

Inst is a single IR instruction.

If instruction has explicit output, Dst represents output assignment destination.

func (Inst) String

func (inst Inst) String() string

type InstFlags

type InstFlags uint64

InstFlags is a set of instruction bit fields.

func (InstFlags) IsBlockLead

func (f InstFlags) IsBlockLead() bool

func (InstFlags) IsJumpTarget

func (f InstFlags) IsJumpTarget() bool

func (*InstFlags) SetBlockLead

func (f *InstFlags) SetBlockLead(v bool)

func (*InstFlags) SetJumpTarget

func (f *InstFlags) SetJumpTarget(v bool)

type InstKind

type InstKind int

InstKind describes instruction operation. It can be treated as an "opcode" of IR abstract machine.

const (
	InstInvalid InstKind = iota

	InstIload
	InstLload
	InstAload
	InstRet
	InstIret
	InstLret
	InstAret
	InstCallStatic
	InstCallGo
	InstIcmp
	InstLcmp
	InstJump
	InstJumpEqual
	InstJumpNotEqual
	InstJumpGtEq
	InstJumpGt
	InstJumpLt
	InstJumpLtEq
	InstImul
	InstIdiv
	InstIadd
	InstLadd
	InstFadd
	InstIsub
	InstIneg
	InstLneg
	InstDadd
	InstConvL2I
	InstConvF2I
	InstConvD2I
	InstConvI2L
	InstConvI2B
	InstNewBoolArray
	InstNewCharArray
	InstNewFloatArray
	InstNewDoubleArray
	InstNewByteArray
	InstNewShortArray
	InstNewIntArray
	InstNewLongArray
	InstIntArraySet
	InstIntArrayGet
	InstArrayLen
)

func (InstKind) String

func (i InstKind) String() string

type Method

type Method struct {
	Code        []Inst
	AccessFlags jclass.MethodAccessFlags

	Out *vmdat.Method
}

type Package

type Package struct {
	Classes []Class

	Out *vmdat.Package
}

Jump to

Keyboard shortcuts

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