aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ir/node.go
diff options
context:
space:
mode:
authorcuiweixie <cuiweixie@gmail.com>2022-08-16 17:52:13 +0800
committerMatthew Dempsky <mdempsky@google.com>2022-08-31 17:15:15 +0000
commitc7085329367e14f0aa828a3793cf66d9f82f05c2 (patch)
tree94f2e9ae0cfc74e1b3cd477480f718a2bd4b6814 /src/cmd/compile/internal/ir/node.go
parent301ca7513f427f6511fb67cc0385151403cd1729 (diff)
downloadgo-c7085329367e14f0aa828a3793cf66d9f82f05c2.tar.xz
cmd/compile: add support for unsafe.{String,StringData,SliceData}
For #53003 Change-Id: I13a761daca8b433b271a1feb711c103d9820772d Reviewed-on: https://go-review.googlesource.com/c/go/+/423774 Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: hopehook <hopehook@golangcn.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ir/node.go')
-rw-r--r--src/cmd/compile/internal/ir/node.go82
1 files changed, 43 insertions, 39 deletions
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go
index 9d1c8cbb9b..4196622b8a 100644
--- a/src/cmd/compile/internal/ir/node.go
+++ b/src/cmd/compile/internal/ir/node.go
@@ -209,45 +209,49 @@ const (
//
// 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)
- OPRINTN // 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)
- 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)
- OREAL // real(X)
- OIMAG // imag(X)
- OCOMPLEX // complex(X, Y)
- OALIGNOF // unsafe.Alignof(X)
- OOFFSETOF // unsafe.Offsetof(X)
- OSIZEOF // unsafe.Sizeof(X)
- OUNSAFEADD // unsafe.Add(X, Y)
- OUNSAFESLICE // unsafe.Slice(X, Y)
- OMETHEXPR // X(Args) (method expression T.Method(args), first argument is the method receiver)
- OMETHVALUE // X.Sel (method expression t.Method, not called)
+ 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)
+ OPRINTN // 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)
+ OREAL // real(X)
+ OIMAG // imag(X)
+ OCOMPLEX // complex(X, Y)
+ OALIGNOF // unsafe.Alignof(X)
+ OOFFSETOF // unsafe.Offsetof(X)
+ OSIZEOF // unsafe.Sizeof(X)
+ 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)