...

Package ir

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

Overview ▾

Index ▾

Constants
Variables
func Any(n Node, cond func(Node) bool) bool
func AnyList(list Nodes, cond func(Node) bool) bool
func AssertValidTypeForConst(t *types.Type, v constant.Value)
func BigFloat(v constant.Value) *big.Float
func BoolVal(n Node) bool
func ClosureDebugRuntimeCheck(clo *ClosureExpr)
func ConstOverflow(v constant.Value, t *types.Type) bool
func ConstType(n Node) constant.Kind
func DeclaredBy(x, stmt Node) bool
func DoChildren(n Node, do func(Node) bool) bool
func Dump(s string, n Node)
func DumpAny(root interface{}, filter string, depth int)
func DumpList(s string, list Nodes)
func EditChildren(n Node, edit func(Node) Node)
func EditChildrenWithHidden(n Node, edit func(Node) Node)
func FDumpAny(w io.Writer, root interface{}, filter string, depth int)
func FDumpList(w io.Writer, s string, list Nodes)
func FuncName(f *Func) string
func FuncSymName(s *types.Sym) string
func HasUniquePos(n Node) bool
func InitLSym(f *Func, hasBody bool)
func Int64Val(n Node) int64
func IntVal(t *types.Type, v constant.Value) int64
func IsAddressable(n Node) bool
func IsAutoTmp(n Node) bool
func IsBlank(n Node) bool
func IsConst(n Node, ct constant.Kind) bool
func IsConstNode(n Node) bool
func IsFuncPCIntrinsic(n *CallExpr) bool
func IsMethod(n Node) bool
func IsNil(n Node) bool
func IsReflectHeaderDataField(l Node) bool
func IsSmallIntConst(n Node) bool
func IsSynthetic(n Node) bool
func IsTrivialClosure(clo *ClosureExpr) bool
func IsZero(n Node) bool
func Line(n Node) string
func LinkFuncName(f *Func) string
func LookupMethodSelector(pkg *types.Pkg, name string) (typ, meth *types.Sym, err error)
func MayBeShared(n Node) bool
func MethodExprFunc(n Node) *types.Field
func MethodSym(recv *types.Type, msym *types.Sym) *types.Sym
func MethodSymSuffix(recv *types.Type, msym *types.Sym, suffix string) *types.Sym
func ParseLinkFuncName(name string) (pkg, sym string, err error)
func PkgFuncName(f *Func) string
func Reassigned(name *Name) bool
func SameSafeExpr(l Node, r Node) bool
func SameSource(n1, n2 Node) bool
func SetPos(n Node) src.XPos
func ShouldAsanCheckPtr(fn *Func) bool
func ShouldCheckPtr(fn *Func, level int) bool
func StmtWithInit(op Op) bool
func StringVal(n Node) string
func Uint64Val(n Node) uint64
func Uses(x Node, v *Name) bool
func ValidTypeForConst(t *types.Type, v constant.Value) bool
func Visit(n Node, visit func(Node))
func VisitFuncAndClosures(fn *Func, visit func(n Node))
func VisitFuncsBottomUp(list []*Func, analyze func(list []*Func, recursive bool))
func VisitList(list Nodes, visit func(Node))
func WithFunc(curfn *Func, do func())
type AddStringExpr
    func NewAddStringExpr(pos src.XPos, list []Node) *AddStringExpr
    func (n *AddStringExpr) Bounded() bool
    func (n *AddStringExpr) Format(s fmt.State, verb rune)
    func (n *AddStringExpr) Init() Nodes
    func (n *AddStringExpr) MarkNonNil()
    func (n *AddStringExpr) NonNil() bool
    func (n *AddStringExpr) PtrInit() *Nodes
    func (n *AddStringExpr) SetBounded(b bool)
    func (n *AddStringExpr) SetInit(x Nodes)
    func (n *AddStringExpr) SetTransient(b bool)
    func (n *AddStringExpr) SetType(x *types.Type)
    func (n *AddStringExpr) Transient() bool
    func (n *AddStringExpr) Type() *types.Type
type AddrExpr
    func NewAddrExpr(pos src.XPos, x Node) *AddrExpr
    func (n *AddrExpr) Bounded() bool
    func (n *AddrExpr) Format(s fmt.State, verb rune)
    func (n *AddrExpr) Implicit() bool
    func (n *AddrExpr) Init() Nodes
    func (n *AddrExpr) MarkNonNil()
    func (n *AddrExpr) NonNil() bool
    func (n *AddrExpr) PtrInit() *Nodes
    func (n *AddrExpr) SetBounded(b bool)
    func (n *AddrExpr) SetImplicit(b bool)
    func (n *AddrExpr) SetInit(x Nodes)
    func (n *AddrExpr) SetOp(op Op)
    func (n *AddrExpr) SetTransient(b bool)
    func (n *AddrExpr) SetType(x *types.Type)
    func (n *AddrExpr) Transient() bool
    func (n *AddrExpr) Type() *types.Type
type AssignListStmt
    func NewAssignListStmt(pos src.XPos, op Op, lhs, rhs []Node) *AssignListStmt
    func (n *AssignListStmt) Format(s fmt.State, verb rune)
    func (n *AssignListStmt) Init() Nodes
    func (n *AssignListStmt) PtrInit() *Nodes
    func (n *AssignListStmt) SetInit(x Nodes)
    func (n *AssignListStmt) SetOp(op Op)
type AssignOpStmt
    func NewAssignOpStmt(pos src.XPos, asOp Op, x, y Node) *AssignOpStmt
    func (n *AssignOpStmt) Format(s fmt.State, verb rune)
    func (n *AssignOpStmt) Init() Nodes
    func (n *AssignOpStmt) PtrInit() *Nodes
    func (n *AssignOpStmt) SetInit(x Nodes)
type AssignStmt
    func NewAssignStmt(pos src.XPos, x, y Node) *AssignStmt
    func (n *AssignStmt) Format(s fmt.State, verb rune)
    func (n *AssignStmt) Init() Nodes
    func (n *AssignStmt) PtrInit() *Nodes
    func (n *AssignStmt) SetInit(x Nodes)
    func (n *AssignStmt) SetOp(op Op)
type BasicLit
    func (n *BasicLit) Bounded() bool
    func (n *BasicLit) Format(s fmt.State, verb rune)
    func (n *BasicLit) Init() Nodes
    func (n *BasicLit) MarkNonNil()
    func (n *BasicLit) NonNil() bool
    func (n *BasicLit) PtrInit() *Nodes
    func (n *BasicLit) SetBounded(b bool)
    func (n *BasicLit) SetInit(x Nodes)
    func (n *BasicLit) SetTransient(b bool)
    func (n *BasicLit) SetType(x *types.Type)
    func (n *BasicLit) SetVal(val constant.Value)
    func (n *BasicLit) Transient() bool
    func (n *BasicLit) Type() *types.Type
    func (n *BasicLit) Val() constant.Value
type BinaryExpr
    func NewBinaryExpr(pos src.XPos, op Op, x, y Node) *BinaryExpr
    func (n *BinaryExpr) Bounded() bool
    func (n *BinaryExpr) Format(s fmt.State, verb rune)
    func (n *BinaryExpr) Init() Nodes
    func (n *BinaryExpr) MarkNonNil()
    func (n *BinaryExpr) NonNil() bool
    func (n *BinaryExpr) PtrInit() *Nodes
    func (n *BinaryExpr) SetBounded(b bool)
    func (n *BinaryExpr) SetInit(x Nodes)
    func (n *BinaryExpr) SetOp(op Op)
    func (n *BinaryExpr) SetTransient(b bool)
    func (n *BinaryExpr) SetType(x *types.Type)
    func (n *BinaryExpr) Transient() bool
    func (n *BinaryExpr) Type() *types.Type
type BlockStmt
    func NewBlockStmt(pos src.XPos, list []Node) *BlockStmt
    func (n *BlockStmt) Format(s fmt.State, verb rune)
    func (n *BlockStmt) Init() Nodes
    func (n *BlockStmt) PtrInit() *Nodes
    func (n *BlockStmt) SetInit(x Nodes)
type BranchStmt
    func NewBranchStmt(pos src.XPos, op Op, label *types.Sym) *BranchStmt
    func (n *BranchStmt) Format(s fmt.State, verb rune)
    func (n *BranchStmt) Init() Nodes
    func (n *BranchStmt) PtrInit() *Nodes
    func (n *BranchStmt) SetInit(x Nodes)
    func (n *BranchStmt) SetOp(op Op)
    func (n *BranchStmt) Sym() *types.Sym
type CallExpr
    func NewCallExpr(pos src.XPos, op Op, fun Node, args []Node) *CallExpr
    func (n *CallExpr) Bounded() bool
    func (n *CallExpr) Format(s fmt.State, verb rune)
    func (n *CallExpr) Init() Nodes
    func (n *CallExpr) MarkNonNil()
    func (n *CallExpr) NonNil() bool
    func (n *CallExpr) PtrInit() *Nodes
    func (n *CallExpr) SetBounded(b bool)
    func (n *CallExpr) SetInit(x Nodes)
    func (n *CallExpr) SetOp(op Op)
    func (n *CallExpr) SetTransient(b bool)
    func (n *CallExpr) SetType(x *types.Type)
    func (n *CallExpr) Transient() bool
    func (n *CallExpr) Type() *types.Type
type CaseClause
    func NewCaseStmt(pos src.XPos, list, body []Node) *CaseClause
    func (n *CaseClause) Format(s fmt.State, verb rune)
    func (n *CaseClause) Init() Nodes
    func (n *CaseClause) PtrInit() *Nodes
    func (n *CaseClause) SetInit(x Nodes)
type Class
    func (i Class) String() string
type ClosureExpr
    func (n *ClosureExpr) Bounded() bool
    func (n *ClosureExpr) Format(s fmt.State, verb rune)
    func (n *ClosureExpr) Init() Nodes
    func (n *ClosureExpr) MarkNonNil()
    func (n *ClosureExpr) NonNil() bool
    func (n *ClosureExpr) PtrInit() *Nodes
    func (n *ClosureExpr) SetBounded(b bool)
    func (n *ClosureExpr) SetInit(x Nodes)
    func (n *ClosureExpr) SetTransient(b bool)
    func (n *ClosureExpr) SetType(x *types.Type)
    func (n *ClosureExpr) Transient() bool
    func (n *ClosureExpr) Type() *types.Type
type CommClause
    func NewCommStmt(pos src.XPos, comm Node, body []Node) *CommClause
    func (n *CommClause) Format(s fmt.State, verb rune)
    func (n *CommClause) Init() Nodes
    func (n *CommClause) PtrInit() *Nodes
    func (n *CommClause) SetInit(x Nodes)
type CompLitExpr
    func NewCompLitExpr(pos src.XPos, op Op, typ *types.Type, list []Node) *CompLitExpr
    func (n *CompLitExpr) Bounded() bool
    func (n *CompLitExpr) Format(s fmt.State, verb rune)
    func (n *CompLitExpr) Implicit() bool
    func (n *CompLitExpr) Init() Nodes
    func (n *CompLitExpr) MarkNonNil()
    func (n *CompLitExpr) NonNil() bool
    func (n *CompLitExpr) PtrInit() *Nodes
    func (n *CompLitExpr) SetBounded(b bool)
    func (n *CompLitExpr) SetImplicit(b bool)
    func (n *CompLitExpr) SetInit(x Nodes)
    func (n *CompLitExpr) SetOp(op Op)
    func (n *CompLitExpr) SetTransient(b bool)
    func (n *CompLitExpr) SetType(x *types.Type)
    func (n *CompLitExpr) Transient() bool
    func (n *CompLitExpr) Type() *types.Type
type ConvExpr
    func NewConvExpr(pos src.XPos, op Op, typ *types.Type, x Node) *ConvExpr
    func (n *ConvExpr) Bounded() bool
    func (n *ConvExpr) CheckPtr() bool
    func (n *ConvExpr) Format(s fmt.State, verb rune)
    func (n *ConvExpr) Implicit() bool
    func (n *ConvExpr) Init() Nodes
    func (n *ConvExpr) MarkNonNil()
    func (n *ConvExpr) NonNil() bool
    func (n *ConvExpr) PtrInit() *Nodes
    func (n *ConvExpr) SetBounded(b bool)
    func (n *ConvExpr) SetCheckPtr(b bool)
    func (n *ConvExpr) SetImplicit(b bool)
    func (n *ConvExpr) SetInit(x Nodes)
    func (n *ConvExpr) SetOp(op Op)
    func (n *ConvExpr) SetTransient(b bool)
    func (n *ConvExpr) SetType(x *types.Type)
    func (n *ConvExpr) Transient() bool
    func (n *ConvExpr) Type() *types.Type
type Decl
    func NewDecl(pos src.XPos, op Op, x *Name) *Decl
    func (n *Decl) Esc() uint16
    func (n *Decl) Format(s fmt.State, verb rune)
    func (n *Decl) Init() Nodes
    func (n *Decl) MarkNonNil()
    func (n *Decl) Name() *Name
    func (n *Decl) NonNil() bool
    func (n *Decl) Op() Op
    func (n *Decl) Pos() src.XPos
    func (n *Decl) SetEsc(x uint16)
    func (n *Decl) SetPos(x src.XPos)
    func (n *Decl) SetType(*types.Type)
    func (n *Decl) SetTypecheck(x uint8)
    func (n *Decl) SetVal(v constant.Value)
    func (n *Decl) SetWalked(x bool)
    func (n *Decl) Sym() *types.Sym
    func (n *Decl) Type() *types.Type
    func (n *Decl) Typecheck() uint8
    func (n *Decl) Val() constant.Value
    func (n *Decl) Walked() bool
type DynamicType
    func NewDynamicType(pos src.XPos, rtype Node) *DynamicType
    func (n *DynamicType) Bounded() bool
    func (n *DynamicType) Format(s fmt.State, verb rune)
    func (n *DynamicType) Init() Nodes
    func (n *DynamicType) MarkNonNil()
    func (n *DynamicType) NonNil() bool
    func (n *DynamicType) PtrInit() *Nodes
    func (n *DynamicType) SetBounded(b bool)
    func (n *DynamicType) SetInit(x Nodes)
    func (n *DynamicType) SetTransient(b bool)
    func (n *DynamicType) SetType(x *types.Type)
    func (n *DynamicType) Transient() bool
    func (n *DynamicType) Type() *types.Type
type DynamicTypeAssertExpr
    func NewDynamicTypeAssertExpr(pos src.XPos, op Op, x, rtype Node) *DynamicTypeAssertExpr
    func (n *DynamicTypeAssertExpr) Bounded() bool
    func (n *DynamicTypeAssertExpr) Format(s fmt.State, verb rune)
    func (n *DynamicTypeAssertExpr) Init() Nodes
    func (n *DynamicTypeAssertExpr) MarkNonNil()
    func (n *DynamicTypeAssertExpr) NonNil() bool
    func (n *DynamicTypeAssertExpr) PtrInit() *Nodes
    func (n *DynamicTypeAssertExpr) SetBounded(b bool)
    func (n *DynamicTypeAssertExpr) SetInit(x Nodes)
    func (n *DynamicTypeAssertExpr) SetOp(op Op)
    func (n *DynamicTypeAssertExpr) SetTransient(b bool)
    func (n *DynamicTypeAssertExpr) SetType(x *types.Type)
    func (n *DynamicTypeAssertExpr) Transient() bool
    func (n *DynamicTypeAssertExpr) Type() *types.Type
type Embed
type Expr
type ForStmt
    func NewForStmt(pos src.XPos, init Node, cond, post Node, body []Node, distinctVars bool) *ForStmt
    func (n *ForStmt) Format(s fmt.State, verb rune)
    func (n *ForStmt) Init() Nodes
    func (n *ForStmt) PtrInit() *Nodes
    func (n *ForStmt) SetInit(x Nodes)
type Func
    func IsIfaceOfFunc(n Node) *Func
    func NewClosureFunc(fpos, cpos src.XPos, why Op, typ *types.Type, outerfn *Func, pkg *Package) *Func
    func NewFunc(fpos, npos src.XPos, sym *types.Sym, typ *types.Type) *Func
    func (f *Func) ABIWrapper() bool
    func (f *Func) ClosureResultsLost() bool
    func (fn *Func) DeclareParams(setNname bool)
    func (f *Func) Dupok() bool
    func (n *Func) Esc() uint16
    func (n *Func) Format(s fmt.State, verb rune)
    func (f *Func) HasDefer() bool
    func (n *Func) Init() Nodes
    func (f *Func) InlinabilityChecked() bool
    func (f *Func) IsDeadcodeClosure() bool
    func (f *Func) IsHiddenClosure() bool
    func (f *Func) IsPackageInit() bool
    func (f *Func) Linksym() *obj.LSym
    func (f *Func) LinksymABI(abi obj.ABI) *obj.LSym
    func (n *Func) MarkNonNil()
    func (n *Func) Name() *Name
    func (f *Func) Needctxt() bool
    func (f *Func) NeverReturns() bool
    func (fn *Func) NewLocal(pos src.XPos, sym *types.Sym, typ *types.Type) *Name
    func (f *Func) NilCheckDisabled() bool
    func (n *Func) NonNil() bool
    func (n *Func) Op() Op
    func (f *Func) OpenCodedDeferDisallowed() bool
    func (n *Func) Pos() src.XPos
    func (f *Func) SetABIWrapper(b bool)
    func (f *Func) SetClosureResultsLost(b bool)
    func (f *Func) SetDupok(b bool)
    func (n *Func) SetEsc(x uint16)
    func (f *Func) SetHasDefer(b bool)
    func (f *Func) SetInlinabilityChecked(b bool)
    func (f *Func) SetIsDeadcodeClosure(b bool)
    func (f *Func) SetIsHiddenClosure(b bool)
    func (f *Func) SetIsPackageInit(b bool)
    func (f *Func) SetNeedctxt(b bool)
    func (f *Func) SetNeverReturns(b bool)
    func (f *Func) SetNilCheckDisabled(b bool)
    func (f *Func) SetOpenCodedDeferDisallowed(b bool)
    func (n *Func) SetPos(x src.XPos)
    func (n *Func) SetType(*types.Type)
    func (n *Func) SetTypecheck(x uint8)
    func (n *Func) SetVal(v constant.Value)
    func (f *Func) SetWBPos(pos src.XPos)
    func (n *Func) SetWalked(x bool)
    func (f *Func) SetWrapper(b bool)
    func (f *Func) Sym() *types.Sym
    func (f *Func) Type() *types.Type
    func (n *Func) Typecheck() uint8
    func (n *Func) Val() constant.Value
    func (n *Func) Walked() bool
    func (f *Func) Wrapper() bool
type GoDeferStmt
    func NewGoDeferStmt(pos src.XPos, op Op, call Node) *GoDeferStmt
    func (n *GoDeferStmt) Format(s fmt.State, verb rune)
    func (n *GoDeferStmt) Init() Nodes
    func (n *GoDeferStmt) PtrInit() *Nodes
    func (n *GoDeferStmt) SetInit(x Nodes)
type Ident
    func NewIdent(pos src.XPos, sym *types.Sym) *Ident
    func (n *Ident) Bounded() bool
    func (n *Ident) Format(s fmt.State, verb rune)
    func (n *Ident) Init() Nodes
    func (n *Ident) MarkNonNil()
    func (n *Ident) NonNil() bool
    func (n *Ident) PtrInit() *Nodes
    func (n *Ident) SetBounded(b bool)
    func (n *Ident) SetInit(x Nodes)
    func (n *Ident) SetTransient(b bool)
    func (n *Ident) SetType(x *types.Type)
    func (n *Ident) Sym() *types.Sym
    func (n *Ident) Transient() bool
    func (n *Ident) Type() *types.Type
type IfStmt
    func NewIfStmt(pos src.XPos, cond Node, body, els []Node) *IfStmt
    func (n *IfStmt) Format(s fmt.State, verb rune)
    func (n *IfStmt) Init() Nodes
    func (n *IfStmt) PtrInit() *Nodes
    func (n *IfStmt) SetInit(x Nodes)
type IndexExpr
    func NewIndexExpr(pos src.XPos, x, index Node) *IndexExpr
    func (n *IndexExpr) Bounded() bool
    func (n *IndexExpr) Format(s fmt.State, verb rune)
    func (n *IndexExpr) Init() Nodes
    func (n *IndexExpr) MarkNonNil()
    func (n *IndexExpr) NonNil() bool
    func (n *IndexExpr) PtrInit() *Nodes
    func (n *IndexExpr) SetBounded(b bool)
    func (n *IndexExpr) SetInit(x Nodes)
    func (n *IndexExpr) SetOp(op Op)
    func (n *IndexExpr) SetTransient(b bool)
    func (n *IndexExpr) SetType(x *types.Type)
    func (n *IndexExpr) Transient() bool
    func (n *IndexExpr) Type() *types.Type
type InitNode
type Inline
type InlineMarkStmt
    func NewInlineMarkStmt(pos src.XPos, index int64) *InlineMarkStmt
    func (n *InlineMarkStmt) Format(s fmt.State, verb rune)
    func (n *InlineMarkStmt) Init() Nodes
    func (n *InlineMarkStmt) Offset() int64
    func (n *InlineMarkStmt) PtrInit() *Nodes
    func (n *InlineMarkStmt) SetInit(x Nodes)
    func (n *InlineMarkStmt) SetOffset(x int64)
type InlinedCallExpr
    func NewInlinedCallExpr(pos src.XPos, body, retvars []Node) *InlinedCallExpr
    func (n *InlinedCallExpr) Bounded() bool
    func (n *InlinedCallExpr) Format(s fmt.State, verb rune)
    func (n *InlinedCallExpr) Init() Nodes
    func (n *InlinedCallExpr) MarkNonNil()
    func (n *InlinedCallExpr) NonNil() bool
    func (n *InlinedCallExpr) PtrInit() *Nodes
    func (n *InlinedCallExpr) SetBounded(b bool)
    func (n *InlinedCallExpr) SetInit(x Nodes)
    func (n *InlinedCallExpr) SetTransient(b bool)
    func (n *InlinedCallExpr) SetType(x *types.Type)
    func (n *InlinedCallExpr) SingleResult() Node
    func (n *InlinedCallExpr) Transient() bool
    func (n *InlinedCallExpr) Type() *types.Type
type InterfaceSwitchStmt
    func NewInterfaceSwitchStmt(pos src.XPos, case_, itab, runtimeType, hash Node, descriptor *obj.LSym) *InterfaceSwitchStmt
    func (n *InterfaceSwitchStmt) Format(s fmt.State, verb rune)
    func (n *InterfaceSwitchStmt) Init() Nodes
    func (n *InterfaceSwitchStmt) PtrInit() *Nodes
    func (n *InterfaceSwitchStmt) SetInit(x Nodes)
type JumpTableStmt
    func NewJumpTableStmt(pos src.XPos, idx Node) *JumpTableStmt
    func (n *JumpTableStmt) Format(s fmt.State, verb rune)
    func (n *JumpTableStmt) Init() Nodes
    func (n *JumpTableStmt) PtrInit() *Nodes
    func (n *JumpTableStmt) SetInit(x Nodes)
type KeyExpr
    func NewKeyExpr(pos src.XPos, key, value Node) *KeyExpr
    func (n *KeyExpr) Bounded() bool
    func (n *KeyExpr) Format(s fmt.State, verb rune)
    func (n *KeyExpr) Init() Nodes
    func (n *KeyExpr) MarkNonNil()
    func (n *KeyExpr) NonNil() bool
    func (n *KeyExpr) PtrInit() *Nodes
    func (n *KeyExpr) SetBounded(b bool)
    func (n *KeyExpr) SetInit(x Nodes)
    func (n *KeyExpr) SetTransient(b bool)
    func (n *KeyExpr) SetType(x *types.Type)
    func (n *KeyExpr) Transient() bool
    func (n *KeyExpr) Type() *types.Type
type LabelStmt
    func NewLabelStmt(pos src.XPos, label *types.Sym) *LabelStmt
    func (n *LabelStmt) Format(s fmt.State, verb rune)
    func (n *LabelStmt) Init() Nodes
    func (n *LabelStmt) PtrInit() *Nodes
    func (n *LabelStmt) SetInit(x Nodes)
    func (n *LabelStmt) Sym() *types.Sym
type LinksymOffsetExpr
    func NewLinksymExpr(pos src.XPos, lsym *obj.LSym, typ *types.Type) *LinksymOffsetExpr
    func NewLinksymOffsetExpr(pos src.XPos, lsym *obj.LSym, offset int64, typ *types.Type) *LinksymOffsetExpr
    func NewNameOffsetExpr(pos src.XPos, name *Name, offset int64, typ *types.Type) *LinksymOffsetExpr
    func (n *LinksymOffsetExpr) Bounded() bool
    func (n *LinksymOffsetExpr) Format(s fmt.State, verb rune)
    func (n *LinksymOffsetExpr) Init() Nodes
    func (n *LinksymOffsetExpr) MarkNonNil()
    func (n *LinksymOffsetExpr) NonNil() bool
    func (n *LinksymOffsetExpr) PtrInit() *Nodes
    func (n *LinksymOffsetExpr) SetBounded(b bool)
    func (n *LinksymOffsetExpr) SetInit(x Nodes)
    func (n *LinksymOffsetExpr) SetTransient(b bool)
    func (n *LinksymOffsetExpr) SetType(x *types.Type)
    func (n *LinksymOffsetExpr) Transient() bool
    func (n *LinksymOffsetExpr) Type() *types.Type
type LogicalExpr
    func NewLogicalExpr(pos src.XPos, op Op, x, y Node) *LogicalExpr
    func (n *LogicalExpr) Bounded() bool
    func (n *LogicalExpr) Format(s fmt.State, verb rune)
    func (n *LogicalExpr) Init() Nodes
    func (n *LogicalExpr) MarkNonNil()
    func (n *LogicalExpr) NonNil() bool
    func (n *LogicalExpr) PtrInit() *Nodes
    func (n *LogicalExpr) SetBounded(b bool)
    func (n *LogicalExpr) SetInit(x Nodes)
    func (n *LogicalExpr) SetOp(op Op)
    func (n *LogicalExpr) SetTransient(b bool)
    func (n *LogicalExpr) SetType(x *types.Type)
    func (n *LogicalExpr) Transient() bool
    func (n *LogicalExpr) Type() *types.Type
type MakeExpr
    func NewMakeExpr(pos src.XPos, op Op, len, cap Node) *MakeExpr
    func (n *MakeExpr) Bounded() bool
    func (n *MakeExpr) Format(s fmt.State, verb rune)
    func (n *MakeExpr) Init() Nodes
    func (n *MakeExpr) MarkNonNil()
    func (n *MakeExpr) NonNil() bool
    func (n *MakeExpr) PtrInit() *Nodes
    func (n *MakeExpr) SetBounded(b bool)
    func (n *MakeExpr) SetInit(x Nodes)
    func (n *MakeExpr) SetOp(op Op)
    func (n *MakeExpr) SetTransient(b bool)
    func (n *MakeExpr) SetType(x *types.Type)
    func (n *MakeExpr) Transient() bool
    func (n *MakeExpr) Type() *types.Type
type Mark
type Name
    func MethodExprName(n Node) *Name
    func NewBuiltin(sym *types.Sym, op Op) *Name
    func NewClosureVar(pos src.XPos, fn *Func, n *Name) *Name
    func NewConstAt(pos src.XPos, sym *types.Sym, typ *types.Type, val constant.Value) *Name
    func NewDeclNameAt(pos src.XPos, op Op, sym *types.Sym) *Name
    func NewHiddenParam(pos src.XPos, fn *Func, sym *types.Sym, typ *types.Type) *Name
    func NewNameAt(pos src.XPos, sym *types.Sym, typ *types.Type) *Name
    func StaticCalleeName(n Node) *Name
    func (n *Name) Addrtaken() bool
    func (n *Name) Alias() bool
    func (n *Name) AutoTemp() bool
    func (n *Name) Bounded() bool
    func (n *Name) Byval() bool
    func (*Name) CanBeAnSSAAux()
    func (*Name) CanBeAnSSASym()
    func (*Name) CanBeNtype()
    func (n *Name) Canonical() *Name
    func (n *Name) CoverageAuxVar() bool
    func (n *Name) CoverageCounter() bool
    func (n *Name) Format(s fmt.State, verb rune)
    func (n *Name) FrameOffset() int64
    func (n *Name) Init() Nodes
    func (n *Name) InlFormal() bool
    func (n *Name) InlLocal() bool
    func (n *Name) IsClosureVar() bool
    func (n *Name) IsOutputParamHeapAddr() bool
    func (n *Name) IsOutputParamInRegisters() bool
    func (n *Name) Libfuzzer8BitCounter() bool
    func (n *Name) Linksym() *obj.LSym
    func (n *Name) LinksymABI(abi obj.ABI) *obj.LSym
    func (n *Name) MarkNonNil()
    func (n *Name) MarkReadonly()
    func (n *Name) Name() *Name
    func (n *Name) Needzero() bool
    func (n *Name) NonNil() bool
    func (n *Name) OnStack() bool
    func (n *Name) OpenDeferSlot() bool
    func (n *Name) Pragma() PragmaFlag
    func (n *Name) PtrInit() *Nodes
    func (n *Name) Readonly() bool
    func (n *Name) RecordFrameOffset(offset int64)
    func (n *Name) SetAddrtaken(b bool)
    func (n *Name) SetAlias(alias bool)
    func (n *Name) SetAutoTemp(b bool)
    func (n *Name) SetBounded(b bool)
    func (n *Name) SetByval(b bool)
    func (n *Name) SetCoverageAuxVar(b bool)
    func (n *Name) SetCoverageCounter(b bool)
    func (n *Name) SetFrameOffset(x int64)
    func (n *Name) SetFunc(x *Func)
    func (n *Name) SetInit(x Nodes)
    func (n *Name) SetInlFormal(b bool)
    func (n *Name) SetInlLocal(b bool)
    func (n *Name) SetIsClosureVar(b bool)
    func (n *Name) SetIsOutputParamHeapAddr(b bool)
    func (n *Name) SetIsOutputParamInRegisters(b bool)
    func (n *Name) SetLibfuzzer8BitCounter(b bool)
    func (n *Name) SetNeedzero(b bool)
    func (n *Name) SetOpenDeferSlot(b bool)
    func (n *Name) SetPragma(flag PragmaFlag)
    func (n *Name) SetSubOp(x Op)
    func (n *Name) SetSym(x *types.Sym)
    func (n *Name) SetTransient(b bool)
    func (n *Name) SetType(x *types.Type)
    func (n *Name) SetUsed(b bool)
    func (n *Name) SetVal(v constant.Value)
    func (n *Name) SubOp() Op
    func (n *Name) Sym() *types.Sym
    func (n *Name) Transient() bool
    func (n *Name) Type() *types.Type
    func (n *Name) Used() bool
    func (n *Name) Val() constant.Value
type NameQueue
    func (q *NameQueue) Empty() bool
    func (q *NameQueue) PopLeft() *Name
    func (q *NameQueue) PushRight(n *Name)
type NameSet
    func (s *NameSet) Add(n *Name)
    func (s NameSet) Has(n *Name) bool
    func (s NameSet) Sorted(less func(*Name, *Name) bool) []*Name
type NilExpr
    func NewNilExpr(pos src.XPos, typ *types.Type) *NilExpr
    func (n *NilExpr) Bounded() bool
    func (n *NilExpr) Format(s fmt.State, verb rune)
    func (n *NilExpr) Init() Nodes
    func (n *NilExpr) MarkNonNil()
    func (n *NilExpr) NonNil() bool
    func (n *NilExpr) PtrInit() *Nodes
    func (n *NilExpr) SetBounded(b bool)
    func (n *NilExpr) SetInit(x Nodes)
    func (n *NilExpr) SetTransient(b bool)
    func (n *NilExpr) SetType(x *types.Type)
    func (n *NilExpr) Transient() bool
    func (n *NilExpr) Type() *types.Type
type Node
    func Copy(n Node) Node
    func DeepCopy(pos src.XPos, n Node) Node
    func DeepCopyList(pos src.XPos, list []Node) []Node
    func FuncPC(pos src.XPos, n Node, wantABI obj.ABI) Node
    func InitExpr(init []Node, expr Node) Node
    func NewBasicLit(pos src.XPos, typ *types.Type, val constant.Value) Node
    func NewBool(pos src.XPos, b bool) Node
    func NewConstExpr(val constant.Value, orig Node) Node
    func NewInt(pos src.XPos, v int64) Node
    func NewOne(pos src.XPos, typ *types.Type) Node
    func NewString(pos src.XPos, s string) Node
    func NewUintptr(pos src.XPos, v int64) Node
    func NewZero(pos src.XPos, typ *types.Type) Node
    func OuterValue(n Node) Node
    func ParamNames(ft *types.Type) []Node
    func StaticValue(n Node) Node
    func TypeNode(t *types.Type) Node
type Nodes
    func TakeInit(n Node) Nodes
    func ToNodes[T Node](s []T) Nodes
    func (n *Nodes) Append(a ...Node)
    func (n Nodes) Copy() Nodes
    func (l Nodes) Format(s fmt.State, verb rune)
    func (n *Nodes) Prepend(a ...Node)
    func (n *Nodes) Take() []Node
type Op
    func (o Op) Format(s fmt.State, verb rune)
    func (o Op) GoString() string
    func (op Op) IsCmp() bool
    func (o Op) IsSlice3() bool
    func (i Op) String() string
type Package
type ParenExpr
    func NewParenExpr(pos src.XPos, x Node) *ParenExpr
    func (n *ParenExpr) Bounded() bool
    func (n *ParenExpr) Format(s fmt.State, verb rune)
    func (n *ParenExpr) Implicit() bool
    func (n *ParenExpr) Init() Nodes
    func (n *ParenExpr) MarkNonNil()
    func (n *ParenExpr) NonNil() bool
    func (n *ParenExpr) PtrInit() *Nodes
    func (n *ParenExpr) SetBounded(b bool)
    func (n *ParenExpr) SetImplicit(b bool)
    func (n *ParenExpr) SetInit(x Nodes)
    func (n *ParenExpr) SetTransient(b bool)
    func (n *ParenExpr) SetType(x *types.Type)
    func (n *ParenExpr) Transient() bool
    func (n *ParenExpr) Type() *types.Type
type PragmaFlag
type RangeStmt
    func NewRangeStmt(pos src.XPos, key, value, x Node, body []Node, distinctVars bool) *RangeStmt
    func (n *RangeStmt) Format(s fmt.State, verb rune)
    func (n *RangeStmt) Init() Nodes
    func (n *RangeStmt) PtrInit() *Nodes
    func (n *RangeStmt) SetInit(x Nodes)
type ReassignOracle
    func (ro *ReassignOracle) Init(fn *Func)
    func (ro *ReassignOracle) Reassigned(n *Name) bool
    func (ro *ReassignOracle) StaticValue(n Node) Node
type ResultExpr
    func NewResultExpr(pos src.XPos, typ *types.Type, index int64) *ResultExpr
    func (n *ResultExpr) Bounded() bool
    func (n *ResultExpr) Format(s fmt.State, verb rune)
    func (n *ResultExpr) Init() Nodes
    func (n *ResultExpr) MarkNonNil()
    func (n *ResultExpr) NonNil() bool
    func (n *ResultExpr) PtrInit() *Nodes
    func (n *ResultExpr) SetBounded(b bool)
    func (n *ResultExpr) SetInit(x Nodes)
    func (n *ResultExpr) SetTransient(b bool)
    func (n *ResultExpr) SetType(x *types.Type)
    func (n *ResultExpr) Transient() bool
    func (n *ResultExpr) Type() *types.Type
type ReturnStmt
    func NewReturnStmt(pos src.XPos, results []Node) *ReturnStmt
    func (n *ReturnStmt) Format(s fmt.State, verb rune)
    func (n *ReturnStmt) Init() Nodes
    func (n *ReturnStmt) PtrInit() *Nodes
    func (n *ReturnStmt) SetInit(x Nodes)
type ScopeID
type SelectStmt
    func NewSelectStmt(pos src.XPos, cases []*CommClause) *SelectStmt
    func (n *SelectStmt) Format(s fmt.State, verb rune)
    func (n *SelectStmt) Init() Nodes
    func (n *SelectStmt) PtrInit() *Nodes
    func (n *SelectStmt) SetInit(x Nodes)
type SelectorExpr
    func NewSelectorExpr(pos src.XPos, op Op, x Node, sel *types.Sym) *SelectorExpr
    func (n *SelectorExpr) Bounded() bool
    func (n *SelectorExpr) Format(s fmt.State, verb rune)
    func (n *SelectorExpr) FuncName() *Name
    func (n *SelectorExpr) Implicit() bool
    func (n *SelectorExpr) Init() Nodes
    func (n *SelectorExpr) MarkNonNil()
    func (n *SelectorExpr) NonNil() bool
    func (n *SelectorExpr) Offset() int64
    func (n *SelectorExpr) PtrInit() *Nodes
    func (n *SelectorExpr) SetBounded(b bool)
    func (n *SelectorExpr) SetImplicit(b bool)
    func (n *SelectorExpr) SetInit(x Nodes)
    func (n *SelectorExpr) SetOp(op Op)
    func (n *SelectorExpr) SetTransient(b bool)
    func (n *SelectorExpr) SetType(x *types.Type)
    func (n *SelectorExpr) Sym() *types.Sym
    func (n *SelectorExpr) Transient() bool
    func (n *SelectorExpr) Type() *types.Type
type SendStmt
    func NewSendStmt(pos src.XPos, ch, value Node) *SendStmt
    func (n *SendStmt) Format(s fmt.State, verb rune)
    func (n *SendStmt) Init() Nodes
    func (n *SendStmt) PtrInit() *Nodes
    func (n *SendStmt) SetInit(x Nodes)
type SliceExpr
    func NewSliceExpr(pos src.XPos, op Op, x, low, high, max Node) *SliceExpr
    func (n *SliceExpr) Bounded() bool
    func (n *SliceExpr) Format(s fmt.State, verb rune)
    func (n *SliceExpr) Init() Nodes
    func (n *SliceExpr) MarkNonNil()
    func (n *SliceExpr) NonNil() bool
    func (n *SliceExpr) PtrInit() *Nodes
    func (n *SliceExpr) SetBounded(b bool)
    func (n *SliceExpr) SetInit(x Nodes)
    func (n *SliceExpr) SetOp(op Op)
    func (n *SliceExpr) SetTransient(b bool)
    func (n *SliceExpr) SetType(x *types.Type)
    func (n *SliceExpr) Transient() bool
    func (n *SliceExpr) Type() *types.Type
type SliceHeaderExpr
    func NewSliceHeaderExpr(pos src.XPos, typ *types.Type, ptr, len, cap Node) *SliceHeaderExpr
    func (n *SliceHeaderExpr) Bounded() bool
    func (n *SliceHeaderExpr) Format(s fmt.State, verb rune)
    func (n *SliceHeaderExpr) Init() Nodes
    func (n *SliceHeaderExpr) MarkNonNil()
    func (n *SliceHeaderExpr) NonNil() bool
    func (n *SliceHeaderExpr) PtrInit() *Nodes
    func (n *SliceHeaderExpr) SetBounded(b bool)
    func (n *SliceHeaderExpr) SetInit(x Nodes)
    func (n *SliceHeaderExpr) SetTransient(b bool)
    func (n *SliceHeaderExpr) SetType(x *types.Type)
    func (n *SliceHeaderExpr) Transient() bool
    func (n *SliceHeaderExpr) Type() *types.Type
type StarExpr
    func NewStarExpr(pos src.XPos, x Node) *StarExpr
    func (n *StarExpr) Bounded() bool
    func (n *StarExpr) Format(s fmt.State, verb rune)
    func (n *StarExpr) Implicit() bool
    func (n *StarExpr) Init() Nodes
    func (n *StarExpr) MarkNonNil()
    func (n *StarExpr) NonNil() bool
    func (n *StarExpr) PtrInit() *Nodes
    func (n *StarExpr) SetBounded(b bool)
    func (n *StarExpr) SetImplicit(b bool)
    func (n *StarExpr) SetInit(x Nodes)
    func (n *StarExpr) SetTransient(b bool)
    func (n *StarExpr) SetType(x *types.Type)
    func (n *StarExpr) Transient() bool
    func (n *StarExpr) Type() *types.Type
type Stmt
type StringHeaderExpr
    func NewStringHeaderExpr(pos src.XPos, ptr, len Node) *StringHeaderExpr
    func (n *StringHeaderExpr) Bounded() bool
    func (n *StringHeaderExpr) Format(s fmt.State, verb rune)
    func (n *StringHeaderExpr) Init() Nodes
    func (n *StringHeaderExpr) MarkNonNil()
    func (n *StringHeaderExpr) NonNil() bool
    func (n *StringHeaderExpr) PtrInit() *Nodes
    func (n *StringHeaderExpr) SetBounded(b bool)
    func (n *StringHeaderExpr) SetInit(x Nodes)
    func (n *StringHeaderExpr) SetTransient(b bool)
    func (n *StringHeaderExpr) SetType(x *types.Type)
    func (n *StringHeaderExpr) Transient() bool
    func (n *StringHeaderExpr) Type() *types.Type
type StructKeyExpr
    func NewStructKeyExpr(pos src.XPos, field *types.Field, value Node) *StructKeyExpr
    func (n *StructKeyExpr) Bounded() bool
    func (n *StructKeyExpr) Format(s fmt.State, verb rune)
    func (n *StructKeyExpr) Init() Nodes
    func (n *StructKeyExpr) MarkNonNil()
    func (n *StructKeyExpr) NonNil() bool
    func (n *StructKeyExpr) PtrInit() *Nodes
    func (n *StructKeyExpr) SetBounded(b bool)
    func (n *StructKeyExpr) SetInit(x Nodes)
    func (n *StructKeyExpr) SetTransient(b bool)
    func (n *StructKeyExpr) SetType(x *types.Type)
    func (n *StructKeyExpr) Sym() *types.Sym
    func (n *StructKeyExpr) Transient() bool
    func (n *StructKeyExpr) Type() *types.Type
type SwitchStmt
    func NewSwitchStmt(pos src.XPos, tag Node, cases []*CaseClause) *SwitchStmt
    func (n *SwitchStmt) Format(s fmt.State, verb rune)
    func (n *SwitchStmt) Init() Nodes
    func (n *SwitchStmt) PtrInit() *Nodes
    func (n *SwitchStmt) SetInit(x Nodes)
type SymAndPos
type TailCallStmt
    func NewTailCallStmt(pos src.XPos, call *CallExpr) *TailCallStmt
    func (n *TailCallStmt) Format(s fmt.State, verb rune)
    func (n *TailCallStmt) Init() Nodes
    func (n *TailCallStmt) PtrInit() *Nodes
    func (n *TailCallStmt) SetInit(x Nodes)
type TypeAssertExpr
    func NewTypeAssertExpr(pos src.XPos, x Node, typ *types.Type) *TypeAssertExpr
    func (n *TypeAssertExpr) Bounded() bool
    func (n *TypeAssertExpr) Format(s fmt.State, verb rune)
    func (n *TypeAssertExpr) Init() Nodes
    func (n *TypeAssertExpr) MarkNonNil()
    func (n *TypeAssertExpr) NonNil() bool
    func (n *TypeAssertExpr) PtrInit() *Nodes
    func (n *TypeAssertExpr) SetBounded(b bool)
    func (n *TypeAssertExpr) SetInit(x Nodes)
    func (n *TypeAssertExpr) SetOp(op Op)
    func (n *TypeAssertExpr) SetTransient(b bool)
    func (n *TypeAssertExpr) SetType(x *types.Type)
    func (n *TypeAssertExpr) Transient() bool
    func (n *TypeAssertExpr) Type() *types.Type
type TypeSwitchGuard
    func NewTypeSwitchGuard(pos src.XPos, tag *Ident, x Node) *TypeSwitchGuard
    func (n *TypeSwitchGuard) Esc() uint16
    func (n *TypeSwitchGuard) Format(s fmt.State, verb rune)
    func (n *TypeSwitchGuard) Init() Nodes
    func (n *TypeSwitchGuard) MarkNonNil()
    func (n *TypeSwitchGuard) Name() *Name
    func (n *TypeSwitchGuard) NonNil() bool
    func (n *TypeSwitchGuard) Op() Op
    func (n *TypeSwitchGuard) Pos() src.XPos
    func (n *TypeSwitchGuard) SetEsc(x uint16)
    func (n *TypeSwitchGuard) SetPos(x src.XPos)
    func (n *TypeSwitchGuard) SetType(*types.Type)
    func (n *TypeSwitchGuard) SetTypecheck(x uint8)
    func (n *TypeSwitchGuard) SetVal(v constant.Value)
    func (n *TypeSwitchGuard) SetWalked(x bool)
    func (n *TypeSwitchGuard) Sym() *types.Sym
    func (n *TypeSwitchGuard) Type() *types.Type
    func (n *TypeSwitchGuard) Typecheck() uint8
    func (n *TypeSwitchGuard) Val() constant.Value
    func (n *TypeSwitchGuard) Walked() bool
type UnaryExpr
    func NewUnaryExpr(pos src.XPos, op Op, x Node) *UnaryExpr
    func (n *UnaryExpr) Bounded() bool
    func (n *UnaryExpr) Format(s fmt.State, verb rune)
    func (n *UnaryExpr) Init() Nodes
    func (n *UnaryExpr) MarkNonNil()
    func (n *UnaryExpr) NonNil() bool
    func (n *UnaryExpr) PtrInit() *Nodes
    func (n *UnaryExpr) SetBounded(b bool)
    func (n *UnaryExpr) SetInit(x Nodes)
    func (n *UnaryExpr) SetOp(op Op)
    func (n *UnaryExpr) SetTransient(b bool)
    func (n *UnaryExpr) SetType(x *types.Type)
    func (n *UnaryExpr) Transient() bool
    func (n *UnaryExpr) Type() *types.Type
type WasmImport
Bugs

Package files

abi.go bitset.go cfg.go check_reassign_no.go class_string.go const.go copy.go dump.go expr.go fmt.go func.go ir.go mini.go name.go node.go node_gen.go op_string.go package.go reassign_consistency_check.go reassignment.go scc.go stmt.go symtab.go type.go val.go visit.go

Constants

const (
    EscUnknown = iota
    EscNone    // Does not escape to heap, result, or parameters.
    EscHeap    // Reachable from the heap
    EscNever   // By construction will not escape.
)
const (
    // Maximum size in bits for big.Ints before signaling
    // overflow and also mantissa precision for big.Floats.
    ConstPrec = 512
)

Variables

var (
    // MaxStackVarSize is the maximum size variable which we will allocate on the stack.
    // This limit is for explicit variable declarations like "var x T" or "x := ...".
    // Note: the flag smallframes can update this value.
    MaxStackVarSize = int64(10 * 1024 * 1024)

    // MaxImplicitStackVarSize is the maximum size of implicit variables that we will allocate on the stack.
    //   p := new(T)          allocating T on the stack
    //   p := &T{}            allocating T on the stack
    //   s := make([]T, n)    allocating [n]T on the stack
    //   s := []byte("...")   allocating [n]byte on the stack
    // Note: the flag smallframes can update this value.
    MaxImplicitStackVarSize = int64(64 * 1024)

    // MaxSmallArraySize is the maximum size of an array which is considered small.
    // Small arrays will be initialized directly with a sequence of constant stores.
    // Large arrays will be initialized by copying from a static temp.
    // 256 bytes was chosen to minimize generated code + statictmp size.
    MaxSmallArraySize = int64(256)
)

EscFmt is set by the escape analysis code to add escape analysis details to the node print.

var EscFmt func(n Node) string

IsIntrinsicCall reports whether the compiler back end will treat the call as an intrinsic operation.

var IsIntrinsicCall = func(*CallExpr) bool { return false }
var OKForConst [types.NTYPE]bool
var OpNames = []string{
    OADDR:             "&",
    OADD:              "+",
    OADDSTR:           "+",
    OANDAND:           "&&",
    OANDNOT:           "&^",
    OAND:              "&",
    OAPPEND:           "append",
    OAS:               "=",
    OAS2:              "=",
    OBREAK:            "break",
    OCALL:             "function call",
    OCAP:              "cap",
    OCASE:             "case",
    OCLEAR:            "clear",
    OCLOSE:            "close",
    OCOMPLEX:          "complex",
    OBITNOT:           "^",
    OCONTINUE:         "continue",
    OCOPY:             "copy",
    ODELETE:           "delete",
    ODEFER:            "defer",
    ODIV:              "/",
    OEQ:               "==",
    OFALL:             "fallthrough",
    OFOR:              "for",
    OGE:               ">=",
    OGOTO:             "goto",
    OGT:               ">",
    OIF:               "if",
    OIMAG:             "imag",
    OINLMARK:          "inlmark",
    ODEREF:            "*",
    OLEN:              "len",
    OLE:               "<=",
    OLSH:              "<<",
    OLT:               "<",
    OMAKE:             "make",
    ONEG:              "-",
    OMAX:              "max",
    OMIN:              "min",
    OMOD:              "%",
    OMUL:              "*",
    ONEW:              "new",
    ONE:               "!=",
    ONOT:              "!",
    OOROR:             "||",
    OOR:               "|",
    OPANIC:            "panic",
    OPLUS:             "+",
    OPRINTLN:          "println",
    OPRINT:            "print",
    ORANGE:            "range",
    OREAL:             "real",
    ORECV:             "<-",
    ORECOVER:          "recover",
    ORETURN:           "return",
    ORSH:              ">>",
    OSELECT:           "select",
    OSEND:             "<-",
    OSUB:              "-",
    OSWITCH:           "switch",
    OUNSAFEADD:        "unsafe.Add",
    OUNSAFESLICE:      "unsafe.Slice",
    OUNSAFESLICEDATA:  "unsafe.SliceData",
    OUNSAFESTRING:     "unsafe.String",
    OUNSAFESTRINGDATA: "unsafe.StringData",
    OXOR:              "^",
}
var OpPrec = []int{
    OAPPEND:           8,
    OBYTES2STR:        8,
    OARRAYLIT:         8,
    OSLICELIT:         8,
    ORUNES2STR:        8,
    OCALLFUNC:         8,
    OCALLINTER:        8,
    OCALLMETH:         8,
    OCALL:             8,
    OCAP:              8,
    OCLEAR:            8,
    OCLOSE:            8,
    OCOMPLIT:          8,
    OCONVIFACE:        8,
    OCONVNOP:          8,
    OCONV:             8,
    OCOPY:             8,
    ODELETE:           8,
    OGETG:             8,
    OLEN:              8,
    OLITERAL:          8,
    OMAKESLICE:        8,
    OMAKESLICECOPY:    8,
    OMAKE:             8,
    OMAPLIT:           8,
    OMAX:              8,
    OMIN:              8,
    ONAME:             8,
    ONEW:              8,
    ONIL:              8,
    ONONAME:           8,
    OPANIC:            8,
    OPAREN:            8,
    OPRINTLN:          8,
    OPRINT:            8,
    ORUNESTR:          8,
    OSLICE2ARR:        8,
    OSLICE2ARRPTR:     8,
    OSTR2BYTES:        8,
    OSTR2RUNES:        8,
    OSTRUCTLIT:        8,
    OTYPE:             8,
    OUNSAFEADD:        8,
    OUNSAFESLICE:      8,
    OUNSAFESLICEDATA:  8,
    OUNSAFESTRING:     8,
    OUNSAFESTRINGDATA: 8,
    OINDEXMAP:         8,
    OINDEX:            8,
    OSLICE:            8,
    OSLICESTR:         8,
    OSLICEARR:         8,
    OSLICE3:           8,
    OSLICE3ARR:        8,
    OSLICEHEADER:      8,
    OSTRINGHEADER:     8,
    ODOTINTER:         8,
    ODOTMETH:          8,
    ODOTPTR:           8,
    ODOTTYPE2:         8,
    ODOTTYPE:          8,
    ODOT:              8,
    OXDOT:             8,
    OMETHVALUE:        8,
    OMETHEXPR:         8,
    OPLUS:             7,
    ONOT:              7,
    OBITNOT:           7,
    ONEG:              7,
    OADDR:             7,
    ODEREF:            7,
    ORECV:             7,
    OMUL:              6,
    ODIV:              6,
    OMOD:              6,
    OLSH:              6,
    ORSH:              6,
    OAND:              6,
    OANDNOT:           6,
    OADD:              5,
    OSUB:              5,
    OOR:               5,
    OXOR:              5,
    OEQ:               4,
    OLT:               4,
    OLE:               4,
    OGE:               4,
    OGT:               4,
    ONE:               4,
    OSEND:             3,
    OANDAND:           2,
    OOROR:             1,

    OAS:         -1,
    OAS2:        -1,
    OAS2DOTTYPE: -1,
    OAS2FUNC:    -1,
    OAS2MAPR:    -1,
    OAS2RECV:    -1,
    OASOP:       -1,
    OBLOCK:      -1,
    OBREAK:      -1,
    OCASE:       -1,
    OCONTINUE:   -1,
    ODCL:        -1,
    ODEFER:      -1,
    OFALL:       -1,
    OFOR:        -1,
    OGOTO:       -1,
    OIF:         -1,
    OLABEL:      -1,
    OGO:         -1,
    ORANGE:      -1,
    ORETURN:     -1,
    OSELECT:     -1,
    OSWITCH:     -1,

    OEND: 0,
}

Pkgs holds known packages.

var Pkgs struct {
    Go       *types.Pkg
    Itab     *types.Pkg
    Runtime  *types.Pkg
    Coverage *types.Pkg
}

Syms holds known symbols.

var Syms symsStruct

func Any

func Any(n Node, cond func(Node) bool) bool

Any looks for a non-nil node x in the IR tree rooted at n for which cond(x) returns true. Any considers nodes in a depth-first, preorder traversal. When Any finds a node x such that cond(x) is true, Any ends the traversal and returns true immediately. Otherwise Any returns false after completing the entire traversal.

func AnyList

func AnyList(list Nodes, cond func(Node) bool) bool

AnyList calls Any(x, cond) for each node x in the list, in order. If any call returns true, AnyList stops and returns true. Otherwise, AnyList returns false after calling Any(x, cond) for every x in the list.

func AssertValidTypeForConst

func AssertValidTypeForConst(t *types.Type, v constant.Value)

func BigFloat

func BigFloat(v constant.Value) *big.Float

func BoolVal

func BoolVal(n Node) bool

BoolVal returns n as a bool. n must be a boolean constant.

func ClosureDebugRuntimeCheck

func ClosureDebugRuntimeCheck(clo *ClosureExpr)

ClosureDebugRuntimeCheck applies boilerplate checks for debug flags and compiling runtime.

func ConstOverflow

func ConstOverflow(v constant.Value, t *types.Type) bool

ConstOverflow reports whether constant value v is too large to represent with type t.

func ConstType

func ConstType(n Node) constant.Kind

func DeclaredBy

func DeclaredBy(x, stmt Node) bool

DeclaredBy reports whether expression x refers (directly) to a variable that was declared by the given statement.

func DoChildren

func DoChildren(n Node, do func(Node) bool) bool

DoChildren calls do(x) on each of n's non-nil child nodes x. If any call returns true, DoChildren stops and returns true. Otherwise, DoChildren returns false.

Note that DoChildren(n, do) only calls do(x) for n's immediate children. If x's children should be processed, then do(x) must call DoChildren(x, do).

DoChildren allows constructing general traversals of the IR graph that can stop early if needed. The most general usage is:

var do func(ir.Node) bool
do = func(x ir.Node) bool {
	... processing BEFORE visiting children ...
	if ... should visit children ... {
		ir.DoChildren(x, do)
		... processing AFTER visiting children ...
	}
	if ... should stop parent DoChildren call from visiting siblings ... {
		return true
	}
	return false
}
do(root)

Since DoChildren does not return true itself, if the do function never wants to stop the traversal, it can assume that DoChildren itself will always return false, simplifying to:

var do func(ir.Node) bool
do = func(x ir.Node) bool {
	... processing BEFORE visiting children ...
	if ... should visit children ... {
		ir.DoChildren(x, do)
	}
	... processing AFTER visiting children ...
	return false
}
do(root)

The Visit function illustrates a further simplification of the pattern, only processing before visiting children and never stopping:

func Visit(n ir.Node, visit func(ir.Node)) {
	if n == nil {
		return
	}
	var do func(ir.Node) bool
	do = func(x ir.Node) bool {
		visit(x)
		return ir.DoChildren(x, do)
	}
	do(n)
}

The Any function illustrates a different simplification of the pattern, visiting each node and then its children, recursively, until finding a node x for which cond(x) returns true, at which point the entire traversal stops and returns true.

func Any(n ir.Node, cond(ir.Node) bool) bool {
	if n == nil {
		return false
	}
	var do func(ir.Node) bool
	do = func(x ir.Node) bool {
		return cond(x) || ir.DoChildren(x, do)
	}
	return do(n)
}

Visit and Any are presented above as examples of how to use DoChildren effectively, but of course, usage that fits within the simplifications captured by Visit or Any will be best served by directly calling the ones provided by this package.

func Dump

func Dump(s string, n Node)

Dump prints the message s followed by a debug dump of n.

func DumpAny

func DumpAny(root interface{}, filter string, depth int)

DumpAny is like FDumpAny but prints to stderr.

func DumpList

func DumpList(s string, list Nodes)

DumpList prints the message s followed by a debug dump of each node in the list.

func EditChildren

func EditChildren(n Node, edit func(Node) Node)

EditChildren edits the child nodes of n, replacing each child x with edit(x).

Note that EditChildren(n, edit) only calls edit(x) for n's immediate children. If x's children should be processed, then edit(x) must call EditChildren(x, edit).

EditChildren allows constructing general editing passes of the IR graph. The most general usage is:

var edit func(ir.Node) ir.Node
edit = func(x ir.Node) ir.Node {
	... processing BEFORE editing children ...
	if ... should edit children ... {
		EditChildren(x, edit)
		... processing AFTER editing children ...
	}
	... return x ...
}
n = edit(n)

EditChildren edits the node in place. To edit a copy, call Copy first. As an example, a simple deep copy implementation would be:

func deepCopy(n ir.Node) ir.Node {
	var edit func(ir.Node) ir.Node
	edit = func(x ir.Node) ir.Node {
		x = ir.Copy(x)
		ir.EditChildren(x, edit)
		return x
	}
	return edit(n)
}

Of course, in this case it is better to call ir.DeepCopy than to build one anew.

func EditChildrenWithHidden

func EditChildrenWithHidden(n Node, edit func(Node) Node)

EditChildrenWithHidden is like EditChildren, but also edits Node-typed fields tagged with `mknode:"-"`.

TODO(mdempsky): Remove the `mknode:"-"` tags so this function can go away.

func FDumpAny

func FDumpAny(w io.Writer, root interface{}, filter string, depth int)

FDumpAny prints the structure of a rooted data structure to w by depth-first traversal of the data structure.

The filter parameter is a regular expression. If it is non-empty, only struct fields whose names match filter are printed.

The depth parameter controls how deep traversal recurses before it returns (higher value means greater depth). If an empty field filter is given, a good depth default value is 4. A negative depth means no depth limit, which may be fine for small data structures or if there is a non-empty filter.

In the output, Node structs are identified by their Op name rather than their type; struct fields with zero values or non-matching field names are omitted, and "…" means recursion depth has been reached or struct fields have been omitted.

func FDumpList

func FDumpList(w io.Writer, s string, list Nodes)

FDumpList prints to w the message s followed by a debug dump of each node in the list.

func FuncName

func FuncName(f *Func) string

FuncName returns the name (without the package) of the function f.

func FuncSymName

func FuncSymName(s *types.Sym) string

func HasUniquePos

func HasUniquePos(n Node) bool

HasUniquePos reports whether n has a unique position that can be used for reporting error messages.

It's primarily used to distinguish references to named objects, whose Pos will point back to their declaration position rather than their usage position.

func InitLSym

func InitLSym(f *Func, hasBody bool)

InitLSym defines f's obj.LSym and initializes it based on the properties of f. This includes setting the symbol flags and ABI and creating and initializing related DWARF symbols.

InitLSym must be called exactly once per function and must be called for both functions with bodies and functions without bodies. For body-less functions, we only create the LSym; for functions with bodies call a helper to setup up / populate the LSym.

func Int64Val

func Int64Val(n Node) int64

Int64Val returns n as an int64. n must be an integer or rune constant.

func IntVal

func IntVal(t *types.Type, v constant.Value) int64

IntVal returns v converted to int64. Note: if t is uint64, very large values will be converted to negative int64.

func IsAddressable

func IsAddressable(n Node) bool

lvalue etc

func IsAutoTmp

func IsAutoTmp(n Node) bool

IsAutoTmp indicates if n was created by the compiler as a temporary, based on the setting of the .AutoTemp flag in n's Name.

func IsBlank

func IsBlank(n Node) bool

func IsConst

func IsConst(n Node, ct constant.Kind) bool

func IsConstNode

func IsConstNode(n Node) bool

IsConstNode reports whether n is a Go language constant (as opposed to a compile-time constant).

Expressions derived from nil, like string([]byte(nil)), while they may be known at compile time, are not Go language constants.

func IsFuncPCIntrinsic

func IsFuncPCIntrinsic(n *CallExpr) bool

IsFuncPCIntrinsic returns whether n is a direct call of internal/abi.FuncPCABIxxx functions.

func IsMethod

func IsMethod(n Node) bool

IsMethod reports whether n is a method. n must be a function or a method.

func IsNil

func IsNil(n Node) bool

IsNil reports whether n represents the universal untyped zero value "nil".

func IsReflectHeaderDataField

func IsReflectHeaderDataField(l Node) bool

IsReflectHeaderDataField reports whether l is an expression p.Data where p has type reflect.SliceHeader or reflect.StringHeader.

func IsSmallIntConst

func IsSmallIntConst(n Node) bool

func IsSynthetic

func IsSynthetic(n Node) bool

func IsTrivialClosure

func IsTrivialClosure(clo *ClosureExpr) bool

IsTrivialClosure reports whether closure clo has an empty list of captured vars.

func IsZero

func IsZero(n Node) bool

func Line

func Line(n Node) string

Line returns n's position as a string. If n has been inlined, it uses the outermost position where n has been inlined.

func LinkFuncName

func LinkFuncName(f *Func) string

LinkFuncName returns the name of the function f, as it will appear in the symbol table of the final linked binary.

func LookupMethodSelector

func LookupMethodSelector(pkg *types.Pkg, name string) (typ, meth *types.Sym, err error)

LookupMethodSelector returns the types.Sym of the selector for a method named in local symbol name, as well as the types.Sym of the receiver.

TODO(prattmic): this does not attempt to handle method suffixes (wrappers).

func MayBeShared

func MayBeShared(n Node) bool

MayBeShared reports whether n may occur in multiple places in the AST. Extra care must be taken when mutating such a node.

func MethodExprFunc

func MethodExprFunc(n Node) *types.Field

MethodExprFunc is like MethodExprName, but returns the types.Field instead.

func MethodSym

func MethodSym(recv *types.Type, msym *types.Sym) *types.Sym

MethodSym returns the method symbol representing a method name associated with a specific receiver type.

Method symbols can be used to distinguish the same method appearing in different method sets. For example, T.M and (*T).M have distinct method symbols.

The returned symbol will be marked as a function.

func MethodSymSuffix

func MethodSymSuffix(recv *types.Type, msym *types.Sym, suffix string) *types.Sym

MethodSymSuffix is like MethodSym, but allows attaching a distinguisher suffix. To avoid collisions, the suffix must not start with a letter, number, or period.

func ParseLinkFuncName

func ParseLinkFuncName(name string) (pkg, sym string, err error)

ParseLinkFuncName parsers a symbol name (as returned from LinkFuncName) back to the package path and local symbol name.

func PkgFuncName

func PkgFuncName(f *Func) string

PkgFuncName returns the name of the function referenced by f, with package prepended.

This differs from the compiler's internal convention where local functions lack a package. This is primarily useful when the ultimate consumer of this is a human looking at message.

func Reassigned

func Reassigned(name *Name) bool

Reassigned takes an ONAME node, walks the function in which it is defined, and returns a boolean indicating whether the name has any assignments other than its declaration. NB: global variables are always considered to be re-assigned. TODO: handle initial declaration not including an assignment and followed by a single assignment? NOTE: any changes made here should also be made in the corresponding code in the ReassignOracle.Init method.

func SameSafeExpr

func SameSafeExpr(l Node, r Node) bool

SameSafeExpr checks whether it is safe to reuse one of l and r instead of computing both. SameSafeExpr assumes that l and r are used in the same statement or expression. In order for it to be safe to reuse l or r, they must:

The handling of OINDEXMAP is subtle. OINDEXMAP can occur both as an lvalue (map assignment) and an rvalue (map access). This is currently OK, since the only place SameSafeExpr gets used on an lvalue expression is for OSLICE and OAPPEND optimizations, and it is correct in those settings.

func SameSource

func SameSource(n1, n2 Node) bool

SameSource reports whether two nodes refer to the same source element.

It exists to help incrementally migrate the compiler towards allowing the introduction of IdentExpr (#42990). Once we have IdentExpr, it will no longer be safe to directly compare Node values to tell if they refer to the same Name. Instead, code will need to explicitly get references to the underlying Name object(s), and compare those instead.

It will still be safe to compare Nodes directly for checking if two nodes are syntactically the same. The SameSource function exists to indicate code that intentionally compares Nodes for syntactic equality as opposed to code that has yet to be updated in preparation for IdentExpr.

func SetPos

func SetPos(n Node) src.XPos

func ShouldAsanCheckPtr

func ShouldAsanCheckPtr(fn *Func) bool

ShouldAsanCheckPtr reports whether pointer checking should be enabled for function fn when -asan is enabled.

func ShouldCheckPtr

func ShouldCheckPtr(fn *Func, level int) bool

ShouldCheckPtr reports whether pointer checking should be enabled for function fn at a given level. See debugHelpFooter for defined levels.

func StmtWithInit

func StmtWithInit(op Op) bool

StmtWithInit reports whether op is a statement with an explicit init list.

func StringVal

func StringVal(n Node) string

StringVal returns the value of a literal string Node as a string. n must be a string constant.

func Uint64Val

func Uint64Val(n Node) uint64

Uint64Val returns n as a uint64. n must be an integer or rune constant.

func Uses

func Uses(x Node, v *Name) bool

Uses reports whether expression x is a (direct) use of the given variable.

func ValidTypeForConst

func ValidTypeForConst(t *types.Type, v constant.Value) bool

func Visit

func Visit(n Node, visit func(Node))

Visit visits each non-nil node x in the IR tree rooted at n in a depth-first preorder traversal, calling visit on each node visited.

func VisitFuncAndClosures

func VisitFuncAndClosures(fn *Func, visit func(n Node))

VisitFuncAndClosures calls visit on each non-nil node in fn.Body, including any nested closure bodies.

func VisitFuncsBottomUp

func VisitFuncsBottomUp(list []*Func, analyze func(list []*Func, recursive bool))

VisitFuncsBottomUp invokes analyze on the ODCLFUNC nodes listed in list. It calls analyze with successive groups of functions, working from the bottom of the call graph upward. Each time analyze is called with a list of functions, every function on that list only calls other functions on the list or functions that have been passed in previous invocations of analyze. Closures appear in the same list as their outer functions. The lists are as short as possible while preserving those requirements. (In a typical program, many invocations of analyze will be passed just a single function.) The boolean argument 'recursive' passed to analyze specifies whether the functions on the list are mutually recursive. If recursive is false, the list consists of only a single function and its closures. If recursive is true, the list may still contain only a single function, if that function is itself recursive.

func VisitList

func VisitList(list Nodes, visit func(Node))

VisitList calls Visit(x, visit) for each node x in the list.

func WithFunc

func WithFunc(curfn *Func, do func())

WithFunc invokes do with CurFunc and base.Pos set to curfn and curfn.Pos(), respectively, and then restores their previous values before returning.

type AddStringExpr

An AddStringExpr is a string concatenation List[0] + List[1] + ... + List[len(List)-1].

type AddStringExpr struct {
    List     Nodes
    Prealloc *Name
    // contains filtered or unexported fields
}

func NewAddStringExpr

func NewAddStringExpr(pos src.XPos, list []Node) *AddStringExpr

func (*AddStringExpr) Bounded

func (n *AddStringExpr) Bounded() bool

func (*AddStringExpr) Format

func (n *AddStringExpr) Format(s fmt.State, verb rune)

func (*AddStringExpr) Init

func (n *AddStringExpr) Init() Nodes

func (*AddStringExpr) MarkNonNil

func (n *AddStringExpr) MarkNonNil()

func (*AddStringExpr) NonNil

func (n *AddStringExpr) NonNil() bool

func (*AddStringExpr) PtrInit

func (n *AddStringExpr) PtrInit() *Nodes

func (*AddStringExpr) SetBounded

func (n *AddStringExpr) SetBounded(b bool)

func (*AddStringExpr) SetInit

func (n *AddStringExpr) SetInit(x Nodes)

func (*AddStringExpr) SetTransient

func (n *AddStringExpr) SetTransient(b bool)

func (*AddStringExpr) SetType

func (n *AddStringExpr) SetType(x *types.Type)

func (*AddStringExpr) Transient

func (n *AddStringExpr) Transient() bool

func (*AddStringExpr) Type

func (n *AddStringExpr) Type() *types.Type

type AddrExpr

An AddrExpr is an address-of expression &X. It may end up being a normal address-of or an allocation of a composite literal.

type AddrExpr struct {
    X        Node
    Prealloc *Name // preallocated storage if any
    // contains filtered or unexported fields
}

func NewAddrExpr

func NewAddrExpr(pos src.XPos, x Node) *AddrExpr

func (*AddrExpr) Bounded

func (n *AddrExpr) Bounded() bool

func (*AddrExpr) Format

func (n *AddrExpr) Format(s fmt.State, verb rune)

func (*AddrExpr) Implicit

func (n *AddrExpr) Implicit() bool

func (*AddrExpr) Init

func (n *AddrExpr) Init() Nodes

func (*AddrExpr) MarkNonNil

func (n *AddrExpr) MarkNonNil()

func (*AddrExpr) NonNil

func (n *AddrExpr) NonNil() bool

func (*AddrExpr) PtrInit

func (n *AddrExpr) PtrInit() *Nodes

func (*AddrExpr) SetBounded

func (n *AddrExpr) SetBounded(b bool)

func (*AddrExpr) SetImplicit

func (n *AddrExpr) SetImplicit(b bool)

func (*AddrExpr) SetInit

func (n *AddrExpr) SetInit(x Nodes)

func (*AddrExpr) SetOp

func (n *AddrExpr) SetOp(op Op)

func (*AddrExpr) SetTransient

func (n *AddrExpr) SetTransient(b bool)

func (*AddrExpr) SetType

func (n *AddrExpr) SetType(x *types.Type)

func (*AddrExpr) Transient

func (n *AddrExpr) Transient() bool

func (*AddrExpr) Type

func (n *AddrExpr) Type() *types.Type

type AssignListStmt

An AssignListStmt is an assignment statement with more than one item on at least one side: Lhs = Rhs. If Def is true, the assignment is a :=.

type AssignListStmt struct {
    Lhs Nodes
    Def bool
    Rhs Nodes
    // contains filtered or unexported fields
}

func NewAssignListStmt

func NewAssignListStmt(pos src.XPos, op Op, lhs, rhs []Node) *AssignListStmt

func (*AssignListStmt) Format

func (n *AssignListStmt) Format(s fmt.State, verb rune)

func (*AssignListStmt) Init

func (n *AssignListStmt) Init() Nodes

func (*AssignListStmt) PtrInit

func (n *AssignListStmt) PtrInit() *Nodes

func (*AssignListStmt) SetInit

func (n *AssignListStmt) SetInit(x Nodes)

func (*AssignListStmt) SetOp

func (n *AssignListStmt) SetOp(op Op)

type AssignOpStmt

An AssignOpStmt is an AsOp= assignment statement: X AsOp= Y.

type AssignOpStmt struct {
    X      Node
    AsOp   Op // OADD etc
    Y      Node
    IncDec bool // actually ++ or --
    // contains filtered or unexported fields
}

func NewAssignOpStmt

func NewAssignOpStmt(pos src.XPos, asOp Op, x, y Node) *AssignOpStmt

func (*AssignOpStmt) Format

func (n *AssignOpStmt) Format(s fmt.State, verb rune)

func (*AssignOpStmt) Init

func (n *AssignOpStmt) Init() Nodes

func (*AssignOpStmt) PtrInit

func (n *AssignOpStmt) PtrInit() *Nodes

func (*AssignOpStmt) SetInit

func (n *AssignOpStmt) SetInit(x Nodes)

type AssignStmt

An AssignStmt is a simple assignment statement: X = Y. If Def is true, the assignment is a :=.

type AssignStmt struct {
    X   Node
    Def bool
    Y   Node
    // contains filtered or unexported fields
}

func NewAssignStmt

func NewAssignStmt(pos src.XPos, x, y Node) *AssignStmt

func (*AssignStmt) Format

func (n *AssignStmt) Format(s fmt.State, verb rune)

func (*AssignStmt) Init

func (n *AssignStmt) Init() Nodes

func (*AssignStmt) PtrInit

func (n *AssignStmt) PtrInit() *Nodes

func (*AssignStmt) SetInit

func (n *AssignStmt) SetInit(x Nodes)

func (*AssignStmt) SetOp

func (n *AssignStmt) SetOp(op Op)

type BasicLit

A BasicLit is a literal of basic type.

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

func (*BasicLit) Bounded

func (n *BasicLit) Bounded() bool

func (*BasicLit) Format

func (n *BasicLit) Format(s fmt.State, verb rune)

func (*BasicLit) Init

func (n *BasicLit) Init() Nodes

func (*BasicLit) MarkNonNil

func (n *BasicLit) MarkNonNil()

func (*BasicLit) NonNil

func (n *BasicLit) NonNil() bool

func (*BasicLit) PtrInit

func (n *BasicLit) PtrInit() *Nodes

func (*BasicLit) SetBounded

func (n *BasicLit) SetBounded(b bool)

func (*BasicLit) SetInit

func (n *BasicLit) SetInit(x Nodes)

func (*BasicLit) SetTransient

func (n *BasicLit) SetTransient(b bool)

func (*BasicLit) SetType

func (n *BasicLit) SetType(x *types.Type)

func (*BasicLit) SetVal

func (n *BasicLit) SetVal(val constant.Value)

func (*BasicLit) Transient

func (n *BasicLit) Transient() bool

func (*BasicLit) Type

func (n *BasicLit) Type() *types.Type

func (*BasicLit) Val

func (n *BasicLit) Val() constant.Value

type BinaryExpr

A BinaryExpr is a binary expression X Op Y, or Op(X, Y) for builtin functions that do not become calls.

type BinaryExpr struct {
    X     Node
    Y     Node
    RType Node `mknode:"-"` // see reflectdata/helpers.go
    // contains filtered or unexported fields
}

func NewBinaryExpr

func NewBinaryExpr(pos src.XPos, op Op, x, y Node) *BinaryExpr

func (*BinaryExpr) Bounded

func (n *BinaryExpr) Bounded() bool

func (*BinaryExpr) Format

func (n *BinaryExpr) Format(s fmt.State, verb rune)

func (*BinaryExpr) Init

func (n *BinaryExpr) Init() Nodes

func (*BinaryExpr) MarkNonNil

func (n *BinaryExpr) MarkNonNil()

func (*BinaryExpr) NonNil

func (n *BinaryExpr) NonNil() bool

func (*BinaryExpr) PtrInit

func (n *BinaryExpr) PtrInit() *Nodes

func (*BinaryExpr) SetBounded

func (n *BinaryExpr) SetBounded(b bool)

func (*BinaryExpr) SetInit

func (n *BinaryExpr) SetInit(x Nodes)

func (*BinaryExpr) SetOp

func (n *BinaryExpr) SetOp(op Op)

func (*BinaryExpr) SetTransient

func (n *BinaryExpr) SetTransient(b bool)

func (*BinaryExpr) SetType

func (n *BinaryExpr) SetType(x *types.Type)

func (*BinaryExpr) Transient

func (n *BinaryExpr) Transient() bool

func (*BinaryExpr) Type

func (n *BinaryExpr) Type() *types.Type

type BlockStmt

A BlockStmt is a block: { List }.

type BlockStmt struct {
    List Nodes
    // contains filtered or unexported fields
}

func NewBlockStmt

func NewBlockStmt(pos src.XPos, list []Node) *BlockStmt

func (*BlockStmt) Format

func (n *BlockStmt) Format(s fmt.State, verb rune)

func (*BlockStmt) Init

func (n *BlockStmt) Init() Nodes

func (*BlockStmt) PtrInit

func (n *BlockStmt) PtrInit() *Nodes

func (*BlockStmt) SetInit

func (n *BlockStmt) SetInit(x Nodes)

type BranchStmt

A BranchStmt is a break, continue, fallthrough, or goto statement.

type BranchStmt struct {
    Label *types.Sym // label if present
    // contains filtered or unexported fields
}

func NewBranchStmt

func NewBranchStmt(pos src.XPos, op Op, label *types.Sym) *BranchStmt

func (*BranchStmt) Format

func (n *BranchStmt) Format(s fmt.State, verb rune)

func (*BranchStmt) Init

func (n *BranchStmt) Init() Nodes

func (*BranchStmt) PtrInit

func (n *BranchStmt) PtrInit() *Nodes

func (*BranchStmt) SetInit

func (n *BranchStmt) SetInit(x Nodes)

func (*BranchStmt) SetOp

func (n *BranchStmt) SetOp(op Op)

func (*BranchStmt) Sym

func (n *BranchStmt) Sym() *types.Sym

type CallExpr

A CallExpr is a function call Fun(Args).

type CallExpr struct {
    Fun       Node
    Args      Nodes
    DeferAt   Node
    RType     Node    `mknode:"-"` // see reflectdata/helpers.go
    KeepAlive []*Name // vars to be kept alive until call returns
    IsDDD     bool
    GoDefer   bool // whether this call is part of a go or defer statement
    NoInline  bool // whether this call must not be inlined
    // contains filtered or unexported fields
}

func NewCallExpr

func NewCallExpr(pos src.XPos, op Op, fun Node, args []Node) *CallExpr

func (*CallExpr) Bounded

func (n *CallExpr) Bounded() bool

func (*CallExpr) Format

func (n *CallExpr) Format(s fmt.State, verb rune)

func (*CallExpr) Init

func (n *CallExpr) Init() Nodes

func (*CallExpr) MarkNonNil

func (n *CallExpr) MarkNonNil()

func (*CallExpr) NonNil

func (n *CallExpr) NonNil() bool

func (*CallExpr) PtrInit

func (n *CallExpr) PtrInit() *Nodes

func (*CallExpr) SetBounded

func (n *CallExpr) SetBounded(b bool)

func (*CallExpr) SetInit

func (n *CallExpr) SetInit(x Nodes)

func (*CallExpr) SetOp

func (n *CallExpr) SetOp(op Op)

func (*CallExpr) SetTransient

func (n *CallExpr) SetTransient(b bool)

func (*CallExpr) SetType

func (n *CallExpr) SetType(x *types.Type)

func (*CallExpr) Transient

func (n *CallExpr) Transient() bool

func (*CallExpr) Type

func (n *CallExpr) Type() *types.Type

type CaseClause

A CaseClause is a case statement in a switch or select: case List: Body.

type CaseClause struct {
    Var  *Name // declared variable for this case in type switch
    List Nodes // list of expressions for switch, early select

    // RTypes is a list of RType expressions, which are copied to the
    // corresponding OEQ nodes that are emitted when switch statements
    // are desugared. RTypes[i] must be non-nil if the emitted
    // comparison for List[i] will be a mixed interface/concrete
    // comparison; see reflectdata.CompareRType for details.
    //
    // Because mixed interface/concrete switch cases are rare, we allow
    // len(RTypes) < len(List). Missing entries are implicitly nil.
    RTypes Nodes

    Body Nodes
    // contains filtered or unexported fields
}

func NewCaseStmt

func NewCaseStmt(pos src.XPos, list, body []Node) *CaseClause

func (*CaseClause) Format

func (n *CaseClause) Format(s fmt.State, verb rune)

func (*CaseClause) Init

func (n *CaseClause) Init() Nodes

func (*CaseClause) PtrInit

func (n *CaseClause) PtrInit() *Nodes

func (*CaseClause) SetInit

func (n *CaseClause) SetInit(x Nodes)

type Class

The Class of a variable/function describes the "storage class" of a variable or function. During parsing, storage classes are called declaration contexts.

type Class uint8
const (
    Pxxx       Class = iota // no class; used during ssa conversion to indicate pseudo-variables
    PEXTERN                 // global variables
    PAUTO                   // local variables
    PAUTOHEAP               // local variables or parameters moved to heap
    PPARAM                  // input arguments
    PPARAMOUT               // output results
    PTYPEPARAM              // type params
    PFUNC                   // global functions

)

func (Class) String

func (i Class) String() string

type ClosureExpr

A ClosureExpr is a function literal expression.

type ClosureExpr struct {
    Func     *Func `mknode:"-"`
    Prealloc *Name
    IsGoWrap bool // whether this is wrapper closure of a go statement
    // contains filtered or unexported fields
}

func (*ClosureExpr) Bounded

func (n *ClosureExpr) Bounded() bool

func (*ClosureExpr) Format

func (n *ClosureExpr) Format(s fmt.State, verb rune)

func (*ClosureExpr) Init

func (n *ClosureExpr) Init() Nodes

func (*ClosureExpr) MarkNonNil

func (n *ClosureExpr) MarkNonNil()

func (*ClosureExpr) NonNil

func (n *ClosureExpr) NonNil() bool

func (*ClosureExpr) PtrInit

func (n *ClosureExpr) PtrInit() *Nodes

func (*ClosureExpr) SetBounded

func (n *ClosureExpr) SetBounded(b bool)

func (*ClosureExpr) SetInit

func (n *ClosureExpr) SetInit(x Nodes)

func (*ClosureExpr) SetTransient

func (n *ClosureExpr) SetTransient(b bool)

func (*ClosureExpr) SetType

func (n *ClosureExpr) SetType(x *types.Type)

func (*ClosureExpr) Transient

func (n *ClosureExpr) Transient() bool

func (*ClosureExpr) Type

func (n *ClosureExpr) Type() *types.Type

type CommClause

type CommClause struct {
    Comm Node // communication case
    Body Nodes
    // contains filtered or unexported fields
}

func NewCommStmt

func NewCommStmt(pos src.XPos, comm Node, body []Node) *CommClause

func (*CommClause) Format

func (n *CommClause) Format(s fmt.State, verb rune)

func (*CommClause) Init

func (n *CommClause) Init() Nodes

func (*CommClause) PtrInit

func (n *CommClause) PtrInit() *Nodes

func (*CommClause) SetInit

func (n *CommClause) SetInit(x Nodes)

type CompLitExpr

A CompLitExpr is a composite literal Type{Vals}. Before type-checking, the type is Ntype.

type CompLitExpr struct {
    List     Nodes // initialized values
    RType    Node  `mknode:"-"` // *runtime._type for OMAPLIT map types
    Prealloc *Name
    // For OSLICELIT, Len is the backing array length.
    // For OMAPLIT, Len is the number of entries that we've removed from List and
    // generated explicit mapassign calls for. This is used to inform the map alloc hint.
    Len int64
    // contains filtered or unexported fields
}

func NewCompLitExpr

func NewCompLitExpr(pos src.XPos, op Op, typ *types.Type, list []Node) *CompLitExpr

func (*CompLitExpr) Bounded

func (n *CompLitExpr) Bounded() bool

func (*CompLitExpr) Format

func (n *CompLitExpr) Format(s fmt.State, verb rune)

func (*CompLitExpr) Implicit

func (n *CompLitExpr) Implicit() bool

func (*CompLitExpr) Init

func (n *CompLitExpr) Init() Nodes

func (*CompLitExpr) MarkNonNil

func (n *CompLitExpr) MarkNonNil()

func (*CompLitExpr) NonNil

func (n *CompLitExpr) NonNil() bool

func (*CompLitExpr) PtrInit

func (n *CompLitExpr) PtrInit() *Nodes

func (*CompLitExpr) SetBounded

func (n *CompLitExpr) SetBounded(b bool)

func (*CompLitExpr) SetImplicit

func (n *CompLitExpr) SetImplicit(b bool)

func (*CompLitExpr) SetInit

func (n *CompLitExpr) SetInit(x Nodes)

func (*CompLitExpr) SetOp

func (n *CompLitExpr) SetOp(op Op)

func (*CompLitExpr) SetTransient

func (n *CompLitExpr) SetTransient(b bool)

func (*CompLitExpr) SetType

func (n *CompLitExpr) SetType(x *types.Type)

func (*CompLitExpr) Transient

func (n *CompLitExpr) Transient() bool

func (*CompLitExpr) Type

func (n *CompLitExpr) Type() *types.Type

type ConvExpr

A ConvExpr is a conversion Type(X). It may end up being a value or a type.

type ConvExpr struct {
    X Node

    // For implementing OCONVIFACE expressions.
    //
    // TypeWord is an expression yielding a *runtime._type or
    // *runtime.itab value to go in the type word of the iface/eface
    // result. See reflectdata.ConvIfaceTypeWord for further details.
    //
    // SrcRType is an expression yielding a *runtime._type value for X,
    // if it's not pointer-shaped and needs to be heap allocated.
    TypeWord Node `mknode:"-"`
    SrcRType Node `mknode:"-"`

    // For -d=checkptr instrumentation of conversions from
    // unsafe.Pointer to *Elem or *[Len]Elem.
    //
    // TODO(mdempsky): We only ever need one of these, but currently we
    // don't decide which one until walk. Longer term, it probably makes
    // sense to have a dedicated IR op for `(*[Len]Elem)(ptr)[:n:m]`
    // expressions.
    ElemRType     Node `mknode:"-"`
    ElemElemRType Node `mknode:"-"`
    // contains filtered or unexported fields
}

func NewConvExpr

func NewConvExpr(pos src.XPos, op Op, typ *types.Type, x Node) *ConvExpr

func (*ConvExpr) Bounded

func (n *ConvExpr) Bounded() bool

func (*ConvExpr) CheckPtr

func (n *ConvExpr) CheckPtr() bool

func (*ConvExpr) Format

func (n *ConvExpr) Format(s fmt.State, verb rune)

func (*ConvExpr) Implicit

func (n *ConvExpr) Implicit() bool

func (*ConvExpr) Init

func (n *ConvExpr) Init() Nodes

func (*ConvExpr) MarkNonNil

func (n *ConvExpr) MarkNonNil()

func (*ConvExpr) NonNil

func (n *ConvExpr) NonNil() bool

func (*ConvExpr) PtrInit

func (n *ConvExpr) PtrInit() *Nodes

func (*ConvExpr) SetBounded

func (n *ConvExpr) SetBounded(b bool)

func (*ConvExpr) SetCheckPtr

func (n *ConvExpr) SetCheckPtr(b bool)

func (*ConvExpr) SetImplicit

func (n *ConvExpr) SetImplicit(b bool)

func (*ConvExpr) SetInit

func (n *ConvExpr) SetInit(x Nodes)

func (*ConvExpr) SetOp

func (n *ConvExpr) SetOp(op Op)

func (*ConvExpr) SetTransient

func (n *ConvExpr) SetTransient(b bool)

func (*ConvExpr) SetType

func (n *ConvExpr) SetType(x *types.Type)

func (*ConvExpr) Transient

func (n *ConvExpr) Transient() bool

func (*ConvExpr) Type

func (n *ConvExpr) Type() *types.Type

type Decl

A Decl is a declaration of a const, type, or var. (A declared func is a Func.)

type Decl struct {
    X *Name // the thing being declared
    // contains filtered or unexported fields
}

func NewDecl

func NewDecl(pos src.XPos, op Op, x *Name) *Decl

func (*Decl) Esc

func (n *Decl) Esc() uint16

func (*Decl) Format

func (n *Decl) Format(s fmt.State, verb rune)

func (*Decl) Init

func (n *Decl) Init() Nodes

func (*Decl) MarkNonNil

func (n *Decl) MarkNonNil()

func (*Decl) Name

func (n *Decl) Name() *Name

func (*Decl) NonNil

func (n *Decl) NonNil() bool

func (*Decl) Op

func (n *Decl) Op() Op

op can be read, but not written. An embedding implementation can provide a SetOp if desired. (The panicking SetOp is with the other panics below.)

func (*Decl) Pos

func (n *Decl) Pos() src.XPos

func (*Decl) SetEsc

func (n *Decl) SetEsc(x uint16)

func (*Decl) SetPos

func (n *Decl) SetPos(x src.XPos)

func (*Decl) SetType

func (n *Decl) SetType(*types.Type)

func (*Decl) SetTypecheck

func (n *Decl) SetTypecheck(x uint8)

func (*Decl) SetVal

func (n *Decl) SetVal(v constant.Value)

func (*Decl) SetWalked

func (n *Decl) SetWalked(x bool)

func (*Decl) Sym

func (n *Decl) Sym() *types.Sym

func (*Decl) Type

func (n *Decl) Type() *types.Type

func (*Decl) Typecheck

func (n *Decl) Typecheck() uint8

func (*Decl) Val

func (n *Decl) Val() constant.Value

func (*Decl) Walked

func (n *Decl) Walked() bool

type DynamicType

A DynamicType represents a type expression whose exact type must be computed dynamically.

type DynamicType struct {

    // RType is an expression that yields a *runtime._type value
    // representing the asserted type.
    //
    // BUG(mdempsky): If ITab is non-nil, RType may be nil.
    RType Node

    // ITab is an expression that yields a *runtime.itab value
    // representing the asserted type within the assertee expression's
    // original interface type.
    //
    // ITab is only used for assertions (including type switches) from
    // non-empty interface type to a concrete (i.e., non-interface)
    // type. For all other assertions, ITab is nil.
    ITab Node
    // contains filtered or unexported fields
}

func NewDynamicType

func NewDynamicType(pos src.XPos, rtype Node) *DynamicType

func (*DynamicType) Bounded

func (n *DynamicType) Bounded() bool

func (*DynamicType) Format

func (n *DynamicType) Format(s fmt.State, verb rune)

func (*DynamicType) Init

func (n *DynamicType) Init() Nodes

func (*DynamicType) MarkNonNil

func (n *DynamicType) MarkNonNil()

func (*DynamicType) NonNil

func (n *DynamicType) NonNil() bool

func (*DynamicType) PtrInit

func (n *DynamicType) PtrInit() *Nodes

func (*DynamicType) SetBounded

func (n *DynamicType) SetBounded(b bool)

func (*DynamicType) SetInit

func (n *DynamicType) SetInit(x Nodes)

func (*DynamicType) SetTransient

func (n *DynamicType) SetTransient(b bool)

func (*DynamicType) SetType

func (n *DynamicType) SetType(x *types.Type)

func (*DynamicType) Transient

func (n *DynamicType) Transient() bool

func (*DynamicType) Type

func (n *DynamicType) Type() *types.Type

type DynamicTypeAssertExpr

A DynamicTypeAssertExpr asserts that X is of dynamic type RType.

type DynamicTypeAssertExpr struct {
    X Node

    // SrcRType is an expression that yields a *runtime._type value
    // representing X's type. It's used in failed assertion panic
    // messages.
    SrcRType Node

    // RType is an expression that yields a *runtime._type value
    // representing the asserted type.
    //
    // BUG(mdempsky): If ITab is non-nil, RType may be nil.
    RType Node

    // ITab is an expression that yields a *runtime.itab value
    // representing the asserted type within the assertee expression's
    // original interface type.
    //
    // ITab is only used for assertions from non-empty interface type to
    // a concrete (i.e., non-interface) type. For all other assertions,
    // ITab is nil.
    ITab Node
    // contains filtered or unexported fields
}

func NewDynamicTypeAssertExpr

func NewDynamicTypeAssertExpr(pos src.XPos, op Op, x, rtype Node) *DynamicTypeAssertExpr

func (*DynamicTypeAssertExpr) Bounded

func (n *DynamicTypeAssertExpr) Bounded() bool

func (*DynamicTypeAssertExpr) Format

func (n *DynamicTypeAssertExpr) Format(s fmt.State, verb rune)

func (*DynamicTypeAssertExpr) Init

func (n *DynamicTypeAssertExpr) Init() Nodes

func (*DynamicTypeAssertExpr) MarkNonNil

func (n *DynamicTypeAssertExpr) MarkNonNil()

func (*DynamicTypeAssertExpr) NonNil

func (n *DynamicTypeAssertExpr) NonNil() bool

func (*DynamicTypeAssertExpr) PtrInit

func (n *DynamicTypeAssertExpr) PtrInit() *Nodes

func (*DynamicTypeAssertExpr) SetBounded

func (n *DynamicTypeAssertExpr) SetBounded(b bool)

func (*DynamicTypeAssertExpr) SetInit

func (n *DynamicTypeAssertExpr) SetInit(x Nodes)

func (*DynamicTypeAssertExpr) SetOp

func (n *DynamicTypeAssertExpr) SetOp(op Op)

func (*DynamicTypeAssertExpr) SetTransient

func (n *DynamicTypeAssertExpr) SetTransient(b bool)

func (*DynamicTypeAssertExpr) SetType

func (n *DynamicTypeAssertExpr) SetType(x *types.Type)

func (*DynamicTypeAssertExpr) Transient

func (n *DynamicTypeAssertExpr) Transient() bool

func (*DynamicTypeAssertExpr) Type

func (n *DynamicTypeAssertExpr) Type() *types.Type

type Embed

type Embed struct {
    Pos      src.XPos
    Patterns []string
}

type Expr

An Expr is a Node that can appear as an expression.

type Expr interface {
    Node
    // contains filtered or unexported methods
}

type ForStmt

A ForStmt is a non-range for loop: for Init; Cond; Post { Body }

type ForStmt struct {
    Label        *types.Sym
    Cond         Node
    Post         Node
    Body         Nodes
    DistinctVars bool
    // contains filtered or unexported fields
}

func NewForStmt

func NewForStmt(pos src.XPos, init Node, cond, post Node, body []Node, distinctVars bool) *ForStmt

func (*ForStmt) Format

func (n *ForStmt) Format(s fmt.State, verb rune)

func (*ForStmt) Init

func (n *ForStmt) Init() Nodes

func (*ForStmt) PtrInit

func (n *ForStmt) PtrInit() *Nodes

func (*ForStmt) SetInit

func (n *ForStmt) SetInit(x Nodes)

type Func

A Func corresponds to a single function in a Go program (and vice versa: each function is denoted by exactly one *Func).

There are multiple nodes that represent a Func in the IR.

The ONAME node (Func.Nname) is used for plain references to it. The ODCLFUNC node (the Func itself) is used for its declaration code. The OCLOSURE node (Func.OClosure) is used for a reference to a function literal.

An imported function will have an ONAME node which points to a Func with an empty body. A declared function or method has an ODCLFUNC (the Func itself) and an ONAME. A function literal is represented directly by an OCLOSURE, but it also has an ODCLFUNC (and a matching ONAME) representing the compiled underlying form of the closure, which accesses the captured variables using a special data structure passed in a register.

A method declaration is represented like functions, except f.Sym will be the qualified method name (e.g., "T.m").

A method expression (T.M) is represented as an OMETHEXPR node, in which n.Left and n.Right point to the type and method, respectively. Each distinct mention of a method expression in the source code constructs a fresh node.

A method value (t.M) is represented by ODOTMETH/ODOTINTER when it is called directly and by OMETHVALUE otherwise. These are like method expressions, except that for ODOTMETH/ODOTINTER, the method name is stored in Sym instead of Right. Each OMETHVALUE ends up being implemented as a new function, a bit like a closure, with its own ODCLFUNC. The OMETHVALUE uses n.Func to record the linkage to the generated ODCLFUNC, but there is no pointer from the Func back to the OMETHVALUE.

type Func struct {
    Body Nodes

    Nname    *Name        // ONAME node
    OClosure *ClosureExpr // OCLOSURE node

    // ONAME nodes for all params/locals for this func/closure, does NOT
    // include closurevars until transforming closures during walk.
    // Names must be listed PPARAMs, PPARAMOUTs, then PAUTOs,
    // with PPARAMs and PPARAMOUTs in order corresponding to the function signature.
    // Anonymous and blank params are declared as ~pNN (for PPARAMs) and ~rNN (for PPARAMOUTs).
    Dcl []*Name

    // ClosureVars lists the free variables that are used within a
    // function literal, but formally declared in an enclosing
    // function. The variables in this slice are the closure function's
    // own copy of the variables, which are used within its function
    // body. They will also each have IsClosureVar set, and will have
    // Byval set if they're captured by value.
    ClosureVars []*Name

    // Enclosed functions that need to be compiled.
    // Populated during walk.
    Closures []*Func

    // Parents records the parent scope of each scope within a
    // function. The root scope (0) has no parent, so the i'th
    // scope's parent is stored at Parents[i-1].
    Parents []ScopeID

    // Marks records scope boundary changes.
    Marks []Mark

    FieldTrack map[*obj.LSym]struct{}
    DebugInfo  interface{}
    LSym       *obj.LSym // Linker object in this function's native ABI (Func.ABI)

    Inl *Inline

    Label int32 // largest auto-generated label in this function

    Endlineno src.XPos
    WBPos     src.XPos // position of first write barrier; see SetWBPos

    Pragma PragmaFlag // go:xxx function annotations

    // ABI is a function's "definition" ABI. This is the ABI that
    // this function's generated code is expecting to be called by.
    //
    // For most functions, this will be obj.ABIInternal. It may be
    // a different ABI for functions defined in assembly or ABI wrappers.
    //
    // This is included in the export data and tracked across packages.
    ABI obj.ABI
    // ABIRefs is the set of ABIs by which this function is referenced.
    // For ABIs other than this function's definition ABI, the
    // compiler generates ABI wrapper functions. This is only tracked
    // within a package.
    ABIRefs obj.ABISet

    NumDefers  int32 // number of defer calls in the function
    NumReturns int32 // number of explicit returns in the function

    // NWBRCalls records the LSyms of functions called by this
    // function for go:nowritebarrierrec analysis. Only filled in
    // if nowritebarrierrecCheck != nil.
    NWBRCalls *[]SymAndPos

    // For wrapper functions, WrappedFunc point to the original Func.
    // Currently only used for go/defer wrappers.
    WrappedFunc *Func

    // WasmImport is used by the //go:wasmimport directive to store info about
    // a WebAssembly function import.
    WasmImport *WasmImport
    // contains filtered or unexported fields
}
var CurFunc *Func

func IsIfaceOfFunc

func IsIfaceOfFunc(n Node) *Func

IsIfaceOfFunc inspects whether n is an interface conversion from a direct reference of a func. If so, it returns referenced Func; otherwise nil.

This is only usable before walk.walkConvertInterface, which converts to an OMAKEFACE.

func NewClosureFunc

func NewClosureFunc(fpos, cpos src.XPos, why Op, typ *types.Type, outerfn *Func, pkg *Package) *Func

NewClosureFunc creates a new Func to represent a function literal with the given type.

fpos the position used for the underlying ODCLFUNC and ONAME, whereas cpos is the position used for the OCLOSURE. They're separate because in the presence of inlining, the OCLOSURE node should have an inline-adjusted position, whereas the ODCLFUNC and ONAME must not.

outerfn is the enclosing function, if any. The returned function is appending to pkg.Funcs.

why is the reason we're generating this Func. It can be OCLOSURE (for a normal function literal) or OGO or ODEFER (for wrapping a call expression that has parameters or results).

func NewFunc

func NewFunc(fpos, npos src.XPos, sym *types.Sym, typ *types.Type) *Func

NewFunc returns a new Func with the given name and type.

fpos is the position of the "func" token, and npos is the position of the name identifier.

TODO(mdempsky): I suspect there's no need for separate fpos and npos.

func (*Func) ABIWrapper

func (f *Func) ABIWrapper() bool

func (*Func) ClosureResultsLost

func (f *Func) ClosureResultsLost() bool

func (*Func) DeclareParams

func (fn *Func) DeclareParams(setNname bool)

DeclareParams creates Names for all of the parameters in fn's signature and adds them to fn.Dcl.

If setNname is true, then it also sets types.Field.Nname for each parameter.

func (*Func) Dupok

func (f *Func) Dupok() bool

func (*Func) Esc

func (n *Func) Esc() uint16

func (*Func) Format

func (n *Func) Format(s fmt.State, verb rune)

func (*Func) HasDefer

func (f *Func) HasDefer() bool

func (*Func) Init

func (n *Func) Init() Nodes

func (*Func) InlinabilityChecked

func (f *Func) InlinabilityChecked() bool

func (*Func) IsDeadcodeClosure

func (f *Func) IsDeadcodeClosure() bool

func (*Func) IsHiddenClosure

func (f *Func) IsHiddenClosure() bool

func (*Func) IsPackageInit

func (f *Func) IsPackageInit() bool

func (*Func) Linksym

func (f *Func) Linksym() *obj.LSym

func (*Func) LinksymABI

func (f *Func) LinksymABI(abi obj.ABI) *obj.LSym

func (*Func) MarkNonNil

func (n *Func) MarkNonNil()

func (*Func) Name

func (n *Func) Name() *Name

func (*Func) Needctxt

func (f *Func) Needctxt() bool

func (*Func) NeverReturns

func (f *Func) NeverReturns() bool

func (*Func) NewLocal

func (fn *Func) NewLocal(pos src.XPos, sym *types.Sym, typ *types.Type) *Name

NewLocal returns a new function-local variable with the given name and type.

func (*Func) NilCheckDisabled

func (f *Func) NilCheckDisabled() bool

func (*Func) NonNil

func (n *Func) NonNil() bool

func (*Func) Op

func (n *Func) Op() Op

op can be read, but not written. An embedding implementation can provide a SetOp if desired. (The panicking SetOp is with the other panics below.)

func (*Func) OpenCodedDeferDisallowed

func (f *Func) OpenCodedDeferDisallowed() bool

func (*Func) Pos

func (n *Func) Pos() src.XPos

func (*Func) SetABIWrapper

func (f *Func) SetABIWrapper(b bool)

func (*Func) SetClosureResultsLost

func (f *Func) SetClosureResultsLost(b bool)

func (*Func) SetDupok

func (f *Func) SetDupok(b bool)

func (*Func) SetEsc

func (n *Func) SetEsc(x uint16)

func (*Func) SetHasDefer

func (f *Func) SetHasDefer(b bool)

func (*Func) SetInlinabilityChecked

func (f *Func) SetInlinabilityChecked(b bool)

func (*Func) SetIsDeadcodeClosure

func (f *Func) SetIsDeadcodeClosure(b bool)

func (*Func) SetIsHiddenClosure

func (f *Func) SetIsHiddenClosure(b bool)

func (*Func) SetIsPackageInit

func (f *Func) SetIsPackageInit(b bool)

func (*Func) SetNeedctxt

func (f *Func) SetNeedctxt(b bool)

func (*Func) SetNeverReturns

func (f *Func) SetNeverReturns(b bool)

func (*Func) SetNilCheckDisabled

func (f *Func) SetNilCheckDisabled(b bool)

func (*Func) SetOpenCodedDeferDisallowed

func (f *Func) SetOpenCodedDeferDisallowed(b bool)

func (*Func) SetPos

func (n *Func) SetPos(x src.XPos)

func (*Func) SetType

func (n *Func) SetType(*types.Type)

func (*Func) SetTypecheck

func (n *Func) SetTypecheck(x uint8)

func (*Func) SetVal

func (n *Func) SetVal(v constant.Value)

func (*Func) SetWBPos

func (f *Func) SetWBPos(pos src.XPos)

func (*Func) SetWalked

func (n *Func) SetWalked(x bool)

func (*Func) SetWrapper

func (f *Func) SetWrapper(b bool)

func (*Func) Sym

func (f *Func) Sym() *types.Sym

func (*Func) Type

func (f *Func) Type() *types.Type

func (*Func) Typecheck

func (n *Func) Typecheck() uint8

func (*Func) Val

func (n *Func) Val() constant.Value

func (*Func) Walked

func (n *Func) Walked() bool

func (*Func) Wrapper

func (f *Func) Wrapper() bool

type GoDeferStmt

A GoDeferStmt is a go or defer statement: go Call / defer Call.

The two opcodes use a single syntax because the implementations are very similar: both are concerned with saving Call and running it in a different context (a separate goroutine or a later time).

type GoDeferStmt struct {
    Call    Node
    DeferAt Expr
    // contains filtered or unexported fields
}

func NewGoDeferStmt

func NewGoDeferStmt(pos src.XPos, op Op, call Node) *GoDeferStmt

func (*GoDeferStmt) Format

func (n *GoDeferStmt) Format(s fmt.State, verb rune)

func (*GoDeferStmt) Init

func (n *GoDeferStmt) Init() Nodes

func (*GoDeferStmt) PtrInit

func (n *GoDeferStmt) PtrInit() *Nodes

func (*GoDeferStmt) SetInit

func (n *GoDeferStmt) SetInit(x Nodes)

type Ident

An Ident is an identifier, possibly qualified.

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

func NewIdent

func NewIdent(pos src.XPos, sym *types.Sym) *Ident

func (*Ident) Bounded

func (n *Ident) Bounded() bool

func (*Ident) Format

func (n *Ident) Format(s fmt.State, verb rune)

func (*Ident) Init

func (n *Ident) Init() Nodes

func (*Ident) MarkNonNil

func (n *Ident) MarkNonNil()

func (*Ident) NonNil

func (n *Ident) NonNil() bool

func (*Ident) PtrInit

func (n *Ident) PtrInit() *Nodes

func (*Ident) SetBounded

func (n *Ident) SetBounded(b bool)

func (*Ident) SetInit

func (n *Ident) SetInit(x Nodes)

func (*Ident) SetTransient

func (n *Ident) SetTransient(b bool)

func (*Ident) SetType

func (n *Ident) SetType(x *types.Type)

func (*Ident) Sym

func (n *Ident) Sym() *types.Sym

func (*Ident) Transient

func (n *Ident) Transient() bool

func (*Ident) Type

func (n *Ident) Type() *types.Type

type IfStmt

An IfStmt is a return statement: if Init; Cond { Body } else { Else }.

type IfStmt struct {
    Cond   Node
    Body   Nodes
    Else   Nodes
    Likely bool // code layout hint
    // contains filtered or unexported fields
}

func NewIfStmt

func NewIfStmt(pos src.XPos, cond Node, body, els []Node) *IfStmt

func (*IfStmt) Format

func (n *IfStmt) Format(s fmt.State, verb rune)

func (*IfStmt) Init

func (n *IfStmt) Init() Nodes

func (*IfStmt) PtrInit

func (n *IfStmt) PtrInit() *Nodes

func (*IfStmt) SetInit

func (n *IfStmt) SetInit(x Nodes)

type IndexExpr

An IndexExpr is an index expression X[Index].

type IndexExpr struct {
    X        Node
    Index    Node
    RType    Node `mknode:"-"` // see reflectdata/helpers.go
    Assigned bool
    // contains filtered or unexported fields
}

func NewIndexExpr

func NewIndexExpr(pos src.XPos, x, index Node) *IndexExpr

func (*IndexExpr) Bounded

func (n *IndexExpr) Bounded() bool

func (*IndexExpr) Format

func (n *IndexExpr) Format(s fmt.State, verb rune)

func (*IndexExpr) Init

func (n *IndexExpr) Init() Nodes

func (*IndexExpr) MarkNonNil

func (n *IndexExpr) MarkNonNil()

func (*IndexExpr) NonNil

func (n *IndexExpr) NonNil() bool

func (*IndexExpr) PtrInit

func (n *IndexExpr) PtrInit() *Nodes

func (*IndexExpr) SetBounded

func (n *IndexExpr) SetBounded(b bool)

func (*IndexExpr) SetInit

func (n *IndexExpr) SetInit(x Nodes)

func (*IndexExpr) SetOp

func (n *IndexExpr) SetOp(op Op)

func (*IndexExpr) SetTransient

func (n *IndexExpr) SetTransient(b bool)

func (*IndexExpr) SetType

func (n *IndexExpr) SetType(x *types.Type)

func (*IndexExpr) Transient

func (n *IndexExpr) Transient() bool

func (*IndexExpr) Type

func (n *IndexExpr) Type() *types.Type

type InitNode

type InitNode interface {
    Node
    PtrInit() *Nodes
    SetInit(x Nodes)
}

type Inline

An Inline holds fields used for function bodies that can be inlined.

type Inline struct {
    Cost int32 // heuristic cost of inlining this function

    // Copy of Func.Dcl for use during inlining. This copy is needed
    // because the function's Dcl may change from later compiler
    // transformations. This field is also populated when a function
    // from another package is imported and inlined.
    Dcl     []*Name
    HaveDcl bool // whether we've loaded Dcl

    // Function properties, encoded as a string (these are used for
    // making inlining decisions). See cmd/compile/internal/inline/inlheur.
    Properties string

    // CanDelayResults reports whether it's safe for the inliner to delay
    // initializing the result parameters until immediately before the
    // "return" statement.
    CanDelayResults bool
}

type InlineMarkStmt

An InlineMarkStmt is a marker placed just before an inlined body.

type InlineMarkStmt struct {
    Index int64
    // contains filtered or unexported fields
}

func NewInlineMarkStmt

func NewInlineMarkStmt(pos src.XPos, index int64) *InlineMarkStmt

func (*InlineMarkStmt) Format

func (n *InlineMarkStmt) Format(s fmt.State, verb rune)

func (*InlineMarkStmt) Init

func (n *InlineMarkStmt) Init() Nodes

func (*InlineMarkStmt) Offset

func (n *InlineMarkStmt) Offset() int64

func (*InlineMarkStmt) PtrInit

func (n *InlineMarkStmt) PtrInit() *Nodes

func (*InlineMarkStmt) SetInit

func (n *InlineMarkStmt) SetInit(x Nodes)

func (*InlineMarkStmt) SetOffset

func (n *InlineMarkStmt) SetOffset(x int64)

type InlinedCallExpr

An InlinedCallExpr is an inlined function call.

type InlinedCallExpr struct {
    Body       Nodes
    ReturnVars Nodes // must be side-effect free
    // contains filtered or unexported fields
}

func NewInlinedCallExpr

func NewInlinedCallExpr(pos src.XPos, body, retvars []Node) *InlinedCallExpr

func (*InlinedCallExpr) Bounded

func (n *InlinedCallExpr) Bounded() bool

func (*InlinedCallExpr) Format

func (n *InlinedCallExpr) Format(s fmt.State, verb rune)

func (*InlinedCallExpr) Init

func (n *InlinedCallExpr) Init() Nodes

func (*InlinedCallExpr) MarkNonNil

func (n *InlinedCallExpr) MarkNonNil()

func (*InlinedCallExpr) NonNil

func (n *InlinedCallExpr) NonNil() bool

func (*InlinedCallExpr) PtrInit

func (n *InlinedCallExpr) PtrInit() *Nodes

func (*InlinedCallExpr) SetBounded

func (n *InlinedCallExpr) SetBounded(b bool)

func (*InlinedCallExpr) SetInit

func (n *InlinedCallExpr) SetInit(x Nodes)

func (*InlinedCallExpr) SetTransient

func (n *InlinedCallExpr) SetTransient(b bool)

func (*InlinedCallExpr) SetType

func (n *InlinedCallExpr) SetType(x *types.Type)

func (*InlinedCallExpr) SingleResult

func (n *InlinedCallExpr) SingleResult() Node

func (*InlinedCallExpr) Transient

func (n *InlinedCallExpr) Transient() bool

func (*InlinedCallExpr) Type

func (n *InlinedCallExpr) Type() *types.Type

type InterfaceSwitchStmt

An InterfaceSwitchStmt is used to implement type switches. Its semantics are:

if RuntimeType implements Descriptor.Cases[0] {
    Case, Itab = 0, itab<RuntimeType, Descriptor.Cases[0]>
} else if RuntimeType implements Descriptor.Cases[1] {
    Case, Itab = 1, itab<RuntimeType, Descriptor.Cases[1]>
...
} else if RuntimeType implements Descriptor.Cases[N-1] {
    Case, Itab = N-1, itab<RuntimeType, Descriptor.Cases[N-1]>
} else {
    Case, Itab = len(cases), nil
}

RuntimeType must be a non-nil *runtime._type. Hash must be the hash field of RuntimeType (or its copy loaded from an itab). Descriptor must represent an abi.InterfaceSwitch global variable.

type InterfaceSwitchStmt struct {
    Case        Node
    Itab        Node
    RuntimeType Node
    Hash        Node
    Descriptor  *obj.LSym
    // contains filtered or unexported fields
}

func NewInterfaceSwitchStmt

func NewInterfaceSwitchStmt(pos src.XPos, case_, itab, runtimeType, hash Node, descriptor *obj.LSym) *InterfaceSwitchStmt

func (*InterfaceSwitchStmt) Format

func (n *InterfaceSwitchStmt) Format(s fmt.State, verb rune)

func (*InterfaceSwitchStmt) Init

func (n *InterfaceSwitchStmt) Init() Nodes

func (*InterfaceSwitchStmt) PtrInit

func (n *InterfaceSwitchStmt) PtrInit() *Nodes

func (*InterfaceSwitchStmt) SetInit

func (n *InterfaceSwitchStmt) SetInit(x Nodes)

type JumpTableStmt

A JumpTableStmt is used to implement switches. Its semantics are:

tmp := jt.Idx
if tmp == Cases[0] goto Targets[0]
if tmp == Cases[1] goto Targets[1]
...
if tmp == Cases[n] goto Targets[n]

Note that a JumpTableStmt is more like a multiway-goto than a multiway-if. In particular, the case bodies are just labels to jump to, not full Nodes lists.

type JumpTableStmt struct {

    // Value used to index the jump table.
    // We support only integer types that
    // are at most the size of a uintptr.
    Idx Node

    // If Idx is equal to Cases[i], jump to Targets[i].
    // Cases entries must be distinct and in increasing order.
    // The length of Cases and Targets must be equal.
    Cases   []constant.Value
    Targets []*types.Sym
    // contains filtered or unexported fields
}

func NewJumpTableStmt

func NewJumpTableStmt(pos src.XPos, idx Node) *JumpTableStmt

func (*JumpTableStmt) Format

func (n *JumpTableStmt) Format(s fmt.State, verb rune)

func (*JumpTableStmt) Init

func (n *JumpTableStmt) Init() Nodes

func (*JumpTableStmt) PtrInit

func (n *JumpTableStmt) PtrInit() *Nodes

func (*JumpTableStmt) SetInit

func (n *JumpTableStmt) SetInit(x Nodes)

type KeyExpr

A KeyExpr is a Key: Value composite literal key.

type KeyExpr struct {
    Key   Node
    Value Node
    // contains filtered or unexported fields
}

func NewKeyExpr

func NewKeyExpr(pos src.XPos, key, value Node) *KeyExpr

func (*KeyExpr) Bounded

func (n *KeyExpr) Bounded() bool

func (*KeyExpr) Format

func (n *KeyExpr) Format(s fmt.State, verb rune)

func (*KeyExpr) Init

func (n *KeyExpr) Init() Nodes

func (*KeyExpr) MarkNonNil

func (n *KeyExpr) MarkNonNil()

func (*KeyExpr) NonNil

func (n *KeyExpr) NonNil() bool

func (*KeyExpr) PtrInit

func (n *KeyExpr) PtrInit() *Nodes

func (*KeyExpr) SetBounded

func (n *KeyExpr) SetBounded(b bool)

func (*KeyExpr) SetInit

func (n *KeyExpr) SetInit(x Nodes)

func (*KeyExpr) SetTransient

func (n *KeyExpr) SetTransient(b bool)

func (*KeyExpr) SetType

func (n *KeyExpr) SetType(x *types.Type)

func (*KeyExpr) Transient

func (n *KeyExpr) Transient() bool

func (*KeyExpr) Type

func (n *KeyExpr) Type() *types.Type

type LabelStmt

A LabelStmt is a label statement (just the label, not including the statement it labels).

type LabelStmt struct {
    Label *types.Sym // "Label:"
    // contains filtered or unexported fields
}

func NewLabelStmt

func NewLabelStmt(pos src.XPos, label *types.Sym) *LabelStmt

func (*LabelStmt) Format

func (n *LabelStmt) Format(s fmt.State, verb rune)

func (*LabelStmt) Init

func (n *LabelStmt) Init() Nodes

func (*LabelStmt) PtrInit

func (n *LabelStmt) PtrInit() *Nodes

func (*LabelStmt) SetInit

func (n *LabelStmt) SetInit(x Nodes)

func (*LabelStmt) Sym

func (n *LabelStmt) Sym() *types.Sym

type LinksymOffsetExpr

A LinksymOffsetExpr refers to an offset within a global variable. It is like a SelectorExpr but without the field name.

type LinksymOffsetExpr struct {
    Linksym *obj.LSym
    Offset_ int64
    // contains filtered or unexported fields
}

func NewLinksymExpr

func NewLinksymExpr(pos src.XPos, lsym *obj.LSym, typ *types.Type) *LinksymOffsetExpr

NewLinksymExpr is NewLinksymOffsetExpr, but with offset fixed at 0.

func NewLinksymOffsetExpr

func NewLinksymOffsetExpr(pos src.XPos, lsym *obj.LSym, offset int64, typ *types.Type) *LinksymOffsetExpr

func NewNameOffsetExpr

func NewNameOffsetExpr(pos src.XPos, name *Name, offset int64, typ *types.Type) *LinksymOffsetExpr

NewNameOffsetExpr is NewLinksymOffsetExpr, but taking a *Name representing a global variable instead of an *obj.LSym directly.

func (*LinksymOffsetExpr) Bounded

func (n *LinksymOffsetExpr) Bounded() bool

func (*LinksymOffsetExpr) Format

func (n *LinksymOffsetExpr) Format(s fmt.State, verb rune)

func (*LinksymOffsetExpr) Init

func (n *LinksymOffsetExpr) Init() Nodes

func (*LinksymOffsetExpr) MarkNonNil

func (n *LinksymOffsetExpr) MarkNonNil()

func (*LinksymOffsetExpr) NonNil

func (n *LinksymOffsetExpr) NonNil() bool

func (*LinksymOffsetExpr) PtrInit

func (n *LinksymOffsetExpr) PtrInit() *Nodes

func (*LinksymOffsetExpr) SetBounded

func (n *LinksymOffsetExpr) SetBounded(b bool)

func (*LinksymOffsetExpr) SetInit

func (n *LinksymOffsetExpr) SetInit(x Nodes)

func (*LinksymOffsetExpr) SetTransient

func (n *LinksymOffsetExpr) SetTransient(b bool)

func (*LinksymOffsetExpr) SetType

func (n *LinksymOffsetExpr) SetType(x *types.Type)

func (*LinksymOffsetExpr) Transient

func (n *LinksymOffsetExpr) Transient() bool

func (*LinksymOffsetExpr) Type

func (n *LinksymOffsetExpr) Type() *types.Type

type LogicalExpr

A LogicalExpr is an expression X Op Y where Op is && or ||. It is separate from BinaryExpr to make room for statements that must be executed before Y but after X.

type LogicalExpr struct {
    X Node
    Y Node
    // contains filtered or unexported fields
}

func NewLogicalExpr

func NewLogicalExpr(pos src.XPos, op Op, x, y Node) *LogicalExpr

func (*LogicalExpr) Bounded

func (n *LogicalExpr) Bounded() bool

func (*LogicalExpr) Format

func (n *LogicalExpr) Format(s fmt.State, verb rune)

func (*LogicalExpr) Init

func (n *LogicalExpr) Init() Nodes

func (*LogicalExpr) MarkNonNil

func (n *LogicalExpr) MarkNonNil()

func (*LogicalExpr) NonNil

func (n *LogicalExpr) NonNil() bool

func (*LogicalExpr) PtrInit

func (n *LogicalExpr) PtrInit() *Nodes

func (*LogicalExpr) SetBounded

func (n *LogicalExpr) SetBounded(b bool)

func (*LogicalExpr) SetInit

func (n *LogicalExpr) SetInit(x Nodes)

func (*LogicalExpr) SetOp

func (n *LogicalExpr) SetOp(op Op)

func (*LogicalExpr) SetTransient

func (n *LogicalExpr) SetTransient(b bool)

func (*LogicalExpr) SetType

func (n *LogicalExpr) SetType(x *types.Type)

func (*LogicalExpr) Transient

func (n *LogicalExpr) Transient() bool

func (*LogicalExpr) Type

func (n *LogicalExpr) Type() *types.Type

type MakeExpr

A MakeExpr is a make expression: make(Type[, Len[, Cap]]). Op is OMAKECHAN, OMAKEMAP, OMAKESLICE, or OMAKESLICECOPY, but *not* OMAKE (that's a pre-typechecking CallExpr).

type MakeExpr struct {
    RType Node `mknode:"-"` // see reflectdata/helpers.go
    Len   Node
    Cap   Node
    // contains filtered or unexported fields
}

func NewMakeExpr

func NewMakeExpr(pos src.XPos, op Op, len, cap Node) *MakeExpr

func (*MakeExpr) Bounded

func (n *MakeExpr) Bounded() bool

func (*MakeExpr) Format

func (n *MakeExpr) Format(s fmt.State, verb rune)

func (*MakeExpr) Init

func (n *MakeExpr) Init() Nodes

func (*MakeExpr) MarkNonNil

func (n *MakeExpr) MarkNonNil()

func (*MakeExpr) NonNil

func (n *MakeExpr) NonNil() bool

func (*MakeExpr) PtrInit

func (n *MakeExpr) PtrInit() *Nodes

func (*MakeExpr) SetBounded

func (n *MakeExpr) SetBounded(b bool)

func (*MakeExpr) SetInit

func (n *MakeExpr) SetInit(x Nodes)

func (*MakeExpr) SetOp

func (n *MakeExpr) SetOp(op Op)

func (*MakeExpr) SetTransient

func (n *MakeExpr) SetTransient(b bool)

func (*MakeExpr) SetType

func (n *MakeExpr) SetType(x *types.Type)

func (*MakeExpr) Transient

func (n *MakeExpr) Transient() bool

func (*MakeExpr) Type

func (n *MakeExpr) Type() *types.Type

type Mark

A Mark represents a scope boundary.

type Mark struct {
    // Pos is the position of the token that marks the scope
    // change.
    Pos src.XPos

    // Scope identifies the innermost scope to the right of Pos.
    Scope ScopeID
}

type Name

Name holds Node fields used only by named nodes (ONAME, OTYPE, some OLITERAL).

type Name struct {
    BuiltinOp Op    // uint8
    Class     Class // uint8

    DictIndex uint16 // index of the dictionary entry describing the type of this variable declaration plus 1

    Func    *Func // TODO(austin): nil for I.M
    Offset_ int64

    Opt   interface{} // for use by escape analysis
    Embed *[]Embed    // list of embedded files, for ONAME var

    // For a local variable (not param) or extern, the initializing assignment (OAS or OAS2).
    // For a closure var, the ONAME node of the original (outermost) captured variable.
    // For the case-local variables of a type switch, the type switch guard (OTYPESW).
    // For a range variable, the range statement (ORANGE)
    // For a recv variable in a case of a select statement, the receive assignment (OSELRECV2)
    // For the name of a function, points to corresponding Func node.
    Defn Node

    // The function, method, or closure in which local variable or param is declared.
    Curfn *Func

    Heapaddr *Name // temp holding heap address of param

    // Outer points to the immediately enclosing function's copy of this
    // closure variable. If not a closure variable, then Outer is nil.
    Outer *Name
    // contains filtered or unexported fields
}
var BlankNode *Name

func MethodExprName

func MethodExprName(n Node) *Name

MethodExprName returns the ONAME representing the method referenced by expression n, which must be a method selector, method expression, or method value.

func NewBuiltin

func NewBuiltin(sym *types.Sym, op Op) *Name

NewBuiltin returns a new Name representing a builtin function, either predeclared or from package unsafe.

func NewClosureVar

func NewClosureVar(pos src.XPos, fn *Func, n *Name) *Name

NewClosureVar returns a new closure variable for fn to refer to outer variable n.

func NewConstAt

func NewConstAt(pos src.XPos, sym *types.Sym, typ *types.Type, val constant.Value) *Name

NewConstAt returns a new OLITERAL Node associated with symbol s at position pos.

func NewDeclNameAt

func NewDeclNameAt(pos src.XPos, op Op, sym *types.Sym) *Name

NewDeclNameAt returns a new Name associated with symbol s at position pos. The caller is responsible for setting Curfn.

func NewHiddenParam

func NewHiddenParam(pos src.XPos, fn *Func, sym *types.Sym, typ *types.Type) *Name

NewHiddenParam returns a new hidden parameter for fn with the given name and type.

func NewNameAt

func NewNameAt(pos src.XPos, sym *types.Sym, typ *types.Type) *Name

NewNameAt returns a new ONAME Node associated with symbol s at position pos. The caller is responsible for setting Curfn.

func StaticCalleeName

func StaticCalleeName(n Node) *Name

StaticCalleeName returns the ONAME/PFUNC for n, if known.

func (*Name) Addrtaken

func (n *Name) Addrtaken() bool

func (*Name) Alias

func (n *Name) Alias() bool

Alias reports whether p, which must be for an OTYPE, is a type alias.

func (*Name) AutoTemp

func (n *Name) AutoTemp() bool

func (*Name) Bounded

func (n *Name) Bounded() bool

func (*Name) Byval

func (n *Name) Byval() bool

func (*Name) CanBeAnSSAAux

func (*Name) CanBeAnSSAAux()

func (*Name) CanBeAnSSASym

func (*Name) CanBeAnSSASym()

func (*Name) CanBeNtype

func (*Name) CanBeNtype()

func (*Name) Canonical

func (n *Name) Canonical() *Name

Canonical returns the logical declaration that n represents. If n is a closure variable, then Canonical returns the original Name as it appears in the function that immediately contains the declaration. Otherwise, Canonical simply returns n itself.

func (*Name) CoverageAuxVar

func (n *Name) CoverageAuxVar() bool

func (*Name) CoverageCounter

func (n *Name) CoverageCounter() bool

func (*Name) Format

func (n *Name) Format(s fmt.State, verb rune)

func (*Name) FrameOffset

func (n *Name) FrameOffset() int64

func (*Name) Init

func (n *Name) Init() Nodes

func (*Name) InlFormal

func (n *Name) InlFormal() bool

func (*Name) InlLocal

func (n *Name) InlLocal() bool

func (*Name) IsClosureVar

func (n *Name) IsClosureVar() bool

func (*Name) IsOutputParamHeapAddr

func (n *Name) IsOutputParamHeapAddr() bool

func (*Name) IsOutputParamInRegisters

func (n *Name) IsOutputParamInRegisters() bool

func (*Name) Libfuzzer8BitCounter

func (n *Name) Libfuzzer8BitCounter() bool

func (*Name) Linksym

func (n *Name) Linksym() *obj.LSym

func (*Name) LinksymABI

func (n *Name) LinksymABI(abi obj.ABI) *obj.LSym

func (*Name) MarkNonNil

func (n *Name) MarkNonNil()

func (*Name) MarkReadonly

func (n *Name) MarkReadonly()

MarkReadonly indicates that n is an ONAME with readonly contents.

func (*Name) Name

func (n *Name) Name() *Name

func (*Name) Needzero

func (n *Name) Needzero() bool

func (*Name) NonNil

func (n *Name) NonNil() bool

func (*Name) OnStack

func (n *Name) OnStack() bool

OnStack reports whether variable n may reside on the stack.

func (*Name) OpenDeferSlot

func (n *Name) OpenDeferSlot() bool

func (*Name) Pragma

func (n *Name) Pragma() PragmaFlag

Pragma returns the PragmaFlag for p, which must be for an OTYPE.

func (*Name) PtrInit

func (n *Name) PtrInit() *Nodes

func (*Name) Readonly

func (n *Name) Readonly() bool

func (*Name) RecordFrameOffset

func (n *Name) RecordFrameOffset(offset int64)

RecordFrameOffset records the frame offset for the name. It is used by package types when laying out function arguments.

func (*Name) SetAddrtaken

func (n *Name) SetAddrtaken(b bool)

func (*Name) SetAlias

func (n *Name) SetAlias(alias bool)

SetAlias sets whether p, which must be for an OTYPE, is a type alias.

func (*Name) SetAutoTemp

func (n *Name) SetAutoTemp(b bool)

func (*Name) SetBounded

func (n *Name) SetBounded(b bool)

func (*Name) SetByval

func (n *Name) SetByval(b bool)

func (*Name) SetCoverageAuxVar

func (n *Name) SetCoverageAuxVar(b bool)

func (*Name) SetCoverageCounter

func (n *Name) SetCoverageCounter(b bool)

func (*Name) SetFrameOffset

func (n *Name) SetFrameOffset(x int64)

func (*Name) SetFunc

func (n *Name) SetFunc(x *Func)

func (*Name) SetInit

func (n *Name) SetInit(x Nodes)

func (*Name) SetInlFormal

func (n *Name) SetInlFormal(b bool)

func (*Name) SetInlLocal

func (n *Name) SetInlLocal(b bool)

func (*Name) SetIsClosureVar

func (n *Name) SetIsClosureVar(b bool)

func (*Name) SetIsOutputParamHeapAddr

func (n *Name) SetIsOutputParamHeapAddr(b bool)

func (*Name) SetIsOutputParamInRegisters

func (n *Name) SetIsOutputParamInRegisters(b bool)

func (*Name) SetLibfuzzer8BitCounter

func (n *Name) SetLibfuzzer8BitCounter(b bool)

func (*Name) SetNeedzero

func (n *Name) SetNeedzero(b bool)

func (*Name) SetOpenDeferSlot

func (n *Name) SetOpenDeferSlot(b bool)

func (*Name) SetPragma

func (n *Name) SetPragma(flag PragmaFlag)

SetPragma sets the PragmaFlag for p, which must be for an OTYPE.

func (*Name) SetSubOp

func (n *Name) SetSubOp(x Op)

func (*Name) SetSym

func (n *Name) SetSym(x *types.Sym)

func (*Name) SetTransient

func (n *Name) SetTransient(b bool)

func (*Name) SetType

func (n *Name) SetType(x *types.Type)

func (*Name) SetUsed

func (n *Name) SetUsed(b bool)

func (*Name) SetVal

func (n *Name) SetVal(v constant.Value)

SetVal sets the constant.Value for the node.

func (*Name) SubOp

func (n *Name) SubOp() Op

func (*Name) Sym

func (n *Name) Sym() *types.Sym

func (*Name) Transient

func (n *Name) Transient() bool

func (*Name) Type

func (n *Name) Type() *types.Type

func (*Name) Used

func (n *Name) Used() bool

func (*Name) Val

func (n *Name) Val() constant.Value

Val returns the constant.Value for the node.

type NameQueue

NameQueue is a FIFO queue of *Name. The zero value of NameQueue is a ready-to-use empty queue.

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

func (*NameQueue) Empty

func (q *NameQueue) Empty() bool

Empty reports whether q contains no Names.

func (*NameQueue) PopLeft

func (q *NameQueue) PopLeft() *Name

PopLeft pops a Name from the left of the queue. It panics if q is empty.

func (*NameQueue) PushRight

func (q *NameQueue) PushRight(n *Name)

PushRight appends n to the right of the queue.

type NameSet

NameSet is a set of Names.

type NameSet map[*Name]struct{}

func (*NameSet) Add

func (s *NameSet) Add(n *Name)

Add adds n to s.

func (NameSet) Has

func (s NameSet) Has(n *Name) bool

Has reports whether s contains n.

func (NameSet) Sorted

func (s NameSet) Sorted(less func(*Name, *Name) bool) []*Name

Sorted returns s sorted according to less.

type NilExpr

A NilExpr represents the predefined untyped constant nil.

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

func NewNilExpr

func NewNilExpr(pos src.XPos, typ *types.Type) *NilExpr

func (*NilExpr) Bounded

func (n *NilExpr) Bounded() bool

func (*NilExpr) Format

func (n *NilExpr) Format(s fmt.State, verb rune)

func (*NilExpr) Init

func (n *NilExpr) Init() Nodes

func (*NilExpr) MarkNonNil

func (n *NilExpr) MarkNonNil()

func (*NilExpr) NonNil

func (n *NilExpr) NonNil() bool

func (*NilExpr) PtrInit

func (n *NilExpr) PtrInit() *Nodes

func (*NilExpr) SetBounded

func (n *NilExpr) SetBounded(b bool)

func (*NilExpr) SetInit

func (n *NilExpr) SetInit(x Nodes)

func (*NilExpr) SetTransient

func (n *NilExpr) SetTransient(b bool)

func (*NilExpr) SetType

func (n *NilExpr) SetType(x *types.Type)

func (*NilExpr) Transient

func (n *NilExpr) Transient() bool

func (*NilExpr) Type

func (n *NilExpr) Type() *types.Type

type Node

A Node is the abstract interface to an IR node.

type Node interface {
    // Formatting
    Format(s fmt.State, verb rune)

    // Source position.
    Pos() src.XPos
    SetPos(x src.XPos)

    // Abstract graph structure, for generic traversals.
    Op() Op
    Init() Nodes

    // Fields specific to certain Ops only.
    Type() *types.Type
    SetType(t *types.Type)
    Name() *Name
    Sym() *types.Sym
    Val() constant.Value
    SetVal(v constant.Value)

    // Storage for analysis passes.
    Esc() uint16
    SetEsc(x uint16)

    // Typecheck values:
    //  0 means the node is not typechecked
    //  1 means the node is completely typechecked
    //  2 means typechecking of the node is in progress
    Typecheck() uint8
    SetTypecheck(x uint8)
    NonNil() bool
    MarkNonNil()
    // contains filtered or unexported methods
}

func Copy

func Copy(n Node) Node

Copy returns a shallow copy of n.

func DeepCopy

func DeepCopy(pos src.XPos, n Node) Node

DeepCopy returns a “deep” copy of n, with its entire structure copied (except for shared nodes like ONAME, ONONAME, OLITERAL, and OTYPE). If pos.IsKnown(), it sets the source position of newly allocated Nodes to pos.

func DeepCopyList

func DeepCopyList(pos src.XPos, list []Node) []Node

DeepCopyList returns a list of deep copies (using DeepCopy) of the nodes in list.

func FuncPC

func FuncPC(pos src.XPos, n Node, wantABI obj.ABI) Node

FuncPC returns a uintptr-typed expression that evaluates to the PC of a function as uintptr, as returned by internal/abi.FuncPC{ABI0,ABIInternal}.

n should be a Node of an interface type, as is passed to internal/abi.FuncPC{ABI0,ABIInternal}.

TODO(prattmic): Since n is simply an interface{} there is no assertion that it is actually a function at all. Perhaps we should emit a runtime type assertion?

func InitExpr

func InitExpr(init []Node, expr Node) Node

The result of InitExpr MUST be assigned back to n, e.g.

n.X = InitExpr(init, n.X)

func NewBasicLit

func NewBasicLit(pos src.XPos, typ *types.Type, val constant.Value) Node

NewBasicLit returns an OLITERAL representing val with the given type.

func NewBool

func NewBool(pos src.XPos, b bool) Node

NewBool returns an OLITERAL representing b as an untyped boolean.

func NewConstExpr

func NewConstExpr(val constant.Value, orig Node) Node

NewConstExpr returns an OLITERAL representing val, copying the position and type from orig.

func NewInt

func NewInt(pos src.XPos, v int64) Node

NewInt returns an OLITERAL representing v as an untyped integer.

func NewOne

func NewOne(pos src.XPos, typ *types.Type) Node

NewOne returns an OLITERAL representing 1 with the given type.

func NewString

func NewString(pos src.XPos, s string) Node

NewString returns an OLITERAL representing s as an untyped string.

func NewUintptr

func NewUintptr(pos src.XPos, v int64) Node

NewUintptr returns an OLITERAL representing v as a uintptr.

func NewZero

func NewZero(pos src.XPos, typ *types.Type) Node

NewZero returns a zero value of the given type.

func OuterValue

func OuterValue(n Node) Node

what's the outer value that a write to n affects? outer value means containing struct or array.

func ParamNames

func ParamNames(ft *types.Type) []Node

func StaticValue

func StaticValue(n Node) Node

StaticValue analyzes n to find the earliest expression that always evaluates to the same value as n, which might be from an enclosing function.

For example, given:

var x int = g()
func() {
	y := x
	*p = int(y)
}

calling StaticValue on the "int(y)" expression returns the outer "g()" expression.

func TypeNode

func TypeNode(t *types.Type) Node

TypeNode returns the Node representing the type t.

type Nodes

Nodes is a slice of Node.

type Nodes []Node

func TakeInit

func TakeInit(n Node) Nodes

func ToNodes

func ToNodes[T Node](s []T) Nodes

ToNodes returns s as a slice of Nodes.

func (*Nodes) Append

func (n *Nodes) Append(a ...Node)

Append appends entries to Nodes.

func (Nodes) Copy

func (n Nodes) Copy() Nodes

Copy returns a copy of the content of the slice.

func (Nodes) Format

func (l Nodes) Format(s fmt.State, verb rune)

Format implements formatting for a Nodes. The valid formats are:

%v	Go syntax, semicolon-separated
%.v	Go syntax, comma-separated
%+v	Debug syntax, as in DumpList.

func (*Nodes) Prepend

func (n *Nodes) Prepend(a ...Node)

Prepend prepends entries to Nodes. If a slice is passed in, this will take ownership of it.

func (*Nodes) Take

func (n *Nodes) Take() []Node

Take clears n, returning its former contents.

type Op

type Op uint8

Node ops.

const (
    OXXX Op = iota

    // names
    ONAME // var or func name
    // Unnamed arg or return value: f(int, string) (int, error) { etc }
    // Also used for a qualified package identifier that hasn't been resolved yet.
    ONONAME
    OTYPE    // type name
    OLITERAL // literal
    ONIL     // nil

    // expressions
    OADD          // X + Y
    OSUB          // X - Y
    OOR           // X | Y
    OXOR          // X ^ Y
    OADDSTR       // +{List} (string addition, list elements are strings)
    OADDR         // &X
    OANDAND       // X && Y
    OAPPEND       // append(Args); after walk, X may contain elem type descriptor
    OBYTES2STR    // Type(X) (Type is string, X is a []byte)
    OBYTES2STRTMP // Type(X) (Type is string, X is a []byte, ephemeral)
    ORUNES2STR    // Type(X) (Type is string, X is a []rune)
    OSTR2BYTES    // Type(X) (Type is []byte, X is a string)
    OSTR2BYTESTMP // Type(X) (Type is []byte, X is a string, ephemeral)
    OSTR2RUNES    // Type(X) (Type is []rune, X is a string)
    OSLICE2ARR    // Type(X) (Type is [N]T, X is a []T)
    OSLICE2ARRPTR // Type(X) (Type is *[N]T, X is a []T)
    // X = Y or (if Def=true) X := Y
    // If Def, then Init includes a DCL node for X.
    OAS
    // Lhs = Rhs (x, y, z = a, b, c) or (if Def=true) Lhs := Rhs
    // If Def, then Init includes DCL nodes for Lhs
    OAS2
    OAS2DOTTYPE // Lhs = Rhs (x, ok = I.(int))
    OAS2FUNC    // Lhs = Rhs (x, y = f())
    OAS2MAPR    // Lhs = Rhs (x, ok = m["foo"])
    OAS2RECV    // Lhs = Rhs (x, ok = <-c)
    OASOP       // X AsOp= Y (x += y)
    OCALL       // X(Args) (function call, method call or type conversion)

    // OCALLFUNC, OCALLMETH, and OCALLINTER have the same structure.
    // Prior to walk, they are: X(Args), where Args is all regular arguments.
    // After walk, if any argument whose evaluation might requires temporary variable,
    // that temporary variable will be pushed to Init, Args will contains an updated
    // set of arguments.
    OCALLFUNC  // X(Args) (function call f(args))
    OCALLMETH  // X(Args) (direct method call x.Method(args))
    OCALLINTER // X(Args) (interface method call x.Method(args))
    OCAP       // cap(X)
    OCLEAR     // clear(X)
    OCLOSE     // close(X)
    OCLOSURE   // func Type { Func.Closure.Body } (func literal)
    OCOMPLIT   // Type{List} (composite literal, not yet lowered to specific form)
    OMAPLIT    // Type{List} (composite literal, Type is map)
    OSTRUCTLIT // Type{List} (composite literal, Type is struct)
    OARRAYLIT  // Type{List} (composite literal, Type is array)
    OSLICELIT  // Type{List} (composite literal, Type is slice), Len is slice length.
    OPTRLIT    // &X (X is composite literal)
    OCONV      // Type(X) (type conversion)
    OCONVIFACE // Type(X) (type conversion, to interface)
    OCONVNOP   // Type(X) (type conversion, no effect)
    OCOPY      // copy(X, Y)
    ODCL       // var X (declares X of type X.Type)

    // Used during parsing but don't last.
    ODCLFUNC // func f() or func (r) f()

    ODELETE        // delete(Args)
    ODOT           // X.Sel (X is of struct type)
    ODOTPTR        // X.Sel (X is of pointer to struct type)
    ODOTMETH       // X.Sel (X is non-interface, Sel is method name)
    ODOTINTER      // X.Sel (X is interface, Sel is method name)
    OXDOT          // X.Sel (before rewrite to one of the preceding)
    ODOTTYPE       // X.Ntype or X.Type (.Ntype during parsing, .Type once resolved); after walk, Itab contains address of interface type descriptor and Itab.X contains address of concrete type descriptor
    ODOTTYPE2      // X.Ntype or X.Type (.Ntype during parsing, .Type once resolved; on rhs of OAS2DOTTYPE); after walk, Itab contains address of interface type descriptor
    OEQ            // X == Y
    ONE            // X != Y
    OLT            // X < Y
    OLE            // X <= Y
    OGE            // X >= Y
    OGT            // X > Y
    ODEREF         // *X
    OINDEX         // X[Index] (index of array or slice)
    OINDEXMAP      // X[Index] (index of map)
    OKEY           // Key:Value (key:value in struct/array/map literal)
    OSTRUCTKEY     // Field:Value (key:value in struct literal, after type checking)
    OLEN           // len(X)
    OMAKE          // make(Args) (before type checking converts to one of the following)
    OMAKECHAN      // make(Type[, Len]) (type is chan)
    OMAKEMAP       // make(Type[, Len]) (type is map)
    OMAKESLICE     // make(Type[, Len[, Cap]]) (type is slice)
    OMAKESLICECOPY // makeslicecopy(Type, Len, Cap) (type is slice; Len is length and Cap is the copied from slice)
    // OMAKESLICECOPY is created by the order pass and corresponds to:
    //  s = make(Type, Len); copy(s, Cap)
    //
    // Bounded can be set on the node when Len == len(Cap) is known at compile time.
    //
    // This node is created so the walk pass can optimize this pattern which would
    // otherwise be hard to detect after the order pass.
    OMUL              // X * Y
    ODIV              // X / Y
    OMOD              // X % Y
    OLSH              // X << Y
    ORSH              // X >> Y
    OAND              // X & Y
    OANDNOT           // X &^ Y
    ONEW              // new(X); corresponds to calls to new in source code
    ONOT              // !X
    OBITNOT           // ^X
    OPLUS             // +X
    ONEG              // -X
    OOROR             // X || Y
    OPANIC            // panic(X)
    OPRINT            // print(List)
    OPRINTLN          // println(List)
    OPAREN            // (X)
    OSEND             // Chan <- Value
    OSLICE            // X[Low : High] (X is untypechecked or slice)
    OSLICEARR         // X[Low : High] (X is pointer to array)
    OSLICESTR         // X[Low : High] (X is string)
    OSLICE3           // X[Low : High : Max] (X is untypedchecked or slice)
    OSLICE3ARR        // X[Low : High : Max] (X is pointer to array)
    OSLICEHEADER      // sliceheader{Ptr, Len, Cap} (Ptr is unsafe.Pointer, Len is length, Cap is capacity)
    OSTRINGHEADER     // stringheader{Ptr, Len} (Ptr is unsafe.Pointer, Len is length)
    ORECOVER          // recover()
    ORECOVERFP        // recover(Args) w/ explicit FP argument
    ORECV             // <-X
    ORUNESTR          // Type(X) (Type is string, X is rune)
    OSELRECV2         // like OAS2: Lhs = Rhs where len(Lhs)=2, len(Rhs)=1, Rhs[0].Op = ORECV (appears as .Var of OCASE)
    OMIN              // min(List)
    OMAX              // max(List)
    OREAL             // real(X)
    OIMAG             // imag(X)
    OCOMPLEX          // complex(X, Y)
    OUNSAFEADD        // unsafe.Add(X, Y)
    OUNSAFESLICE      // unsafe.Slice(X, Y)
    OUNSAFESLICEDATA  // unsafe.SliceData(X)
    OUNSAFESTRING     // unsafe.String(X, Y)
    OUNSAFESTRINGDATA // unsafe.StringData(X)
    OMETHEXPR         // X(Args) (method expression T.Method(args), first argument is the method receiver)
    OMETHVALUE        // X.Sel   (method expression t.Method, not called)

    // statements
    OBLOCK // { List } (block of code)
    OBREAK // break [Label]
    // OCASE:  case List: Body (List==nil means default)
    //   For OTYPESW, List is a OTYPE node for the specified type (or OLITERAL
    //   for nil) or an ODYNAMICTYPE indicating a runtime type for generics.
    //   If a type-switch variable is specified, Var is an
    //   ONAME for the version of the type-switch variable with the specified
    //   type.
    OCASE
    OCONTINUE // continue [Label]
    ODEFER    // defer Call
    OFALL     // fallthrough
    OFOR      // for Init; Cond; Post { Body }
    OGOTO     // goto Label
    OIF       // if Init; Cond { Then } else { Else }
    OLABEL    // Label:
    OGO       // go Call
    ORANGE    // for Key, Value = range X { Body }
    ORETURN   // return Results
    OSELECT   // select { Cases }
    OSWITCH   // switch Init; Expr { Cases }
    // OTYPESW:  X := Y.(type) (appears as .Tag of OSWITCH)
    //   X is nil if there is no type-switch variable
    OTYPESW

    // misc
    // intermediate representation of an inlined call.  Uses Init (assignments
    // for the captured variables, parameters, retvars, & INLMARK op),
    // Body (body of the inlined function), and ReturnVars (list of
    // return values)
    OINLCALL         // intermediary representation of an inlined call.
    OMAKEFACE        // construct an interface value from rtype/itab and data pointers
    OITAB            // rtype/itab pointer of an interface value
    OIDATA           // data pointer of an interface value
    OSPTR            // base pointer of a slice or string. Bounded==1 means known non-nil.
    OCFUNC           // reference to c function pointer (not go func value)
    OCHECKNIL        // emit code to ensure pointer/interface not nil
    ORESULT          // result of a function call; Xoffset is stack offset
    OINLMARK         // start of an inlined body, with file/line of caller. Xoffset is an index into the inline tree.
    OLINKSYMOFFSET   // offset within a name
    OJUMPTABLE       // A jump table structure for implementing dense expression switches
    OINTERFACESWITCH // A type switch with interface cases

    // opcodes for generics
    ODYNAMICDOTTYPE  // x = i.(T) where T is a type parameter (or derived from a type parameter)
    ODYNAMICDOTTYPE2 // x, ok = i.(T) where T is a type parameter (or derived from a type parameter)
    ODYNAMICTYPE     // a type node for type switches (represents a dynamic target type for a type switch)

    // arch-specific opcodes
    OTAILCALL    // tail call to another function
    OGETG        // runtime.getg() (read g pointer)
    OGETCALLERPC // runtime.getcallerpc() (continuation PC in caller frame)
    OGETCALLERSP // runtime.getcallersp() (stack pointer in caller frame)

    OEND
)

func (Op) Format

func (o Op) Format(s fmt.State, verb rune)

Format implements formatting for an Op. The valid formats are:

%v	Go syntax ("+", "<-", "print")
%+v	Debug syntax ("ADD", "RECV", "PRINT")

func (Op) GoString

func (o Op) GoString() string

GoString returns the Go syntax for the Op, or else its name.

func (Op) IsCmp

func (op Op) IsCmp() bool

IsCmp reports whether op is a comparison operation (==, !=, <, <=, >, or >=).

func (Op) IsSlice3

func (o Op) IsSlice3() bool

IsSlice3 reports whether o is a slice3 op (OSLICE3, OSLICE3ARR). o must be a slicing op.

func (Op) String

func (i Op) String() string

type Package

A Package holds information about the package being compiled.

type Package struct {
    // Imports, listed in source order.
    // See golang.org/issue/31636.
    Imports []*types.Pkg

    // Init functions, listed in source order.
    Inits []*Func

    // Funcs contains all (instantiated) functions, methods, and
    // function literals to be compiled.
    Funcs []*Func

    // Externs holds constants, (non-generic) types, and variables
    // declared at package scope.
    Externs []*Name

    // AsmHdrDecls holds declared constants and struct types that should
    // be included in -asmhdr output. It's only populated when -asmhdr
    // is set.
    AsmHdrDecls []*Name

    // Cgo directives.
    CgoPragmas [][]string

    // Variables with //go:embed lines.
    Embeds []*Name

    // PluginExports holds exported functions and variables that are
    // accessible through the package plugin API. It's only populated
    // for -buildmode=plugin (i.e., compiling package main and -dynlink
    // is set).
    PluginExports []*Name
}

type ParenExpr

A ParenExpr is a parenthesized expression (X). It may end up being a value or a type.

type ParenExpr struct {
    X Node
    // contains filtered or unexported fields
}

func NewParenExpr

func NewParenExpr(pos src.XPos, x Node) *ParenExpr

func (*ParenExpr) Bounded

func (n *ParenExpr) Bounded() bool

func (*ParenExpr) Format

func (n *ParenExpr) Format(s fmt.State, verb rune)

func (*ParenExpr) Implicit

func (n *ParenExpr) Implicit() bool

func (*ParenExpr) Init

func (n *ParenExpr) Init() Nodes

func (*ParenExpr) MarkNonNil

func (n *ParenExpr) MarkNonNil()

func (*ParenExpr) NonNil

func (n *ParenExpr) NonNil() bool

func (*ParenExpr) PtrInit

func (n *ParenExpr) PtrInit() *Nodes

func (*ParenExpr) SetBounded

func (n *ParenExpr) SetBounded(b bool)

func (*ParenExpr) SetImplicit

func (n *ParenExpr) SetImplicit(b bool)

func (*ParenExpr) SetInit

func (n *ParenExpr) SetInit(x Nodes)

func (*ParenExpr) SetTransient

func (n *ParenExpr) SetTransient(b bool)

func (*ParenExpr) SetType

func (n *ParenExpr) SetType(x *types.Type)

func (*ParenExpr) Transient

func (n *ParenExpr) Transient() bool

func (*ParenExpr) Type

func (n *ParenExpr) Type() *types.Type

type PragmaFlag

type PragmaFlag uint16
const (
    // Func pragmas.
    Nointerface      PragmaFlag = 1 << iota
    Noescape                    // func parameters don't escape
    Norace                      // func must not have race detector annotations
    Nosplit                     // func should not execute on separate stack
    Noinline                    // func should not be inlined
    NoCheckPtr                  // func should not be instrumented by checkptr
    CgoUnsafeArgs               // treat a pointer to one arg as a pointer to them all
    UintptrKeepAlive            // pointers converted to uintptr must be kept alive
    UintptrEscapes              // pointers converted to uintptr escape

    // Runtime-only func pragmas.
    // See ../../../../runtime/HACKING.md for detailed descriptions.
    Systemstack        // func must run on system stack
    Nowritebarrier     // emit compiler error instead of write barrier
    Nowritebarrierrec  // error on write barrier in this or recursive callees
    Yeswritebarrierrec // cancels Nowritebarrierrec in this function and callees

    // Go command pragmas
    GoBuildPragma

    RegisterParams // TODO(register args) remove after register abi is working

)

type RangeStmt

A RangeStmt is a range loop: for Key, Value = range X { Body }

type RangeStmt struct {
    Label        *types.Sym
    Def          bool
    X            Node
    RType        Node `mknode:"-"` // see reflectdata/helpers.go
    Key          Node
    Value        Node
    Body         Nodes
    DistinctVars bool
    Prealloc     *Name

    // When desugaring the RangeStmt during walk, the assignments to Key
    // and Value may require OCONVIFACE operations. If so, these fields
    // will be copied to their respective ConvExpr fields.
    KeyTypeWord   Node `mknode:"-"`
    KeySrcRType   Node `mknode:"-"`
    ValueTypeWord Node `mknode:"-"`
    ValueSrcRType Node `mknode:"-"`
    // contains filtered or unexported fields
}

func NewRangeStmt

func NewRangeStmt(pos src.XPos, key, value, x Node, body []Node, distinctVars bool) *RangeStmt

func (*RangeStmt) Format

func (n *RangeStmt) Format(s fmt.State, verb rune)

func (*RangeStmt) Init

func (n *RangeStmt) Init() Nodes

func (*RangeStmt) PtrInit

func (n *RangeStmt) PtrInit() *Nodes

func (*RangeStmt) SetInit

func (n *RangeStmt) SetInit(x Nodes)

type ReassignOracle

A ReassignOracle efficiently answers queries about whether local variables are reassigned. This helper works by looking for function params and short variable declarations (e.g. https://go.dev/ref/spec#Short_variable_declarations) that are neither address taken nor subsequently re-assigned. It is intended to operate much like "ir.StaticValue" and "ir.Reassigned", but in a way that does just a single walk of the containing function (as opposed to a new walk on every call).

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

func (*ReassignOracle) Init

func (ro *ReassignOracle) Init(fn *Func)

Init initializes the oracle based on the IR in function fn, laying the groundwork for future calls to the StaticValue and Reassigned methods. If the fn's IR is subsequently modified, Init must be called again.

func (*ReassignOracle) Reassigned

func (ro *ReassignOracle) Reassigned(n *Name) bool

Reassigned method has the same semantics as the ir package function of the same name; see comments on Reassigned for more info.

func (*ReassignOracle) StaticValue

func (ro *ReassignOracle) StaticValue(n Node) Node

StaticValue method has the same semantics as the ir package function of the same name; see comments on StaticValue.

type ResultExpr

A ResultExpr represents a direct access to a result.

type ResultExpr struct {
    Index int64 // index of the result expr.
    // contains filtered or unexported fields
}

func NewResultExpr

func NewResultExpr(pos src.XPos, typ *types.Type, index int64) *ResultExpr

func (*ResultExpr) Bounded

func (n *ResultExpr) Bounded() bool

func (*ResultExpr) Format

func (n *ResultExpr) Format(s fmt.State, verb rune)

func (*ResultExpr) Init

func (n *ResultExpr) Init() Nodes

func (*ResultExpr) MarkNonNil

func (n *ResultExpr) MarkNonNil()

func (*ResultExpr) NonNil

func (n *ResultExpr) NonNil() bool

func (*ResultExpr) PtrInit

func (n *ResultExpr) PtrInit() *Nodes

func (*ResultExpr) SetBounded

func (n *ResultExpr) SetBounded(b bool)

func (*ResultExpr) SetInit

func (n *ResultExpr) SetInit(x Nodes)

func (*ResultExpr) SetTransient

func (n *ResultExpr) SetTransient(b bool)

func (*ResultExpr) SetType

func (n *ResultExpr) SetType(x *types.Type)

func (*ResultExpr) Transient

func (n *ResultExpr) Transient() bool

func (*ResultExpr) Type

func (n *ResultExpr) Type() *types.Type

type ReturnStmt

A ReturnStmt is a return statement.

type ReturnStmt struct {
    Results Nodes // return list
    // contains filtered or unexported fields
}

func NewReturnStmt

func NewReturnStmt(pos src.XPos, results []Node) *ReturnStmt

func (*ReturnStmt) Format

func (n *ReturnStmt) Format(s fmt.State, verb rune)

func (*ReturnStmt) Init

func (n *ReturnStmt) Init() Nodes

func (*ReturnStmt) PtrInit

func (n *ReturnStmt) PtrInit() *Nodes

func (*ReturnStmt) SetInit

func (n *ReturnStmt) SetInit(x Nodes)

type ScopeID

A ScopeID represents a lexical scope within a function.

type ScopeID int32

type SelectStmt

A SelectStmt is a block: { Cases }.

type SelectStmt struct {
    Label *types.Sym
    Cases []*CommClause

    // TODO(rsc): Instead of recording here, replace with a block?
    Compiled Nodes // compiled form, after walkSelect
    // contains filtered or unexported fields
}

func NewSelectStmt

func NewSelectStmt(pos src.XPos, cases []*CommClause) *SelectStmt

func (*SelectStmt) Format

func (n *SelectStmt) Format(s fmt.State, verb rune)

func (*SelectStmt) Init

func (n *SelectStmt) Init() Nodes

func (*SelectStmt) PtrInit

func (n *SelectStmt) PtrInit() *Nodes

func (*SelectStmt) SetInit

func (n *SelectStmt) SetInit(x Nodes)

type SelectorExpr

A SelectorExpr is a selector expression X.Sel.

type SelectorExpr struct {
    X Node
    // Sel is the name of the field or method being selected, without (in the
    // case of methods) any preceding type specifier. If the field/method is
    // exported, than the Sym uses the local package regardless of the package
    // of the containing type.
    Sel *types.Sym
    // The actual selected field - may not be filled in until typechecking.
    Selection *types.Field
    Prealloc  *Name // preallocated storage for OMETHVALUE, if any
    // contains filtered or unexported fields
}

func NewSelectorExpr

func NewSelectorExpr(pos src.XPos, op Op, x Node, sel *types.Sym) *SelectorExpr

func (*SelectorExpr) Bounded

func (n *SelectorExpr) Bounded() bool

func (*SelectorExpr) Format

func (n *SelectorExpr) Format(s fmt.State, verb rune)

func (*SelectorExpr) FuncName

func (n *SelectorExpr) FuncName() *Name

func (*SelectorExpr) Implicit

func (n *SelectorExpr) Implicit() bool

func (*SelectorExpr) Init

func (n *SelectorExpr) Init() Nodes

func (*SelectorExpr) MarkNonNil

func (n *SelectorExpr) MarkNonNil()

func (*SelectorExpr) NonNil

func (n *SelectorExpr) NonNil() bool

func (*SelectorExpr) Offset

func (n *SelectorExpr) Offset() int64

func (*SelectorExpr) PtrInit

func (n *SelectorExpr) PtrInit() *Nodes

func (*SelectorExpr) SetBounded

func (n *SelectorExpr) SetBounded(b bool)

func (*SelectorExpr) SetImplicit

func (n *SelectorExpr) SetImplicit(b bool)

func (*SelectorExpr) SetInit

func (n *SelectorExpr) SetInit(x Nodes)

func (*SelectorExpr) SetOp

func (n *SelectorExpr) SetOp(op Op)

func (*SelectorExpr) SetTransient

func (n *SelectorExpr) SetTransient(b bool)

func (*SelectorExpr) SetType

func (n *SelectorExpr) SetType(x *types.Type)

func (*SelectorExpr) Sym

func (n *SelectorExpr) Sym() *types.Sym

func (*SelectorExpr) Transient

func (n *SelectorExpr) Transient() bool

func (*SelectorExpr) Type

func (n *SelectorExpr) Type() *types.Type

type SendStmt

A SendStmt is a send statement: X <- Y.

type SendStmt struct {
    Chan  Node
    Value Node
    // contains filtered or unexported fields
}

func NewSendStmt

func NewSendStmt(pos src.XPos, ch, value Node) *SendStmt

func (*SendStmt) Format

func (n *SendStmt) Format(s fmt.State, verb rune)

func (*SendStmt) Init

func (n *SendStmt) Init() Nodes

func (*SendStmt) PtrInit

func (n *SendStmt) PtrInit() *Nodes

func (*SendStmt) SetInit

func (n *SendStmt) SetInit(x Nodes)

type SliceExpr

A SliceExpr is a slice expression X[Low:High] or X[Low:High:Max].

type SliceExpr struct {
    X    Node
    Low  Node
    High Node
    Max  Node
    // contains filtered or unexported fields
}

func NewSliceExpr

func NewSliceExpr(pos src.XPos, op Op, x, low, high, max Node) *SliceExpr

func (*SliceExpr) Bounded

func (n *SliceExpr) Bounded() bool

func (*SliceExpr) Format

func (n *SliceExpr) Format(s fmt.State, verb rune)

func (*SliceExpr) Init

func (n *SliceExpr) Init() Nodes

func (*SliceExpr) MarkNonNil

func (n *SliceExpr) MarkNonNil()

func (*SliceExpr) NonNil

func (n *SliceExpr) NonNil() bool

func (*SliceExpr) PtrInit

func (n *SliceExpr) PtrInit() *Nodes

func (*SliceExpr) SetBounded

func (n *SliceExpr) SetBounded(b bool)

func (*SliceExpr) SetInit

func (n *SliceExpr) SetInit(x Nodes)

func (*SliceExpr) SetOp

func (n *SliceExpr) SetOp(op Op)

func (*SliceExpr) SetTransient

func (n *SliceExpr) SetTransient(b bool)

func (*SliceExpr) SetType

func (n *SliceExpr) SetType(x *types.Type)

func (*SliceExpr) Transient

func (n *SliceExpr) Transient() bool

func (*SliceExpr) Type

func (n *SliceExpr) Type() *types.Type

type SliceHeaderExpr

A SliceHeader expression constructs a slice header from its parts.

type SliceHeaderExpr struct {
    Ptr Node
    Len Node
    Cap Node
    // contains filtered or unexported fields
}

func NewSliceHeaderExpr

func NewSliceHeaderExpr(pos src.XPos, typ *types.Type, ptr, len, cap Node) *SliceHeaderExpr

func (*SliceHeaderExpr) Bounded

func (n *SliceHeaderExpr) Bounded() bool

func (*SliceHeaderExpr) Format

func (n *SliceHeaderExpr) Format(s fmt.State, verb rune)

func (*SliceHeaderExpr) Init

func (n *SliceHeaderExpr) Init() Nodes

func (*SliceHeaderExpr) MarkNonNil

func (n *SliceHeaderExpr) MarkNonNil()

func (*SliceHeaderExpr) NonNil

func (n *SliceHeaderExpr) NonNil() bool

func (*SliceHeaderExpr) PtrInit

func (n *SliceHeaderExpr) PtrInit() *Nodes

func (*SliceHeaderExpr) SetBounded

func (n *SliceHeaderExpr) SetBounded(b bool)

func (*SliceHeaderExpr) SetInit

func (n *SliceHeaderExpr) SetInit(x Nodes)

func (*SliceHeaderExpr) SetTransient

func (n *SliceHeaderExpr) SetTransient(b bool)

func (*SliceHeaderExpr) SetType

func (n *SliceHeaderExpr) SetType(x *types.Type)

func (*SliceHeaderExpr) Transient

func (n *SliceHeaderExpr) Transient() bool

func (*SliceHeaderExpr) Type

func (n *SliceHeaderExpr) Type() *types.Type

type StarExpr

A StarExpr is a dereference expression *X. It may end up being a value or a type.

type StarExpr struct {
    X Node
    // contains filtered or unexported fields
}

func NewStarExpr

func NewStarExpr(pos src.XPos, x Node) *StarExpr

func (*StarExpr) Bounded

func (n *StarExpr) Bounded() bool

func (*StarExpr) Format

func (n *StarExpr) Format(s fmt.State, verb rune)

func (*StarExpr) Implicit

func (n *StarExpr) Implicit() bool

func (*StarExpr) Init

func (n *StarExpr) Init() Nodes

func (*StarExpr) MarkNonNil

func (n *StarExpr) MarkNonNil()

func (*StarExpr) NonNil

func (n *StarExpr) NonNil() bool

func (*StarExpr) PtrInit

func (n *StarExpr) PtrInit() *Nodes

func (*StarExpr) SetBounded

func (n *StarExpr) SetBounded(b bool)

func (*StarExpr) SetImplicit

func (n *StarExpr) SetImplicit(b bool)

func (*StarExpr) SetInit

func (n *StarExpr) SetInit(x Nodes)

func (*StarExpr) SetTransient

func (n *StarExpr) SetTransient(b bool)

func (*StarExpr) SetType

func (n *StarExpr) SetType(x *types.Type)

func (*StarExpr) Transient

func (n *StarExpr) Transient() bool

func (*StarExpr) Type

func (n *StarExpr) Type() *types.Type

type Stmt

A Stmt is a Node that can appear as a statement. This includes statement-like expressions such as f().

(It's possible it should include <-c, but that would require splitting ORECV out of UnaryExpr, which hasn't yet been necessary. Maybe instead we will introduce ExprStmt at some point.)

type Stmt interface {
    Node
    // contains filtered or unexported methods
}

type StringHeaderExpr

A StringHeaderExpr expression constructs a string header from its parts.

type StringHeaderExpr struct {
    Ptr Node
    Len Node
    // contains filtered or unexported fields
}

func NewStringHeaderExpr

func NewStringHeaderExpr(pos src.XPos, ptr, len Node) *StringHeaderExpr

func (*StringHeaderExpr) Bounded

func (n *StringHeaderExpr) Bounded() bool

func (*StringHeaderExpr) Format

func (n *StringHeaderExpr) Format(s fmt.State, verb rune)

func (*StringHeaderExpr) Init

func (n *StringHeaderExpr) Init() Nodes

func (*StringHeaderExpr) MarkNonNil

func (n *StringHeaderExpr) MarkNonNil()

func (*StringHeaderExpr) NonNil

func (n *StringHeaderExpr) NonNil() bool

func (*StringHeaderExpr) PtrInit

func (n *StringHeaderExpr) PtrInit() *Nodes

func (*StringHeaderExpr) SetBounded

func (n *StringHeaderExpr) SetBounded(b bool)

func (*StringHeaderExpr) SetInit

func (n *StringHeaderExpr) SetInit(x Nodes)

func (*StringHeaderExpr) SetTransient

func (n *StringHeaderExpr) SetTransient(b bool)

func (*StringHeaderExpr) SetType

func (n *StringHeaderExpr) SetType(x *types.Type)

func (*StringHeaderExpr) Transient

func (n *StringHeaderExpr) Transient() bool

func (*StringHeaderExpr) Type

func (n *StringHeaderExpr) Type() *types.Type

type StructKeyExpr

A StructKeyExpr is a Field: Value composite literal key.

type StructKeyExpr struct {
    Field *types.Field
    Value Node
    // contains filtered or unexported fields
}

func NewStructKeyExpr

func NewStructKeyExpr(pos src.XPos, field *types.Field, value Node) *StructKeyExpr

func (*StructKeyExpr) Bounded

func (n *StructKeyExpr) Bounded() bool

func (*StructKeyExpr) Format

func (n *StructKeyExpr) Format(s fmt.State, verb rune)

func (*StructKeyExpr) Init

func (n *StructKeyExpr) Init() Nodes

func (*StructKeyExpr) MarkNonNil

func (n *StructKeyExpr) MarkNonNil()

func (*StructKeyExpr) NonNil

func (n *StructKeyExpr) NonNil() bool

func (*StructKeyExpr) PtrInit

func (n *StructKeyExpr) PtrInit() *Nodes

func (*StructKeyExpr) SetBounded

func (n *StructKeyExpr) SetBounded(b bool)

func (*StructKeyExpr) SetInit

func (n *StructKeyExpr) SetInit(x Nodes)

func (*StructKeyExpr) SetTransient

func (n *StructKeyExpr) SetTransient(b bool)

func (*StructKeyExpr) SetType

func (n *StructKeyExpr) SetType(x *types.Type)

func (*StructKeyExpr) Sym

func (n *StructKeyExpr) Sym() *types.Sym

func (*StructKeyExpr) Transient

func (n *StructKeyExpr) Transient() bool

func (*StructKeyExpr) Type

func (n *StructKeyExpr) Type() *types.Type

type SwitchStmt

A SwitchStmt is a switch statement: switch Init; Tag { Cases }.

type SwitchStmt struct {
    Tag   Node
    Cases []*CaseClause
    Label *types.Sym

    // TODO(rsc): Instead of recording here, replace with a block?
    Compiled Nodes // compiled form, after walkSwitch
    // contains filtered or unexported fields
}

func NewSwitchStmt

func NewSwitchStmt(pos src.XPos, tag Node, cases []*CaseClause) *SwitchStmt

func (*SwitchStmt) Format

func (n *SwitchStmt) Format(s fmt.State, verb rune)

func (*SwitchStmt) Init

func (n *SwitchStmt) Init() Nodes

func (*SwitchStmt) PtrInit

func (n *SwitchStmt) PtrInit() *Nodes

func (*SwitchStmt) SetInit

func (n *SwitchStmt) SetInit(x Nodes)

type SymAndPos

type SymAndPos struct {
    Sym *obj.LSym // LSym of callee
    Pos src.XPos  // line of call
}

type TailCallStmt

A TailCallStmt is a tail call statement, which is used for back-end code generation to jump directly to another function entirely.

type TailCallStmt struct {
    Call *CallExpr // the underlying call
    // contains filtered or unexported fields
}

func NewTailCallStmt

func NewTailCallStmt(pos src.XPos, call *CallExpr) *TailCallStmt

func (*TailCallStmt) Format

func (n *TailCallStmt) Format(s fmt.State, verb rune)

func (*TailCallStmt) Init

func (n *TailCallStmt) Init() Nodes

func (*TailCallStmt) PtrInit

func (n *TailCallStmt) PtrInit() *Nodes

func (*TailCallStmt) SetInit

func (n *TailCallStmt) SetInit(x Nodes)

type TypeAssertExpr

A TypeAssertionExpr is a selector expression X.(Type). Before type-checking, the type is Ntype.

type TypeAssertExpr struct {
    X Node

    // Runtime type information provided by walkDotType for
    // assertions from non-empty interface to concrete type.
    ITab Node `mknode:"-"` // *runtime.itab for Type implementing X's type

    // An internal/abi.TypeAssert descriptor to pass to the runtime.
    Descriptor *obj.LSym
    // contains filtered or unexported fields
}

func NewTypeAssertExpr

func NewTypeAssertExpr(pos src.XPos, x Node, typ *types.Type) *TypeAssertExpr

func (*TypeAssertExpr) Bounded

func (n *TypeAssertExpr) Bounded() bool

func (*TypeAssertExpr) Format

func (n *TypeAssertExpr) Format(s fmt.State, verb rune)

func (*TypeAssertExpr) Init

func (n *TypeAssertExpr) Init() Nodes

func (*TypeAssertExpr) MarkNonNil

func (n *TypeAssertExpr) MarkNonNil()

func (*TypeAssertExpr) NonNil

func (n *TypeAssertExpr) NonNil() bool

func (*TypeAssertExpr) PtrInit

func (n *TypeAssertExpr) PtrInit() *Nodes

func (*TypeAssertExpr) SetBounded

func (n *TypeAssertExpr) SetBounded(b bool)

func (*TypeAssertExpr) SetInit

func (n *TypeAssertExpr) SetInit(x Nodes)

func (*TypeAssertExpr) SetOp

func (n *TypeAssertExpr) SetOp(op Op)

func (*TypeAssertExpr) SetTransient

func (n *TypeAssertExpr) SetTransient(b bool)

func (*TypeAssertExpr) SetType

func (n *TypeAssertExpr) SetType(x *types.Type)

func (*TypeAssertExpr) Transient

func (n *TypeAssertExpr) Transient() bool

func (*TypeAssertExpr) Type

func (n *TypeAssertExpr) Type() *types.Type

type TypeSwitchGuard

A TypeSwitchGuard is the [Name :=] X.(type) in a type switch.

type TypeSwitchGuard struct {
    Tag  *Ident
    X    Node
    Used bool
    // contains filtered or unexported fields
}

func NewTypeSwitchGuard

func NewTypeSwitchGuard(pos src.XPos, tag *Ident, x Node) *TypeSwitchGuard

func (*TypeSwitchGuard) Esc

func (n *TypeSwitchGuard) Esc() uint16

func (*TypeSwitchGuard) Format

func (n *TypeSwitchGuard) Format(s fmt.State, verb rune)

func (*TypeSwitchGuard) Init

func (n *TypeSwitchGuard) Init() Nodes

func (*TypeSwitchGuard) MarkNonNil

func (n *TypeSwitchGuard) MarkNonNil()

func (*TypeSwitchGuard) Name

func (n *TypeSwitchGuard) Name() *Name

func (*TypeSwitchGuard) NonNil

func (n *TypeSwitchGuard) NonNil() bool

func (*TypeSwitchGuard) Op

func (n *TypeSwitchGuard) Op() Op

op can be read, but not written. An embedding implementation can provide a SetOp if desired. (The panicking SetOp is with the other panics below.)

func (*TypeSwitchGuard) Pos

func (n *TypeSwitchGuard) Pos() src.XPos

func (*TypeSwitchGuard) SetEsc

func (n *TypeSwitchGuard) SetEsc(x uint16)

func (*TypeSwitchGuard) SetPos

func (n *TypeSwitchGuard) SetPos(x src.XPos)

func (*TypeSwitchGuard) SetType

func (n *TypeSwitchGuard) SetType(*types.Type)

func (*TypeSwitchGuard) SetTypecheck

func (n *TypeSwitchGuard) SetTypecheck(x uint8)

func (*TypeSwitchGuard) SetVal

func (n *TypeSwitchGuard) SetVal(v constant.Value)

func (*TypeSwitchGuard) SetWalked

func (n *TypeSwitchGuard) SetWalked(x bool)

func (*TypeSwitchGuard) Sym

func (n *TypeSwitchGuard) Sym() *types.Sym

func (*TypeSwitchGuard) Type

func (n *TypeSwitchGuard) Type() *types.Type

func (*TypeSwitchGuard) Typecheck

func (n *TypeSwitchGuard) Typecheck() uint8

func (*TypeSwitchGuard) Val

func (n *TypeSwitchGuard) Val() constant.Value

func (*TypeSwitchGuard) Walked

func (n *TypeSwitchGuard) Walked() bool

type UnaryExpr

A UnaryExpr is a unary expression Op X, or Op(X) for a builtin function that does not end up being a call.

type UnaryExpr struct {
    X Node
    // contains filtered or unexported fields
}

func NewUnaryExpr

func NewUnaryExpr(pos src.XPos, op Op, x Node) *UnaryExpr

func (*UnaryExpr) Bounded

func (n *UnaryExpr) Bounded() bool

func (*UnaryExpr) Format

func (n *UnaryExpr) Format(s fmt.State, verb rune)

func (*UnaryExpr) Init

func (n *UnaryExpr) Init() Nodes

func (*UnaryExpr) MarkNonNil

func (n *UnaryExpr) MarkNonNil()

func (*UnaryExpr) NonNil

func (n *UnaryExpr) NonNil() bool

func (*UnaryExpr) PtrInit

func (n *UnaryExpr) PtrInit() *Nodes

func (*UnaryExpr) SetBounded

func (n *UnaryExpr) SetBounded(b bool)

func (*UnaryExpr) SetInit

func (n *UnaryExpr) SetInit(x Nodes)

func (*UnaryExpr) SetOp

func (n *UnaryExpr) SetOp(op Op)

func (*UnaryExpr) SetTransient

func (n *UnaryExpr) SetTransient(b bool)

func (*UnaryExpr) SetType

func (n *UnaryExpr) SetType(x *types.Type)

func (*UnaryExpr) Transient

func (n *UnaryExpr) Transient() bool

func (*UnaryExpr) Type

func (n *UnaryExpr) Type() *types.Type

type WasmImport

WasmImport stores metadata associated with the //go:wasmimport pragma.

type WasmImport struct {
    Module string
    Name   string
}

Bugs