go/src/cmd/compile/internal/ir/expr.go

type Expr

type miniExpr

const miniExprNonNil

const miniExprTransient

const miniExprBounded

const miniExprImplicit

const miniExprCheckPtr

func (*miniExpr) isExpr() {}

func (n *miniExpr) Type() *types.Type     {}

func (n *miniExpr) SetType(x *types.Type) {}

func (n *miniExpr) NonNil() bool          {}

func (n *miniExpr) MarkNonNil()           {}

func (n *miniExpr) Transient() bool       {}

func (n *miniExpr) SetTransient(b bool)   {}

func (n *miniExpr) Bounded() bool         {}

func (n *miniExpr) SetBounded(b bool)     {}

func (n *miniExpr) Init() Nodes           {}

func (n *miniExpr) PtrInit() *Nodes       {}

func (n *miniExpr) SetInit(x Nodes)       {}

type AddStringExpr

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

type AddrExpr

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

func (n *AddrExpr) Implicit() bool     {}

func (n *AddrExpr) SetImplicit(b bool) {}

func (n *AddrExpr) SetOp(op Op) {}

type BasicLit

// NewBasicLit returns an OLITERAL representing val with the given type.
func NewBasicLit(pos src.XPos, typ *types.Type, val constant.Value) Node {}

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

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

// NewConstExpr returns an OLITERAL representing val, copying the
// position and type from orig.
func NewConstExpr(val constant.Value, orig Node) Node {}

type BinaryExpr

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

func (n *BinaryExpr) SetOp(op Op) {}

type CallExpr

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

func (*CallExpr) isStmt() {}

func (n *CallExpr) SetOp(op Op) {}

type ClosureExpr

type CompLitExpr

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

func (n *CompLitExpr) Implicit() bool     {}

func (n *CompLitExpr) SetImplicit(b bool) {}

func (n *CompLitExpr) SetOp(op Op) {}

type ConvExpr

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

func (n *ConvExpr) Implicit() bool     {}

func (n *ConvExpr) SetImplicit(b bool) {}

func (n *ConvExpr) CheckPtr() bool     {}

func (n *ConvExpr) SetCheckPtr(b bool) {}

func (n *ConvExpr) SetOp(op Op) {}

type IndexExpr

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

func (n *IndexExpr) SetOp(op Op) {}

type KeyExpr

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

type StructKeyExpr

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

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

type InlinedCallExpr

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

func (n *InlinedCallExpr) SingleResult() Node {}

type LogicalExpr

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

func (n *LogicalExpr) SetOp(op Op) {}

type MakeExpr

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

func (n *MakeExpr) SetOp(op Op) {}

type NilExpr

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

type ParenExpr

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

func (n *ParenExpr) Implicit() bool     {}

func (n *ParenExpr) SetImplicit(b bool) {}

type ResultExpr

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

type LinksymOffsetExpr

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

// NewLinksymExpr is NewLinksymOffsetExpr, but with offset fixed at 0.
func NewLinksymExpr(pos src.XPos, lsym *obj.LSym, typ *types.Type) *LinksymOffsetExpr {}

// NewNameOffsetExpr is NewLinksymOffsetExpr, but taking a *Name
// representing a global variable instead of an *obj.LSym directly.
func NewNameOffsetExpr(pos src.XPos, name *Name, offset int64, typ *types.Type) *LinksymOffsetExpr {}

type SelectorExpr

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

func (n *SelectorExpr) SetOp(op Op) {}

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

func (n *SelectorExpr) Implicit() bool     {}

func (n *SelectorExpr) SetImplicit(b bool) {}

func (n *SelectorExpr) Offset() int64      {}

func (n *SelectorExpr) FuncName() *Name {}

type SliceExpr

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

func (n *SliceExpr) SetOp(op Op) {}

// IsSlice3 reports whether o is a slice3 op (OSLICE3, OSLICE3ARR).
// o must be a slicing op.
func (o Op) IsSlice3() bool {}

type SliceHeaderExpr

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

type StringHeaderExpr

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

type StarExpr

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

func (n *StarExpr) Implicit() bool     {}

func (n *StarExpr) SetImplicit(b bool) {}

type TypeAssertExpr

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

func (n *TypeAssertExpr) SetOp(op Op) {}

type DynamicTypeAssertExpr

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

func (n *DynamicTypeAssertExpr) SetOp(op Op) {}

type UnaryExpr

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

func (n *UnaryExpr) SetOp(op Op) {}

func IsZero(n Node) bool {}

// lvalue etc
func IsAddressable(n Node) bool {}

// 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 StaticValue(n Node) Node {}

func staticValue1(nn Node) Node {}

// 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 Reassigned(name *Name) bool {}

// StaticCalleeName returns the ONAME/PFUNC for n, if known.
func StaticCalleeName(n Node) *Name {}

var IsIntrinsicCall

// 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:
//   - be the same expression
//   - not have side-effects (no function calls, no channel ops);
//     however, panics are ok
//   - not cause inappropriate aliasing; e.g. two string to []byte
//     conversions, must result in two distinct slices
//
// 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 SameSafeExpr(l Node, r Node) bool {}

// ShouldCheckPtr reports whether pointer checking should be enabled for
// function fn at a given level. See debugHelpFooter for defined
// levels.
func ShouldCheckPtr(fn *Func, level int) bool {}

// ShouldAsanCheckPtr reports whether pointer checking should be enabled for
// function fn when -asan is enabled.
func ShouldAsanCheckPtr(fn *Func) bool {}

// IsReflectHeaderDataField reports whether l is an expression p.Data
// where p has type reflect.SliceHeader or reflect.StringHeader.
func IsReflectHeaderDataField(l Node) bool {}

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

// 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 MethodSym(recv *types.Type, msym *types.Sym) *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 MethodSymSuffix(recv *types.Type, msym *types.Sym, suffix string) *types.Sym {}

// 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 LookupMethodSelector(pkg *types.Pkg, name string) (typ, meth *types.Sym, err error) {}

// splitType splits a local symbol name into type and method (fn). If this a
// free function, typ == "".
//
// N.B. closures and methods can be ambiguous (e.g., bar.func1). These cases
// are returned as methods.
func splitType(name string) (typ, fn string) {}

// MethodExprName returns the ONAME representing the method
// referenced by expression n, which must be a method selector,
// method expression, or method value.
func MethodExprName(n Node) *Name {}

// MethodExprFunc is like MethodExprName, but returns the types.Field instead.
func MethodExprFunc(n Node) *types.Field {}