mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: document Node fields used by each Op
Change-Id: If969d7a06c83447ee38da30f1477a6cf4bfa1a03 Reviewed-on: https://go-review.googlesource.com/10691 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
aefa6cd1f9
commit
cd9f417dbb
1 changed files with 122 additions and 119 deletions
|
|
@ -188,129 +188,132 @@ const (
|
||||||
OLITERAL // literal
|
OLITERAL // literal
|
||||||
|
|
||||||
// expressions
|
// expressions
|
||||||
OADD // x + y
|
OADD // Left + Right
|
||||||
OSUB // x - y
|
OSUB // Left - Right
|
||||||
OOR // x | y
|
OOR // Left | Right
|
||||||
OXOR // x ^ y
|
OXOR // Left ^ Right
|
||||||
OADDSTR // s + "foo"
|
OADDSTR // Left + Right (string addition)
|
||||||
OADDR // &x
|
OADDR // &Left
|
||||||
OANDAND // b0 && b1
|
OANDAND // Left && Right
|
||||||
OAPPEND // append
|
OAPPEND // append(List)
|
||||||
OARRAYBYTESTR // string(bytes)
|
OARRAYBYTESTR // Type(Left) (Type is string, Left is a []byte)
|
||||||
OARRAYBYTESTRTMP // string(bytes) ephemeral
|
OARRAYBYTESTRTMP // Type(Left) (Type is string, Left is a []byte, ephemeral)
|
||||||
OARRAYRUNESTR // string(runes)
|
OARRAYRUNESTR // Type(Left) (Type is string, Left is a []rune)
|
||||||
OSTRARRAYBYTE // []byte(s)
|
OSTRARRAYBYTE // Type(Left) (Type is []byte, Left is a string)
|
||||||
OSTRARRAYBYTETMP // []byte(s) ephemeral
|
OSTRARRAYBYTETMP // Type(Left) (Type is []byte, Left is a string, ephemeral)
|
||||||
OSTRARRAYRUNE // []rune(s)
|
OSTRARRAYRUNE // Type(Left) (Type is []rune, Left is a string)
|
||||||
OAS // x = y or x := y
|
OAS // Left = Right or (if Colas=true) Left := Right
|
||||||
OAS2 // x, y, z = xx, yy, zz
|
OAS2 // List = Rlist (x, y, z = a, b, c)
|
||||||
OAS2FUNC // x, y = f()
|
OAS2FUNC // List = Rlist (x, y = f())
|
||||||
OAS2RECV // x, ok = <-c
|
OAS2RECV // List = Rlist (x, ok = <-c)
|
||||||
OAS2MAPR // x, ok = m["foo"]
|
OAS2MAPR // List = Rlist (x, ok = m["foo"])
|
||||||
OAS2DOTTYPE // x, ok = I.(int)
|
OAS2DOTTYPE // List = Rlist (x, ok = I.(int))
|
||||||
OASOP // x += y
|
OASOP // Left Etype= Right (x += y)
|
||||||
OASWB // OAS but with write barrier
|
OASWB // Left = Right (with write barrier)
|
||||||
OCALL // function call, method call or type conversion, possibly preceded by defer or go.
|
OCALL // Left(List) (function call, method call or type conversion)
|
||||||
OCALLFUNC // f()
|
OCALLFUNC // Left(List) (function call f(args))
|
||||||
OCALLMETH // t.Method()
|
OCALLMETH // Left(List) (direct method call x.Method(args))
|
||||||
OCALLINTER // err.Error()
|
OCALLINTER // Left(List) (interface method call x.Method(args))
|
||||||
OCALLPART // t.Method (without ())
|
OCALLPART // Left.Right (method expression x.Method, not called)
|
||||||
OCAP // cap
|
OCAP // cap(Left)
|
||||||
OCLOSE // close
|
OCLOSE // close(Left)
|
||||||
OCLOSURE // f = func() { etc }
|
OCLOSURE // func Type { Body } (func literal)
|
||||||
OCMPIFACE // err1 == err2
|
OCMPIFACE // Left Etype Right (interface comparison, x == y or x != y)
|
||||||
OCMPSTR // s1 == s2
|
OCMPSTR // Left Etype Right (string comparison, x == y, x < y, etc)
|
||||||
OCOMPLIT // composite literal, typechecking may convert to a more specific OXXXLIT.
|
OCOMPLIT // Right{List} (composite literal, not yet lowered to specific form)
|
||||||
OMAPLIT // M{"foo":3, "bar":4}
|
OMAPLIT // Type{List} (composite literal, Type is map)
|
||||||
OSTRUCTLIT // T{x:3, y:4}
|
OSTRUCTLIT // Type{List} (composite literal, Type is struct)
|
||||||
OARRAYLIT // [2]int{3, 4}
|
OARRAYLIT // Type{List} (composite literal, Type is array or slice)
|
||||||
OPTRLIT // &T{x:3, y:4}
|
OPTRLIT // &Left (left is composite literal)
|
||||||
OCONV // var i int; var u uint; i = int(u)
|
OCONV // Type(Left) (type conversion)
|
||||||
OCONVIFACE // I(t)
|
OCONVIFACE // Type(Left) (type conversion, to interface)
|
||||||
OCONVNOP // type Int int; var i int; var j Int; i = int(j)
|
OCONVNOP // Type(Left) (type conversion, no effect)
|
||||||
OCOPY // copy
|
OCOPY // copy(Left, Right)
|
||||||
ODCL // var x int
|
ODCL // var Left (declares Left of type Left.Type)
|
||||||
ODCLFUNC // func f() or func (r) f()
|
|
||||||
ODCLFIELD // struct field, interface field, or func/method argument/return value.
|
// Used during parsing but don't last.
|
||||||
ODCLCONST // const pi = 3.14
|
ODCLFUNC // func f() or func (r) f()
|
||||||
ODCLTYPE // type Int int
|
ODCLFIELD // struct field, interface field, or func/method argument/return value.
|
||||||
ODELETE // delete
|
ODCLCONST // const pi = 3.14
|
||||||
ODOT // t.x
|
ODCLTYPE // type Int int
|
||||||
ODOTPTR // p.x that is implicitly (*p).x
|
|
||||||
ODOTMETH // t.Method
|
ODELETE // delete(Left, Right)
|
||||||
ODOTINTER // err.Error
|
ODOT // Left.Right (Left is of struct type)
|
||||||
OXDOT // t.x, typechecking may convert to a more specific ODOTXXX.
|
ODOTPTR // Left.Right (Left is of pointer to struct type)
|
||||||
ODOTTYPE // e = err.(MyErr)
|
ODOTMETH // Left.Right (Left is non-interface, Right is method name)
|
||||||
ODOTTYPE2 // e, ok = err.(MyErr)
|
ODOTINTER // Left.Right (Left is interface, Right is method name)
|
||||||
OEQ // x == y
|
OXDOT // Left.Right (before rewrite to one of the preceding)
|
||||||
ONE // x != y
|
ODOTTYPE // Left.Right or Left.Type (.Right during parsing, .Type once resolved)
|
||||||
OLT // x < y
|
ODOTTYPE2 // Left.Right or Left.Type (.Right during parsing, .Type once resolved; on rhs of OAS2DOTTYPE)
|
||||||
OLE // x <= y
|
OEQ // Left == Right
|
||||||
OGE // x >= y
|
ONE // Left != Right
|
||||||
OGT // x > y
|
OLT // Left < Right
|
||||||
OIND // *p
|
OLE // Left <= Right
|
||||||
OINDEX // a[i]
|
OGE // Left >= Right
|
||||||
OINDEXMAP // m[s]
|
OGT // Left > Right
|
||||||
OKEY // The x:3 in t{x:3, y:4}, the 1:2 in a[1:2], the 2:20 in [3]int{2:20}, etc.
|
OIND // *Left
|
||||||
OPARAM // The on-stack copy of a parameter or return value that escapes.
|
OINDEX // Left[Right] (index of array or slice)
|
||||||
OLEN // len
|
OINDEXMAP // Left[Right] (index of map)
|
||||||
OMAKE // make, typechecking may convert to a more specific OMAKEXXX.
|
OKEY // Left:Right (key:value in struct/array/map literal, or slice index pair)
|
||||||
OMAKECHAN // make(chan int)
|
OPARAM // variant of ONAME for on-stack copy of a parameter or return value that escapes.
|
||||||
OMAKEMAP // make(map[string]int)
|
OLEN // len(Left)
|
||||||
OMAKESLICE // make([]int, 0)
|
OMAKE // make(List) (before type checking converts to one of the following)
|
||||||
OMUL // *
|
OMAKECHAN // make(Type, Left) (type is chan)
|
||||||
ODIV // x / y
|
OMAKEMAP // make(Type, Left) (type is map)
|
||||||
OMOD // x % y
|
OMAKESLICE // make(Type, Left, Right) (type is slice)
|
||||||
OLSH // x << u
|
OMUL // Left * Right
|
||||||
ORSH // x >> u
|
ODIV // Left / Right
|
||||||
OAND // x & y
|
OMOD // Left % Right
|
||||||
OANDNOT // x &^ y
|
OLSH // Left << Right
|
||||||
ONEW // new
|
ORSH // Left >> Right
|
||||||
ONOT // !b
|
OAND // Left & Right
|
||||||
OCOM // ^x
|
OANDNOT // Left &^ Right
|
||||||
OPLUS // +x
|
ONEW // new(Left)
|
||||||
OMINUS // -y
|
ONOT // !Left
|
||||||
OOROR // b1 || b2
|
OCOM // ^Left
|
||||||
OPANIC // panic
|
OPLUS // +Left
|
||||||
OPRINT // print
|
OMINUS // -Left
|
||||||
OPRINTN // println
|
OOROR // Left || Right
|
||||||
OPAREN // (x)
|
OPANIC // panic(Left)
|
||||||
OSEND // c <- x
|
OPRINT // print(List)
|
||||||
OSLICE // v[1:2], typechecking may convert to a more specific OSLICEXXX.
|
OPRINTN // println(List)
|
||||||
OSLICEARR // a[1:2]
|
OPAREN // (Left)
|
||||||
OSLICESTR // s[1:2]
|
OSEND // Left <- Right
|
||||||
OSLICE3 // v[1:2:3], typechecking may convert to OSLICE3ARR.
|
OSLICE // Left[Right.Left : Right.Right] (Left is untypechecked or slice; Right.Op==OKEY)
|
||||||
OSLICE3ARR // a[1:2:3]
|
OSLICEARR // Left[Right.Left : Right.Right] (Left is array)
|
||||||
ORECOVER // recover
|
OSLICESTR // Left[Right.Left : Right.Right] (Left is string)
|
||||||
ORECV // <-c
|
OSLICE3 // Left[R.Left : R.R.Left : R.R.R] (R=Right; Left is untypedchecked or slice; R.Op and R.R.Op==OKEY)
|
||||||
ORUNESTR // string(i)
|
OSLICE3ARR // Left[R.Left : R.R.Left : R.R.R] (R=Right; Left is array; R.Op and R.R.Op==OKEY)
|
||||||
OSELRECV // case x = <-c:
|
ORECOVER // recover()
|
||||||
OSELRECV2 // case x, ok = <-c:
|
ORECV // <-Left
|
||||||
OIOTA // iota
|
ORUNESTR // Type(Left) (Type is string, Left is rune)
|
||||||
OREAL // real
|
OSELRECV // Left = <-Right.Left: (appears as .Left of OCASE; Right.Op == ORECV)
|
||||||
OIMAG // imag
|
OSELRECV2 // List = <-Right.Left: (apperas as .Left of OCASE; count(List) == 2, Right.Op == ORECV)
|
||||||
OCOMPLEX // complex
|
OIOTA // iota
|
||||||
|
OREAL // real(Left)
|
||||||
|
OIMAG // imag(Left)
|
||||||
|
OCOMPLEX // complex(Left, Right)
|
||||||
|
|
||||||
// statements
|
// statements
|
||||||
OBLOCK // block of code
|
OBLOCK // { List } (block of code)
|
||||||
OBREAK // break
|
OBREAK // break
|
||||||
OCASE // case, after being verified by swt.c's casebody.
|
OCASE // case List: Nbody (select case after processing; List==nil means default)
|
||||||
OXCASE // case, before verification.
|
OXCASE // case List: Nbody (select case before processing; List==nil means default)
|
||||||
OCONTINUE // continue
|
OCONTINUE // continue
|
||||||
ODEFER // defer
|
ODEFER // defer Left (Left must be call)
|
||||||
OEMPTY // no-op
|
OEMPTY // no-op (empty statement)
|
||||||
OFALL // fallthrough, after being verified by swt.c's casebody.
|
OFALL // fallthrough (after processing)
|
||||||
OXFALL // fallthrough, before verification.
|
OXFALL // fallthrough (before processing)
|
||||||
OFOR // for
|
OFOR // for Ninit; Left; Right { Nbody }
|
||||||
OGOTO // goto
|
OGOTO // goto Left
|
||||||
OIF // if
|
OIF // if Ninit; Left { Nbody } else { Rlist }
|
||||||
OLABEL // label:
|
OLABEL // Left:
|
||||||
OPROC // go
|
OPROC // go Left (Left must be call)
|
||||||
ORANGE // range
|
ORANGE // for List = range Right { Nbody }
|
||||||
ORETURN // return
|
ORETURN // return List
|
||||||
OSELECT // select
|
OSELECT // select { List } (List is list of OXCASE or OCASE)
|
||||||
OSWITCH // switch x
|
OSWITCH // switch Ninit; Left { List } (List is a list of OXCASE or OCASE)
|
||||||
OTYPESW // switch err.(type)
|
OTYPESW // List = Left.(type) (appears as .Left of OSWITCH)
|
||||||
|
|
||||||
// types
|
// types
|
||||||
OTCHAN // chan int
|
OTCHAN // chan int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue