ssagen

package standard library
go1.22.10 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BoundsCheckFunc [ssa.BoundsKindCount]*obj.LSym
	ExtendCheckFunc [ssa.BoundsKindCount]*obj.LSym
)

Functions

func AbiForBodylessFuncStackMap

func AbiForBodylessFuncStackMap(fn *ir.Func) *abi.ABIConfig

AbiForBodylessFuncStackMap returns the ABI for a bodyless function's stack map. This is not necessarily the ABI used to call it. Currently (1.17 dev) such a stack map is always ABI0; any ABI wrapper that is present is nosplit, hence a precise stack map is not needed there (the parameters survive only long enough to call the wrapped assembly function). This always returns a freshly copied ABI.

func AddAux

func AddAux(a *obj.Addr, v *ssa.Value)

AddAux adds the offset in the aux fields (AuxInt and Aux) of v to a.

func AddAux2

func AddAux2(a *obj.Addr, v *ssa.Value, offset int64)

func AddrAuto

func AddrAuto(a *obj.Addr, v *ssa.Value)

func CheckArgReg

func CheckArgReg(v *ssa.Value)

CheckArgReg ensures that v is in the function's entry block.

func CheckLargeStacks

func CheckLargeStacks()

func CheckLoweredGetClosurePtr

func CheckLoweredGetClosurePtr(v *ssa.Value)

CheckLoweredGetClosurePtr checks that v is the first instruction in the function's entry block, except for incoming in-register arguments. The output of LoweredGetClosurePtr is generally hardwired to the correct register. That register contains the closure pointer on closure entry.

func CheckLoweredPhi

func CheckLoweredPhi(v *ssa.Value)

CheckLoweredPhi checks that regalloc and stackalloc correctly handled phi values. Called during ssaGenValue.

func Compile

func Compile(fn *ir.Func, worker int)

Compile builds an SSA backend function, uses it to generate a plist, and flushes that plist to machine code. worker indicates which of the backend workers is doing the processing.

func CreateWasmImportWrapper added in go1.21.0

func CreateWasmImportWrapper(fn *ir.Func) bool

CreateWasmImportWrapper creates a wrapper for imported WASM functions to adapt them to the Go calling convention. The body for this function is generated in cmd/internal/obj/wasm/wasmobj.go

func DumpInline

func DumpInline(fn *ir.Func)

func EmitArgInfo

func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym

emit argument info (locations on stack) of f for traceback.

func EnableNoWriteBarrierRecCheck

func EnableNoWriteBarrierRecCheck()

func InitConfig

func InitConfig()

func InitEnv

func InitEnv()

func InitTables

func InitTables()

func IsIntrinsicCall

func IsIntrinsicCall(n *ir.CallExpr) bool

func NoWriteBarrierRecCheck

func NoWriteBarrierRecCheck()

func RegisterMapInitLsym added in go1.21.0

func RegisterMapInitLsym(s *obj.LSym)

RegisterMapInitLsym records "s" in the set of outlined map initializer functions.

func SpillSlotAddr

func SpillSlotAddr(spill ssa.Spill, baseReg int16, extraOffset int64) obj.Addr

SpillSlotAddr uses LocalSlot information to initialize an obj.Addr The resulting addr is used in a non-standard context -- in the prologue of a function, before the frame has been constructed, so the standard addressing for the parameters will be wrong.

func StackOffset

func StackOffset(slot ssa.LocalSlot) int32

StackOffset returns the stack location of a LocalSlot relative to the stack pointer, suitable for use in a DWARF location entry. This has nothing to do with its offset in the user variable.

Types

type ArchInfo

type ArchInfo struct {
	LinkArch *obj.LinkArch

	REGSP     int
	MAXWIDTH  int64
	SoftFloat bool

	PadFrame func(int64) int64

	// ZeroRange zeroes a range of memory on stack. It is only inserted
	// at function entry, and it is ok to clobber registers.
	ZeroRange func(*objw.Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog

	Ginsnop func(*objw.Progs) *obj.Prog

	// SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
	SSAMarkMoves func(*State, *ssa.Block)

	// SSAGenValue emits Prog(s) for the Value.
	SSAGenValue func(*State, *ssa.Value)

	// SSAGenBlock emits end-of-block Progs. SSAGenValue should be called
	// for all values in the block before SSAGenBlock.
	SSAGenBlock func(s *State, b, next *ssa.Block)

	// LoadRegResult emits instructions that loads register-assigned result
	// at n+off (n is PPARAMOUT) to register reg. The result is already in
	// memory. Used in open-coded defer return path.
	LoadRegResult func(s *State, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog

	// SpillArgReg emits instructions that spill reg to n+off.
	SpillArgReg func(pp *objw.Progs, p *obj.Prog, f *ssa.Func, t *types.Type, reg int16, n *ir.Name, off int64) *obj.Prog
}
var Arch ArchInfo

type Branch

type Branch struct {
	P *obj.Prog  // branch instruction
	B *ssa.Block // target
}

Branch is an unresolved branch.

type IndexJump

type IndexJump struct {
	Jump  obj.As
	Index int
}

For generating consecutive jump instructions to model a specific branching

type State

type State struct {
	ABI obj.ABI

	// Branches remembers all the branch instructions we've seen
	// and where they would like to go.
	Branches []Branch

	// JumpTables remembers all the jump tables we've seen.
	JumpTables []*ssa.Block

	// wasm: The number of values on the WebAssembly stack. This is only used as a safeguard.
	OnWasmStackSkipped int
	// contains filtered or unexported fields
}

State contains state needed during Prog generation.

func (*State) Br

func (s *State) Br(op obj.As, target *ssa.Block) *obj.Prog

Br emits a single branch instruction and returns the instruction. Not all architectures need the returned instruction, but otherwise the boilerplate is common to all.

func (*State) Call

func (s *State) Call(v *ssa.Value) *obj.Prog

Call returns a new CALL instruction for the SSA value v. It uses PrepareCall to prepare the call.

func (*State) CombJump

func (s *State) CombJump(b, next *ssa.Block, jumps *[2][2]IndexJump)

CombJump generates combinational instructions (2 at present) for a block jump, thereby the behaviour of non-standard condition codes could be simulated

func (*State) DebugFriendlySetPosFrom

func (s *State) DebugFriendlySetPosFrom(v *ssa.Value)

DebugFriendlySetPosFrom adjusts Pos.IsStmt subject to heuristics that reduce "jumpy" line number churn when debugging. Spill/fill/copy instructions from the register allocator, phi functions, and instructions with a no-pos position are examples of instructions that can cause churn.

func (*State) FuncInfo

func (s *State) FuncInfo() *obj.FuncInfo

func (*State) Pc

func (s *State) Pc() *obj.Prog

Pc returns the current Prog.

func (*State) PrepareCall

func (s *State) PrepareCall(v *ssa.Value)

PrepareCall prepares to emit a CALL instruction for v and does call-related bookkeeping. It must be called immediately before emitting the actual CALL instruction, since it emits PCDATA for the stack map at the call (calls are safe points).

func (*State) Prog

func (s *State) Prog(as obj.As) *obj.Prog

Prog appends a new Prog.

func (*State) SetPos

func (s *State) SetPos(pos src.XPos)

SetPos sets the current source position.

func (*State) TailCall added in go1.18

func (s *State) TailCall(v *ssa.Value) *obj.Prog

TailCall returns a new tail call instruction for the SSA value v. It is like Call, but for a tail call.

func (*State) UseArgs

func (s *State) UseArgs(n int64)

UseArgs records the fact that an instruction needs a certain amount of callee args space for its use.

type SymABIs

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

SymABIs records information provided by the assembler about symbol definition ABIs and reference ABIs.

func NewSymABIs

func NewSymABIs() *SymABIs

func (*SymABIs) GenABIWrappers

func (s *SymABIs) GenABIWrappers()

GenABIWrappers applies ABI information to Funcs and generates ABI wrapper functions where necessary.

func (*SymABIs) ReadSymABIs

func (s *SymABIs) ReadSymABIs(file string)

ReadSymABIs reads a symabis file that specifies definitions and references of text symbols by ABI.

The symabis format is a set of lines, where each line is a sequence of whitespace-separated fields. The first field is a verb and is either "def" for defining a symbol ABI or "ref" for referencing a symbol using an ABI. For both "def" and "ref", the second field is the symbol name and the third field is the ABI name, as one of the named cmd/internal/obj.ABI constants.

Jump to

Keyboard shortcuts

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