backend

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package backend must be free of Wasm-specific concept. In other words, this package must not import internal/wasm package.

Index

Constants

View Source
const (
	// ABIArgKindReg represents an argument passed in a register.
	ABIArgKindReg = iota
	// ABIArgKindStack represents an argument passed in the stack.
	ABIArgKindStack
)

Variables

This section is empty.

Functions

func ABIInfoFromUint64 added in v1.7.0

func ABIInfoFromUint64(info uint64) (argIntRealRegs, argFloatRealRegs, retIntRealRegs, retFloatRealRegs byte, stackSlotSize uint32)

func GoFunctionCallRequiredStackSize added in v1.7.0

func GoFunctionCallRequiredStackSize(sig *ssa.Signature, argBegin int) (ret, retUnaligned int64)

GoFunctionCallRequiredStackSize returns the size of the stack required for the Go function call. argBegin is the index of the first argument in the signature which is not either execution context or module context.

Types

type ABIArg

type ABIArg struct {
	// Index is the index of the argument.
	Index int
	// Kind is the kind of the argument.
	Kind ABIArgKind
	// Reg is valid if Kind == ABIArgKindReg.
	// This VReg must be based on RealReg.
	Reg regalloc.VReg
	// Offset is valid if Kind == ABIArgKindStack.
	// This is the offset from the beginning of either arg or ret stack slot.
	Offset int64
	// Type is the type of the argument.
	Type ssa.Type
}

ABIArg represents either argument or return value's location.

func (*ABIArg) String

func (a *ABIArg) String() string

String implements fmt.Stringer.

type ABIArgKind

type ABIArgKind byte

ABIArgKind is the kind of ABI argument.

func (ABIArgKind) String

func (a ABIArgKind) String() string

String implements fmt.Stringer.

type Compiler

type Compiler interface {
	// SSABuilder returns the ssa.Builder used by this compiler.
	SSABuilder() ssa.Builder

	// Compile executes the following steps:
	// 	1. Lower()
	// 	2. RegAlloc()
	// 	3. Finalize()
	// 	4. Encode()
	//
	// Each step can be called individually for testing purpose, therefore they are exposed in this interface too.
	//
	// The returned byte slices are the machine code and the relocation information for the machine code.
	// The caller is responsible for copying them immediately since the compiler may reuse the buffer.
	Compile(ctx context.Context) (_ []byte, _ []RelocationInfo, _ error)

	// Lower lowers the given ssa.Instruction to the machine-specific instructions.
	Lower()

	// RegAlloc performs the register allocation after Lower is called.
	RegAlloc()

	// Finalize performs the finalization of the compilation, including machine code emission.
	// This must be called after RegAlloc.
	Finalize(ctx context.Context) error

	// Buf returns the buffer of the encoded machine code. This is only used for testing purpose.
	Buf() []byte

	BufPtr() *[]byte

	// Format returns the debug string of the current state of the compiler.
	Format() string

	// Init initializes the internal state of the compiler for the next compilation.
	Init()

	// AllocateVReg allocates a new virtual register of the given type.
	AllocateVReg(typ ssa.Type) regalloc.VReg

	// ValueDefinition returns the definition of the given value.
	ValueDefinition(ssa.Value) *SSAValueDefinition

	// VRegOf returns the virtual register of the given ssa.Value.
	VRegOf(value ssa.Value) regalloc.VReg

	// TypeOf returns the ssa.Type of the given virtual register.
	TypeOf(regalloc.VReg) ssa.Type

	// MatchInstr returns true if the given definition is from an instruction with the given opcode, the current group ID,
	// and a refcount of 1. That means, the instruction can be merged/swapped within the current instruction group.
	MatchInstr(def *SSAValueDefinition, opcode ssa.Opcode) bool

	// MatchInstrOneOf is the same as MatchInstr but for multiple opcodes. If it matches one of ssa.Opcode,
	// this returns the opcode. Otherwise, this returns ssa.OpcodeInvalid.
	//
	// Note: caller should be careful to avoid excessive allocation on opcodes slice.
	MatchInstrOneOf(def *SSAValueDefinition, opcodes []ssa.Opcode) ssa.Opcode

	// AddRelocationInfo appends the relocation information for the function reference at the current buffer offset.
	AddRelocationInfo(funcRef ssa.FuncRef)

	// AddSourceOffsetInfo appends the source offset information for the given offset.
	AddSourceOffsetInfo(executableOffset int64, sourceOffset ssa.SourceOffset)

	// SourceOffsetInfo returns the source offset information for the current buffer offset.
	SourceOffsetInfo() []SourceOffsetInfo

	// EmitByte appends a byte to the buffer. Used during the code emission.
	EmitByte(b byte)

	// Emit4Bytes appends 4 bytes to the buffer. Used during the code emission.
	Emit4Bytes(b uint32)

	// Emit8Bytes appends 8 bytes to the buffer. Used during the code emission.
	Emit8Bytes(b uint64)

	// GetFunctionABI returns the ABI information for the given signature.
	GetFunctionABI(sig *ssa.Signature) *FunctionABI
}

Compiler is the backend of wazevo which takes ssa.Builder and Machine, use the information there to emit the final machine code.

func NewCompiler

func NewCompiler(ctx context.Context, mach Machine, builder ssa.Builder) Compiler

NewCompiler returns a new Compiler that can generate a machine code.

type ExecutableContext added in v1.7.0

type ExecutableContext interface {
	// StartLoweringFunction is called when the lowering of the given function is started.
	// maximumBlockID is the maximum value of ssa.BasicBlockID existing in the function.
	StartLoweringFunction(maximumBlockID ssa.BasicBlockID)

	// LinkAdjacentBlocks is called after finished lowering all blocks in order to create one single instruction list.
	LinkAdjacentBlocks(prev, next ssa.BasicBlock)

	// StartBlock is called when the compilation of the given block is started.
	// The order of this being called is the reverse post order of the ssa.BasicBlock(s) as we iterate with
	// ssa.Builder BlockIteratorReversePostOrderBegin and BlockIteratorReversePostOrderEnd.
	StartBlock(ssa.BasicBlock)

	// EndBlock is called when the compilation of the current block is finished.
	EndBlock()

	// FlushPendingInstructions flushes the pending instructions to the buffer.
	// This will be called after the lowering of each SSA Instruction.
	FlushPendingInstructions()
}

type ExecutableContextT added in v1.7.0

type ExecutableContextT[Instr any] struct {
	CurrentSSABlk ssa.BasicBlock

	// InstrPool is the InstructionPool of instructions.
	InstructionPool wazevoapi.Pool[Instr]

	// RootInstr is the root instruction of the executable.
	RootInstr *Instr

	NextLabel Label
	// LabelPositions maps a label to the instructions of the region which the label represents.
	LabelPositions     map[Label]*LabelPosition[Instr]
	OrderedBlockLabels []*LabelPosition[Instr]

	// PerBlockHead and PerBlockEnd are the head and tail of the instruction list per currently-compiled ssa.BasicBlock.
	PerBlockHead, PerBlockEnd *Instr
	// PendingInstructions are the instructions which are not yet emitted into the instruction list.
	PendingInstructions []*Instr

	// SsaBlockIDToLabels maps an SSA block ID to the label.
	SsaBlockIDToLabels []Label
	// contains filtered or unexported fields
}

func NewExecutableContextT added in v1.7.0

func NewExecutableContextT[Instr any](
	resetInstruction func(*Instr),
	setNext func(*Instr, *Instr),
	setPrev func(*Instr, *Instr),
	asNop func(*Instr),
) *ExecutableContextT[Instr]

func (*ExecutableContextT[T]) AllocateLabel added in v1.7.0

func (e *ExecutableContextT[T]) AllocateLabel() Label

AllocateLabel allocates an unused label.

func (*ExecutableContextT[T]) AllocateLabelPosition added in v1.7.0

func (e *ExecutableContextT[T]) AllocateLabelPosition(la Label) *LabelPosition[T]

func (*ExecutableContextT[T]) EndBlock added in v1.7.0

func (e *ExecutableContextT[T]) EndBlock()

EndBlock implements ExecutableContext.

func (*ExecutableContextT[T]) FlushPendingInstructions added in v1.7.0

func (e *ExecutableContextT[T]) FlushPendingInstructions()

FlushPendingInstructions implements ExecutableContext.

func (*ExecutableContextT[T]) GetOrAllocateSSABlockLabel added in v1.7.0

func (e *ExecutableContextT[T]) GetOrAllocateSSABlockLabel(blk ssa.BasicBlock) Label

func (*ExecutableContextT[T]) LinkAdjacentBlocks added in v1.7.0

func (e *ExecutableContextT[T]) LinkAdjacentBlocks(prev, next ssa.BasicBlock)

LinkAdjacentBlocks implements backend.Machine.

func (*ExecutableContextT[T]) Reset added in v1.7.0

func (e *ExecutableContextT[T]) Reset()

func (*ExecutableContextT[Instr]) StartBlock added in v1.7.0

func (e *ExecutableContextT[Instr]) StartBlock(blk ssa.BasicBlock)

func (*ExecutableContextT[Instr]) StartLoweringFunction added in v1.7.0

func (e *ExecutableContextT[Instr]) StartLoweringFunction(max ssa.BasicBlockID)

StartLoweringFunction implements ExecutableContext.

type FunctionABI

type FunctionABI struct {
	Initialized bool

	Args, Rets                 []ABIArg
	ArgStackSize, RetStackSize int64

	ArgIntRealRegs   byte
	ArgFloatRealRegs byte
	RetIntRealRegs   byte
	RetFloatRealRegs byte
}

FunctionABI represents the ABI information for a function which corresponds to a ssa.Signature.

func (*FunctionABI) ABIInfoAsUint64 added in v1.7.0

func (a *FunctionABI) ABIInfoAsUint64() uint64

func (*FunctionABI) AlignedArgResultStackSlotSize added in v1.7.0

func (a *FunctionABI) AlignedArgResultStackSlotSize() uint32

func (*FunctionABI) Init added in v1.7.0

func (a *FunctionABI) Init(sig *ssa.Signature, argResultInts, argResultFloats []regalloc.RealReg)

Init initializes the abiImpl for the given signature.

type Label added in v1.7.0

type Label uint32

Label represents a position in the generated code which is either a real instruction or the constant InstructionPool (e.g. jump tables).

This is exactly the same as the traditional "label" in assembly code.

const (
	LabelInvalid Label = 0
	LabelReturn  Label = math.MaxUint32
)

func (Label) String added in v1.7.0

func (l Label) String() string

String implements backend.Machine.

type LabelPosition added in v1.7.0

type LabelPosition[Instr any] struct {
	SB           ssa.BasicBlock
	L            Label
	Begin, End   *Instr
	BinaryOffset int64
}

LabelPosition represents the regions of the generated code which the label represents.

type Machine

type Machine interface {
	ExecutableContext() ExecutableContext

	// DisableStackCheck disables the stack check for the current compilation for debugging/testing.
	DisableStackCheck()

	// SetCurrentABI initializes the FunctionABI for the given signature.
	SetCurrentABI(abi *FunctionABI)

	// SetCompiler sets the compilation context used for the lifetime of Machine.
	// This is only called once per Machine, i.e. before the first compilation.
	SetCompiler(Compiler)

	// LowerSingleBranch is called when the compilation of the given single branch is started.
	LowerSingleBranch(b *ssa.Instruction)

	// LowerConditionalBranch is called when the compilation of the given conditional branch is started.
	LowerConditionalBranch(b *ssa.Instruction)

	// LowerInstr is called for each instruction in the given block except for the ones marked as already lowered
	// via Compiler.MarkLowered. The order is reverse, i.e. from the last instruction to the first one.
	//
	// Note: this can lower multiple instructions (which produce the inputs) at once whenever it's possible
	// for optimization.
	LowerInstr(*ssa.Instruction)

	// Reset resets the machine state for the next compilation.
	Reset()

	// InsertMove inserts a move instruction from src to dst whose type is typ.
	InsertMove(dst, src regalloc.VReg, typ ssa.Type)

	// InsertReturn inserts the return instruction to return from the current function.
	InsertReturn()

	// InsertLoadConstantBlockArg inserts the instruction(s) to load the constant value into the given regalloc.VReg.
	InsertLoadConstantBlockArg(instr *ssa.Instruction, vr regalloc.VReg)

	// Format returns the string representation of the currently compiled machine code.
	// This is only for testing purpose.
	Format() string

	// RegAlloc does the register allocation after lowering.
	RegAlloc()

	// PostRegAlloc does the post register allocation, e.g. setting up prologue/epilogue, redundant move elimination, etc.
	PostRegAlloc()

	// ResolveRelocations resolves the relocations after emitting machine code.
	//  * refToBinaryOffset: the map from the function reference (ssa.FuncRef) to the executable offset.
	//  * executable: the binary to resolve the relocations.
	//  * relocations: the relocations to resolve.
	//  * callTrampolineIslandOffsets: the offsets of the trampoline islands in the executable.
	ResolveRelocations(
		refToBinaryOffset []int,
		executable []byte,
		relocations []RelocationInfo,
		callTrampolineIslandOffsets []int,
	)

	// Encode encodes the machine instructions to the Compiler.
	Encode(ctx context.Context) error

	// CompileGoFunctionTrampoline compiles the trampoline function  to call a Go function of the given exit code and signature.
	CompileGoFunctionTrampoline(exitCode wazevoapi.ExitCode, sig *ssa.Signature, needModuleContextPtr bool) []byte

	// CompileStackGrowCallSequence returns the sequence of instructions shared by all functions to
	// call the stack grow builtin function.
	CompileStackGrowCallSequence() []byte

	// CompileEntryPreamble returns the sequence of instructions shared by multiple functions to
	// enter the function from Go.
	CompileEntryPreamble(signature *ssa.Signature) []byte

	// LowerParams lowers the given parameters.
	LowerParams(params []ssa.Value)

	// LowerReturns lowers the given returns.
	LowerReturns(returns []ssa.Value)

	// ArgsResultsRegs returns the registers used for arguments and return values.
	ArgsResultsRegs() (argResultInts, argResultFloats []regalloc.RealReg)

	// CallTrampolineIslandInfo returns the interval of the offset where the trampoline island is placed, and
	// the size of the trampoline island. If islandSize is zero, the trampoline island is not used on this machine.
	CallTrampolineIslandInfo(numFunctions int) (interval, islandSize int, err error)
}

Machine is a backend for a specific ISA machine.

type RegAllocBlock added in v1.7.0

type RegAllocBlock[I regalloc.InstrConstraint, m RegAllocFunctionMachine[I]] struct {
	// contains filtered or unexported fields
}

RegAllocBlock implements regalloc.Block.

func (*RegAllocBlock[I, m]) BlockParams added in v1.7.0

func (r *RegAllocBlock[I, m]) BlockParams(regs *[]regalloc.VReg) []regalloc.VReg

BlockParams implements regalloc.Block.

func (*RegAllocBlock[I, m]) EndInstr added in v1.7.0

func (r *RegAllocBlock[I, m]) EndInstr() regalloc.Instr

EndInstr implements regalloc.Block.

func (*RegAllocBlock[I, m]) Entry added in v1.7.0

func (r *RegAllocBlock[I, m]) Entry() bool

Entry implements regalloc.Block.

func (*RegAllocBlock[I, m]) FirstInstr added in v1.7.0

func (r *RegAllocBlock[I, m]) FirstInstr() regalloc.Instr

FirstInstr implements regalloc.Block.

func (*RegAllocBlock[I, m]) ID added in v1.7.0

func (r *RegAllocBlock[I, m]) ID() int32

ID implements regalloc.Block.

func (*RegAllocBlock[I, m]) InstrIteratorBegin added in v1.7.0

func (r *RegAllocBlock[I, m]) InstrIteratorBegin() regalloc.Instr

InstrIteratorBegin implements regalloc.Block.

func (*RegAllocBlock[I, m]) InstrIteratorNext added in v1.7.0

func (r *RegAllocBlock[I, m]) InstrIteratorNext() regalloc.Instr

InstrIteratorNext implements regalloc.Block.

func (*RegAllocBlock[I, m]) InstrRevIteratorBegin added in v1.7.0

func (r *RegAllocBlock[I, m]) InstrRevIteratorBegin() regalloc.Instr

InstrRevIteratorBegin implements regalloc.Block.

func (*RegAllocBlock[I, m]) InstrRevIteratorNext added in v1.7.0

func (r *RegAllocBlock[I, m]) InstrRevIteratorNext() regalloc.Instr

InstrRevIteratorNext implements regalloc.Block.

func (*RegAllocBlock[I, m]) LastInstrForInsertion added in v1.7.0

func (r *RegAllocBlock[I, m]) LastInstrForInsertion() regalloc.Instr

LastInstrForInsertion implements regalloc.Block.

func (*RegAllocBlock[I, m]) LoopHeader added in v1.7.0

func (r *RegAllocBlock[I, m]) LoopHeader() bool

LoopHeader implements regalloc.Block.

func (*RegAllocBlock[I, m]) LoopNestingForestChild added in v1.7.0

func (r *RegAllocBlock[I, m]) LoopNestingForestChild(i int) regalloc.Block

LoopNestingForestChild implements regalloc.Block.

func (*RegAllocBlock[I, m]) LoopNestingForestChildren added in v1.7.0

func (r *RegAllocBlock[I, m]) LoopNestingForestChildren() int

LoopNestingForestChildren implements regalloc.Block.

func (*RegAllocBlock[I, m]) Pred added in v1.7.0

func (r *RegAllocBlock[I, m]) Pred(i int) regalloc.Block

Pred implements regalloc.Block.

func (*RegAllocBlock[I, m]) Preds added in v1.7.0

func (r *RegAllocBlock[I, m]) Preds() int

Preds implements regalloc.Block.

func (*RegAllocBlock[I, m]) Succ added in v1.7.0

func (r *RegAllocBlock[I, m]) Succ(i int) regalloc.Block

Succ implements regalloc.Block.

func (*RegAllocBlock[I, m]) Succs added in v1.7.0

func (r *RegAllocBlock[I, m]) Succs() int

Succs implements regalloc.Block.

type RegAllocFunction added in v1.7.0

type RegAllocFunction[I regalloc.InstrConstraint, m RegAllocFunctionMachine[I]] struct {
	// contains filtered or unexported fields
}

RegAllocFunction implements regalloc.Function.

func NewRegAllocFunction added in v1.7.0

func NewRegAllocFunction[I regalloc.InstrConstraint, M RegAllocFunctionMachine[I]](m M, ssb ssa.Builder, c Compiler) *RegAllocFunction[I, M]

NewRegAllocFunction returns a new RegAllocFunction.

func (*RegAllocFunction[I, M]) AddBlock added in v1.7.0

func (f *RegAllocFunction[I, M]) AddBlock(sb ssa.BasicBlock, l Label, begin, end I)

AddBlock adds a new block to the function.

func (*RegAllocFunction[I, M]) ClobberedRegisters added in v1.7.0

func (f *RegAllocFunction[I, M]) ClobberedRegisters(regs []regalloc.VReg)

ClobberedRegisters implements regalloc.Function ClobberedRegisters.

func (*RegAllocFunction[I, M]) Idom added in v1.7.0

func (f *RegAllocFunction[I, M]) Idom(blk regalloc.Block) regalloc.Block

Idom implements regalloc.Function Idom.

func (*RegAllocFunction[I, M]) InsertMoveBefore added in v1.7.0

func (f *RegAllocFunction[I, M]) InsertMoveBefore(dst, src regalloc.VReg, instr regalloc.Instr)

InsertMoveBefore implements regalloc.Function InsertMoveBefore.

func (*RegAllocFunction[I, M]) LoopNestingForestRoot added in v1.7.0

func (f *RegAllocFunction[I, M]) LoopNestingForestRoot(i int) regalloc.Block

LoopNestingForestRoot implements regalloc.Function LoopNestingForestRoot.

func (*RegAllocFunction[I, M]) LoopNestingForestRoots added in v1.7.0

func (f *RegAllocFunction[I, M]) LoopNestingForestRoots() int

LoopNestingForestRoots implements regalloc.Function LoopNestingForestRoots.

func (*RegAllocFunction[I, M]) LowestCommonAncestor added in v1.7.0

func (f *RegAllocFunction[I, M]) LowestCommonAncestor(blk1, blk2 regalloc.Block) regalloc.Block

LowestCommonAncestor implements regalloc.Function LowestCommonAncestor.

func (*RegAllocFunction[I, M]) PostOrderBlockIteratorBegin added in v1.7.0

func (f *RegAllocFunction[I, M]) PostOrderBlockIteratorBegin() regalloc.Block

PostOrderBlockIteratorBegin implements regalloc.Function PostOrderBlockIteratorBegin.

func (*RegAllocFunction[I, M]) PostOrderBlockIteratorNext added in v1.7.0

func (f *RegAllocFunction[I, M]) PostOrderBlockIteratorNext() regalloc.Block

PostOrderBlockIteratorNext implements regalloc.Function PostOrderBlockIteratorNext.

func (*RegAllocFunction[I, M]) ReloadRegisterAfter added in v1.7.0

func (f *RegAllocFunction[I, M]) ReloadRegisterAfter(v regalloc.VReg, instr regalloc.Instr)

ReloadRegisterAfter implements regalloc.Function ReloadRegisterAfter.

func (*RegAllocFunction[I, M]) ReloadRegisterBefore added in v1.7.0

func (f *RegAllocFunction[I, M]) ReloadRegisterBefore(v regalloc.VReg, instr regalloc.Instr)

ReloadRegisterBefore implements regalloc.Function ReloadRegisterBefore.

func (*RegAllocFunction[I, M]) Reset added in v1.7.0

func (f *RegAllocFunction[I, M]) Reset()

Reset resets the function for the next compilation.

func (*RegAllocFunction[I, M]) ReversePostOrderBlockIteratorBegin added in v1.7.0

func (f *RegAllocFunction[I, M]) ReversePostOrderBlockIteratorBegin() regalloc.Block

ReversePostOrderBlockIteratorBegin implements regalloc.Function ReversePostOrderBlockIteratorBegin.

func (*RegAllocFunction[I, M]) ReversePostOrderBlockIteratorNext added in v1.7.0

func (f *RegAllocFunction[I, M]) ReversePostOrderBlockIteratorNext() regalloc.Block

ReversePostOrderBlockIteratorNext implements regalloc.Function ReversePostOrderBlockIteratorNext.

func (*RegAllocFunction[I, M]) StoreRegisterAfter added in v1.7.0

func (f *RegAllocFunction[I, M]) StoreRegisterAfter(v regalloc.VReg, instr regalloc.Instr)

StoreRegisterAfter implements regalloc.Function StoreRegisterAfter.

func (*RegAllocFunction[I, M]) StoreRegisterBefore added in v1.7.0

func (f *RegAllocFunction[I, M]) StoreRegisterBefore(v regalloc.VReg, instr regalloc.Instr)

StoreRegisterBefore implements regalloc.Function StoreRegisterBefore.

func (*RegAllocFunction[I, M]) SwapBefore added in v1.7.0

func (f *RegAllocFunction[I, M]) SwapBefore(x1, x2, tmp regalloc.VReg, instr regalloc.Instr)

SwapBefore implements regalloc.Function SwapBefore.

type RegAllocFunctionMachine added in v1.7.0

type RegAllocFunctionMachine[I regalloc.InstrConstraint] interface {
	// InsertMoveBefore inserts the move instruction from src to dst before the given instruction.
	InsertMoveBefore(dst, src regalloc.VReg, instr I)
	// InsertStoreRegisterAt inserts the instruction(s) to store the given virtual register at the given instruction.
	// If after is true, the instruction(s) will be inserted after the given instruction, otherwise before.
	InsertStoreRegisterAt(v regalloc.VReg, instr I, after bool) I
	// InsertReloadRegisterAt inserts the instruction(s) to reload the given virtual register at the given instruction.
	// If after is true, the instruction(s) will be inserted after the given instruction, otherwise before.
	InsertReloadRegisterAt(v regalloc.VReg, instr I, after bool) I
	// ClobberedRegisters is called when the register allocation is done and the clobbered registers are known.
	ClobberedRegisters(regs []regalloc.VReg)
	// Swap swaps the two virtual registers after the given instruction.
	Swap(cur I, x1, x2, tmp regalloc.VReg)
	// LastInstrForInsertion implements LastInstrForInsertion of regalloc.Function. See its comment for details.
	LastInstrForInsertion(begin, end I) I
	// SSABlockLabel returns the label of the given ssa.BasicBlockID.
	SSABlockLabel(id ssa.BasicBlockID) Label
}

RegAllocFunctionMachine is the interface for the machine specific logic that will be used in RegAllocFunction.

type RelocationInfo

type RelocationInfo struct {
	// Offset represents the offset from the beginning of the machine code of either a function or the entire module.
	Offset int64
	// Target is the target function of the call instruction.
	FuncRef ssa.FuncRef
}

RelocationInfo represents the relocation information for a call instruction.

type SSAValueDefinition

type SSAValueDefinition struct {
	// BlockParamValue is valid if Instr == nil
	BlockParamValue ssa.Value

	// BlkParamVReg is valid if Instr == nil
	BlkParamVReg regalloc.VReg

	// Instr is not nil if this is a definition from an instruction.
	Instr *ssa.Instruction
	// N is the index of the return value in the instr's return values list.
	N int
	// RefCount is the number of references to the result.
	RefCount int
}

SSAValueDefinition represents a definition of an SSA value.

func (*SSAValueDefinition) IsFromBlockParam

func (d *SSAValueDefinition) IsFromBlockParam() bool

func (*SSAValueDefinition) IsFromInstr

func (d *SSAValueDefinition) IsFromInstr() bool

func (*SSAValueDefinition) SSAValue

func (d *SSAValueDefinition) SSAValue() ssa.Value

type SourceOffsetInfo added in v1.6.0

type SourceOffsetInfo struct {
	// SourceOffset is the source offset in the original source code.
	SourceOffset ssa.SourceOffset
	// ExecutableOffset is the offset in the compiled executable.
	ExecutableOffset int64
}

SourceOffsetInfo is a data to associate the source offset with the executable offset.

Directories

Path Synopsis
isa
Package regalloc performs register allocation.
Package regalloc performs register allocation.

Jump to

Keyboard shortcuts

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