...

Package ssagen

import "cmd/compile/internal/ssagen"
Overview
Index

Overview ▾

Index ▾

Variables
func AbiForBodylessFuncStackMap(fn *ir.Func) *abi.ABIConfig
func AddAux(a *obj.Addr, v *ssa.Value)
func AddAux2(a *obj.Addr, v *ssa.Value, offset int64)
func AddrAuto(a *obj.Addr, v *ssa.Value)
func CheckArgReg(v *ssa.Value)
func CheckLargeStacks()
func CheckLoweredGetClosurePtr(v *ssa.Value)
func CheckLoweredPhi(v *ssa.Value)
func Compile(fn *ir.Func, worker int, profile *pgoir.Profile)
func CreateWasmImportWrapper(fn *ir.Func) bool
func DumpInline(fn *ir.Func)
func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym
func EnableNoWriteBarrierRecCheck()
func InitConfig()
func InitEnv()
func InitTables()
func IsIntrinsicCall(n *ir.CallExpr) bool
func NoWriteBarrierRecCheck()
func RegisterMapInitLsym(s *obj.LSym)
func SpillSlotAddr(spill ssa.Spill, baseReg int16, extraOffset int64) obj.Addr
func StackOffset(slot ssa.LocalSlot) int32
type ArchInfo
type Branch
type IndexJump
type State
    func (s *State) Br(op obj.As, target *ssa.Block) *obj.Prog
    func (s *State) Call(v *ssa.Value) *obj.Prog
    func (s *State) CombJump(b, next *ssa.Block, jumps *[2][2]IndexJump)
    func (s *State) DebugFriendlySetPosFrom(v *ssa.Value)
    func (s *State) FuncInfo() *obj.FuncInfo
    func (s *State) Pc() *obj.Prog
    func (s *State) PrepareCall(v *ssa.Value)
    func (s *State) Prog(as obj.As) *obj.Prog
    func (s *State) SetPos(pos src.XPos)
    func (s *State) TailCall(v *ssa.Value) *obj.Prog
    func (s *State) UseArgs(n int64)
type SymABIs
    func NewSymABIs() *SymABIs
    func (s *SymABIs) GenABIWrappers()
    func (s *SymABIs) ReadSymABIs(file string)

Package files

abi.go arch.go nowb.go pgen.go phi.go ssa.go

Variables

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

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, profile *pgoir.Profile)

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

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

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.

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

Branch is an unresolved branch.

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

type IndexJump

For generating consecutive jump instructions to model a specific branching

type IndexJump struct {
    Jump  obj.As
    Index int
}

type State

State contains state needed during Prog generation.

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
}

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

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

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

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

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.