Skip to content

Commit 35e413c

Browse files
committed
cmd/compile: add new ops for experiment with late call expansion
Added Dereference, StaticLECall, SelectN, SelectNAddr Change-Id: I5426ae488e83956539aa07f7415b8acc26c933e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/239082 Trust: David Chase <[email protected]> Run-TryBot: David Chase <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent f554eb7 commit 35e413c

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

src/cmd/compile/internal/ssa/gen/genericOps.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ var genericOps = []opData{
346346

347347
// Memory operations
348348
{name: "Load", argLength: 2}, // Load from arg0. arg1=memory
349+
{name: "Dereference", argLength: 2}, // Load from arg0. arg1=memory. Helper op for arg/result passing, result is an otherwise not-SSA-able "value".
349350
{name: "Store", argLength: 3, typ: "Mem", aux: "Typ"}, // Store arg1 to arg0. arg2=memory, aux=type. Returns memory.
350351
// The source and destination of Move may overlap in some cases. See e.g.
351352
// memmove inlining in generic.rules. When inlineablememmovesize (in ../rewrite.go)
@@ -387,9 +388,11 @@ var genericOps = []opData{
387388
// as a phantom first argument.
388389
// TODO(josharian): ClosureCall and InterCall should have Int32 aux
389390
// to match StaticCall's 32 bit arg size limit.
390-
{name: "ClosureCall", argLength: 3, aux: "CallOff", call: true}, // arg0=code pointer, arg1=context ptr, arg2=memory. auxint=arg size. Returns memory.
391-
{name: "StaticCall", argLength: 1, aux: "CallOff", call: true}, // call function aux.(*obj.LSym), arg0=memory. auxint=arg size. Returns memory.
392-
{name: "InterCall", argLength: 2, aux: "CallOff", call: true}, // interface call. arg0=code pointer, arg1=memory, auxint=arg size. Returns memory.
391+
// TODO(drchase,josharian): could the arg size limit be bundled into the rules for CallOff?
392+
{name: "ClosureCall", argLength: 3, aux: "CallOff", call: true}, // arg0=code pointer, arg1=context ptr, arg2=memory. auxint=arg size. Returns memory.
393+
{name: "StaticCall", argLength: 1, aux: "CallOff", call: true}, // call function aux.(*obj.LSym), arg0=memory. auxint=arg size. Returns memory.
394+
{name: "InterCall", argLength: 2, aux: "CallOff", call: true}, // interface call. arg0=code pointer, arg1=memory, auxint=arg size. Returns memory.
395+
{name: "StaticLECall", argLength: -1, aux: "CallOff", call: true}, // late-expanded static call function aux.(*ssa.AuxCall.Fn). arg0..argN-1 are inputs, argN is mem. auxint = arg size. Result is tuple of result(s), plus mem.
393396

394397
// Conversions: signed extensions, zero (unsigned) extensions, truncations
395398
{name: "SignExt8to16", argLength: 1, typ: "Int16"},
@@ -531,8 +534,10 @@ var genericOps = []opData{
531534
{name: "Cvt64Fto64U", argLength: 1}, // float64 -> uint64, only used on archs that has the instruction
532535

533536
// pseudo-ops for breaking Tuple
534-
{name: "Select0", argLength: 1, zeroWidth: true}, // the first component of a tuple
535-
{name: "Select1", argLength: 1, zeroWidth: true}, // the second component of a tuple
537+
{name: "Select0", argLength: 1, zeroWidth: true}, // the first component of a tuple
538+
{name: "Select1", argLength: 1, zeroWidth: true}, // the second component of a tuple
539+
{name: "SelectN", argLength: 1, aux: "Int64"}, // arg0=tuple, auxint=field index. Returns the auxint'th member.
540+
{name: "SelectNAddr", argLength: 1, aux: "Int64"}, // arg0=tuple, auxint=field index. Returns the address of auxint'th member. Used for un-SSA-able result types.
536541

537542
// Atomic operations used for semantically inlining runtime/internal/atomic.
538543
// Atomic loads return a new memory so that the loads are properly ordered

src/cmd/compile/internal/ssa/opGen.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)