# Functions
Any looks for a non-nil node x in the IR tree rooted at n for which cond(x) returns true.
AnyList calls Any(x, cond) for each node x in the list, in order.
No description provided by the author
No description provided by the author
BoolVal returns n as a bool.
ClosureDebugRuntimeCheck applies boilerplate checks for debug flags and compiling runtime.
ConstOverflow reports whether constant value v is too large to represent with type t.
No description provided by the author
Copy returns a shallow copy of n.
DeclaredBy reports whether expression x refers (directly) to a variable that was declared by the given statement.
DeepCopy returns a “deep” copy of n, with its entire structure copied (except for shared nodes like ONAME, ONONAME, OLITERAL, and OTYPE).
DeepCopyList returns a list of deep copies (using DeepCopy) of the nodes in list.
DoChildren calls do(x) on each of n's non-nil child nodes x.
Dump prints the message s followed by a debug dump of n.
DumpAny is like FDumpAny but prints to stderr.
DumpList prints the message s followed by a debug dump of each node in the list.
EditChildren edits the child nodes of n, replacing each child x with edit(x).
EditChildrenWithHidden is like EditChildren, but also edits Node-typed fields tagged with `mknode:"-"`.
FDumpAny prints the structure of a rooted data structure to w by depth-first traversal of the data structure.
FDumpList prints to w the message s followed by a debug dump of each node in the list.
FuncName returns the name (without the package) of the function f.
FuncPC returns a uintptr-typed expression that evaluates to the PC of a function as uintptr, as returned by github.com/go-asm/go/abi.FuncPC{ABI0,ABIInternal}.
No description provided by the author
HasUniquePos reports whether n has a unique position that can be used for reporting error messages.
The result of InitExpr MUST be assigned back to n, e.g.
InitLSym defines f's obj.LSym and initializes it based on the properties of f.
Int64Val returns n as an int64.
IntVal returns v converted to int64.
lvalue etc.
IsAutoTmp indicates if n was created by the compiler as a temporary, based on the setting of the .AutoTemp flag in n's Name.
No description provided by the author
No description provided by the author
IsConstNode reports whether n is a Go language constant (as opposed to a compile-time constant).
IsFuncPCIntrinsic returns whether n is a direct call of github.com/go-asm/go/abi.FuncPCABIxxx functions.
IsIfaceOfFunc inspects whether n is an interface conversion from a direct reference of a func.
IsMethod reports whether n is a method.
IsNil reports whether n represents the universal untyped zero value "nil".
IsReflectHeaderDataField reports whether l is an expression p.Data where p has type reflect.SliceHeader or reflect.StringHeader.
No description provided by the author
No description provided by the author
IsTrivialClosure reports whether closure clo has an empty list of captured vars.
No description provided by the author
Line returns n's position as a string.
LinkFuncName returns the name of the function f, as it will appear in the symbol table of the final linked binary.
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.
MayBeShared reports whether n may occur in multiple places in the AST.
MethodExprFunc is like MethodExprName, but returns the types.Field instead.
MethodExprName returns the ONAME representing the method referenced by expression n, which must be a method selector, method expression, or method value.
MethodSym returns the method symbol representing a method name associated with a specific receiver type.
MethodSymSuffix is like MethodSym, but allows attaching a distinguisher suffix.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewBasicLit returns an OLITERAL representing val with the given type.
No description provided by the author
No description provided by the author
NewBool returns an OLITERAL representing b as an untyped boolean.
No description provided by the author
NewBuiltin returns a new Name representing a builtin function, either predeclared or from package unsafe.
No description provided by the author
No description provided by the author
NewClosureFunc creates a new Func to represent a function literal with the given type.
NewClosureVar returns a new closure variable for fn to refer to outer variable n.
No description provided by the author
No description provided by the author
NewConstAt returns a new OLITERAL Node associated with symbol s at position pos.
NewConstExpr returns an OLITERAL representing val, copying the position and type from orig.
No description provided by the author
No description provided by the author
NewDeclNameAt returns a new Name associated with symbol s at position pos.
No description provided by the author
No description provided by the author
No description provided by the author
NewFunc returns a new Func with the given name and type.
No description provided by the author
NewHiddenParam returns a new hidden parameter for fn with the given name and type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewInt returns an OLITERAL representing v as an untyped integer.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewLinksymExpr is NewLinksymOffsetExpr, but with offset fixed at 0.
No description provided by the author
No description provided by the author
No description provided by the author
NewNameAt returns a new ONAME Node associated with symbol s at position pos.
NewNameOffsetExpr is NewLinksymOffsetExpr, but taking a *Name representing a global variable instead of an *obj.LSym directly.
No description provided by the author
NewOne returns an OLITERAL representing 1 with the given type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewString returns an OLITERAL representing s as an untyped string.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewUintptr returns an OLITERAL representing v as a uintptr.
No description provided by the author
NewZero returns a zero value of the given type.
what's the outer value that a write to n affects? outer value means containing struct or array.
No description provided by the author
ParseLinkFuncName parsers a symbol name (as returned from LinkFuncName) back to the package path and local symbol name.
PkgFuncName returns the name of the function referenced by f, with package prepended.
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.
SameSafeExpr checks whether it is safe to reuse one of l and r instead of computing both.
SameSource reports whether two nodes refer to the same source element.
No description provided by the author
ShouldAsanCheckPtr reports whether pointer checking should be enabled for function fn when -asan is enabled.
ShouldCheckPtr reports whether pointer checking should be enabled for function fn at a given level.
StaticCalleeName returns the ONAME/PFUNC for n, if known.
StaticValue analyzes n to find the earliest expression that always evaluates to the same value as n, which might be from an enclosing function.
StmtWithInit reports whether op is a statement with an explicit init list.
StringVal returns the value of a literal string Node as a string.
No description provided by the author
ToNodes returns s as a slice of Nodes.
TypeNode returns the Node representing the type t.
Uint64Val returns n as a uint64.
Uses reports whether expression x is a (direct) use of the given variable.
No description provided by the author
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.
VisitFuncAndClosures calls visit on each non-nil node in fn.Body, including any nested closure bodies.
VisitFuncsBottomUp invokes analyze on the ODCLFUNC nodes listed in list.
VisitList calls Visit(x, visit) for each node x in the list.
WithFunc invokes do with CurFunc and base.Pos set to curfn and curfn.Pos(), respectively, and then restores their previous values before returning.
# Constants
treat a pointer to one arg as a pointer to them all.
Maximum size in bits for big.Ints before signaling overflow and also mantissa precision for big.Floats.
Reachable from the heap.
By construction will not escape.
Does not escape to heap, result, or parameters.
No description provided by the author
Go command pragmas.
func should not be instrumented by checkptr.
func parameters don't escape.
func should not be inlined.
Func pragmas.
func must not have race detector annotations.
func should not execute on separate stack.
emit compiler error instead of write barrier.
error on write barrier in this or recursive callees.
X + Y.
&X.
+{List} (string addition, list elements are strings).
X & Y.
X && Y.
X &^ Y.
append(Args); after walk, X may contain elem type descriptor.
Type{List} (composite literal, Type is array).
X = Y or (if Def=true) X := Y If Def, then Init includes a DCL node for X.
Lhs = Rhs (x, y, z = a, b, c) or (if Def=true) Lhs := Rhs If Def, then Init includes DCL nodes for Lhs.
Lhs = Rhs (x, ok = I.(int)).
Lhs = Rhs (x, y = f()).
Lhs = Rhs (x, ok = m["foo"]).
Lhs = Rhs (x, ok = <-c).
X AsOp= Y (x += y).
^X.
{ List } (block of code).
break [Label].
Type(X) (Type is string, X is a []byte).
Type(X) (Type is string, X is a []byte, ephemeral).
X(Args) (function call, method call or type conversion).
X(Args) (function call f(args)).
X(Args) (interface method call x.Method(args)).
X(Args) (direct method call x.Method(args)).
cap(X).
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.
reference to c function pointer (not go func value).
emit code to ensure pointer/interface not nil.
clear(X).
close(X).
func Type { Func.Closure.Body } (func literal).
complex(X, Y).
Type{List} (composite literal, not yet lowered to specific form).
continue [Label].
Type(X) (type conversion).
Type(X) (type conversion, to interface).
Type(X) (type conversion, no effect).
copy(X, Y).
var X (declares X of type X.Type).
func f() or func (r) f().
defer Call.
delete(Args).
*X.
X / Y.
X.Sel (X is of struct type).
X.Sel (X is interface, Sel is method name).
X.Sel (X is non-interface, Sel is method name).
X.Sel (X is of pointer to struct type).
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.
X.Ntype or X.Type (.Ntype during parsing, .Type once resolved; on rhs of OAS2DOTTYPE); after walk, Itab contains address of interface type descriptor.
x = i.(T) where T is a type parameter (or derived from a type parameter).
x, ok = i.(T) where T is a type parameter (or derived from a type parameter).
a type node for type switches (represents a dynamic target type for a type switch).
Node ops.
X == Y.
fallthrough.
for Init; Cond; Post { Body }.
X >= Y.
runtime.getcallerpc() (continuation PC in caller frame).
runtime.getcallersp() (stack pointer in caller frame).
runtime.getg() (read g pointer).
go Call.
goto Label.
X > Y.
data pointer of an interface value.
if Init; Cond { Then } else { Else }.
imag(X).
X[Index] (index of array or slice).
X[Index] (index of map).
intermediary representation of an inlined call.
start of an inlined body, with file/line of caller.
A type switch with interface cases.
rtype/itab pointer of an interface value.
A jump table structure for implementing dense expression switches.
Key:Value (key:value in struct/array/map literal).
Label:.
X <= Y.
len(X).
offset within a name.
literal.
X << Y.
X < Y.
make(Args) (before type checking converts to one of the following).
make(Type[, Len]) (type is chan).
construct an interface value from rtype/itab and data pointers.
make(Type[, Len]) (type is map).
make(Type[, Len[, Cap]]) (type is slice).
makeslicecopy(Type, Len, Cap) (type is slice; Len is length and Cap is the copied from slice).
Type{List} (composite literal, Type is map).
max(List).
X(Args) (method expression T.Method(args), first argument is the method receiver).
X.Sel (method expression t.Method, not called).
min(List).
X % Y.
X * Y.
var or func name.
X != Y.
-X.
new(X); corresponds to calls to new in source code.
nil.
Unnamed arg or return value: f(int, string) (int, error) { etc } Also used for a qualified package identifier that hasn't been resolved yet.
!X.
X | Y.
X || Y.
panic(X).
(X).
+X.
print(List).
println(List).
&X (X is composite literal).
for Key, Value = range X { Body }.
real(X).
recover().
recover(Args) w/ explicit FP argument.
<-X.
result of a function call; Xoffset is stack offset.
return Results.
X >> Y.
Type(X) (Type is string, X is a []rune).
Type(X) (Type is string, X is rune).
select { Cases }.
like OAS2: Lhs = Rhs where len(Lhs)=2, len(Rhs)=1, Rhs[0].Op = ORECV (appears as .Var of OCASE).
Chan <- Value.
X[Low : High] (X is untypechecked or slice).
Type(X) (Type is [N]T, X is a []T).
Type(X) (Type is *[N]T, X is a []T).
X[Low : High : Max] (X is untypedchecked or slice).
X[Low : High : Max] (X is pointer to array).
X[Low : High] (X is pointer to array).
sliceheader{Ptr, Len, Cap} (Ptr is unsafe.Pointer, Len is length, Cap is capacity).
Type{List} (composite literal, Type is slice), Len is slice length.
X[Low : High] (X is string).
base pointer of a slice or string.
Type(X) (Type is []byte, X is a string).
Type(X) (Type is []byte, X is a string, ephemeral).
Type(X) (Type is []rune, X is a string).
stringheader{Ptr, Len} (Ptr is unsafe.Pointer, Len is length).
Field:Value (key:value in struct literal, after type checking).
Type{List} (composite literal, Type is struct).
X - Y.
switch Init; Expr { Cases }.
tail call to another function.
type name.
OTYPESW: X := Y.(type) (appears as .Tag of OSWITCH) X is nil if there is no type-switch variable.
unsafe.Add(X, Y).
unsafe.Slice(X, Y).
unsafe.SliceData(X).
unsafe.String(X, Y).
unsafe.StringData(X).
X.Sel (before rewrite to one of the preceding).
X ^ Y.
Node ops.
local variables.
local variables or parameters moved to heap.
global variables.
global functions.
input arguments.
output results.
type params.
no class; used during ssa conversion to indicate pseudo-variables.
TODO(register args) remove after register abi is working.
func must run on system stack.
pointers converted to uintptr escape.
pointers converted to uintptr must be kept alive.
cancels Nowritebarrierrec in this function and callees.
# Variables
No description provided by the author
No description provided by the author
EscFmt is set by the escape analysis code to add escape analysis details to the node print.
IsIntrinsicCall reports whether the compiler back end will treat the call as an intrinsic operation.
MaxImplicitStackVarSize is the maximum size of implicit variables that we will allocate on the stack.
MaxSmallArraySize is the maximum size of an array which is considered small.
MaxStackVarSize is the maximum size variable which we will allocate on the stack.
No description provided by the author
No description provided by the author
No description provided by the author
Pkgs holds known packages.
Syms holds known symbols.
# Structs
An AddrExpr is an address-of expression &X.
An AddStringExpr is a string concatenation List[0] + List[1] + ..
An AssignListStmt is an assignment statement with more than one item on at least one side: Lhs = Rhs.
An AssignOpStmt is an AsOp= assignment statement: X AsOp= Y.
An AssignStmt is a simple assignment statement: X = Y.
A BasicLit is a literal of basic type.
A BinaryExpr is a binary expression X Op Y, or Op(X, Y) for builtin functions that do not become calls.
A BlockStmt is a block: { List }.
A BranchStmt is a break, continue, fallthrough, or goto statement.
A CallExpr is a function call Fun(Args).
A CaseClause is a case statement in a switch or select: case List: Body.
A ClosureExpr is a function literal expression.
No description provided by the author
A CompLitExpr is a composite literal Type{Vals}.
A ConvExpr is a conversion Type(X).
A Decl is a declaration of a const, type, or var.
A DynamicType represents a type expression whose exact type must be computed dynamically.
A DynamicTypeAssertExpr asserts that X is of dynamic type RType.
No description provided by the author
A ForStmt is a non-range for loop: for Init; Cond; Post { Body }.
A Func corresponds to a single function in a Go program (and vice versa: each function is denoted by exactly one *Func).
A GoDeferStmt is a go or defer statement: go Call / defer Call.
An Ident is an identifier, possibly qualified.
An IfStmt is a return statement: if Init; Cond { Body } else { Else }.
An IndexExpr is an index expression X[Index].
An Inline holds fields used for function bodies that can be inlined.
An InlinedCallExpr is an inlined function call.
An InlineMarkStmt is a marker placed just before an inlined body.
An InterfaceSwitchStmt is used to implement type switches.
A JumpTableStmt is used to implement switches.
A KeyExpr is a Key: Value composite literal key.
A LabelStmt is a label statement (just the label, not including the statement it labels).
A LinksymOffsetExpr refers to an offset within a global variable.
A LogicalExpr is an expression X Op Y where Op is && or ||.
A MakeExpr is a make expression: make(Type[, Len[, Cap]]).
A Mark represents a scope boundary.
Name holds Node fields used only by named nodes (ONAME, OTYPE, some OLITERAL).
NameQueue is a FIFO queue of *Name.
A NilExpr represents the predefined untyped constant nil.
A Package holds information about the package being compiled.
A ParenExpr is a parenthesized expression (X).
A RangeStmt is a range loop: for Key, Value = range X { Body }.
A ReassignOracle efficiently answers queries about whether local variables are reassigned.
A ResultExpr represents a direct access to a result.
A ReturnStmt is a return statement.
A SelectorExpr is a selector expression X.Sel.
A SelectStmt is a block: { Cases }.
A SendStmt is a send statement: X <- Y.
A SliceExpr is a slice expression X[Low:High] or X[Low:High:Max].
A SliceHeader expression constructs a slice header from its parts.
A StarExpr is a dereference expression *X.
A StringHeaderExpr expression constructs a string header from its parts.
A StructKeyExpr is a Field: Value composite literal key.
A SwitchStmt is a switch statement: switch Init; Tag { Cases }.
No description provided by the author
A TailCallStmt is a tail call statement, which is used for back-end code generation to jump directly to another function entirely.
A TypeAssertionExpr is a selector expression X.(Type).
A TypeSwitchGuard is the [Name :=] X.(type) in a type switch.
A UnaryExpr is a unary expression Op X, or Op(X) for a builtin function that does not end up being a call.
WasmImport stores metadata associated with the //go:wasmimport pragma.
# Type aliases
The Class of a variable/function describes the "storage class" of a variable or function.
NameSet is a set of Names.
Nodes is a slice of Node.
No description provided by the author
No description provided by the author
A ScopeID represents a lexical scope within a function.