cmd/compile/internal/types: simplify iterating all parameters

The types.RecvsParamsResults, etc. helpers existed to make it "easier"
to iterate over all parameters, or recvs+params, or params+results;
but they end up still being quite clumsy to use due to the design goal
of not allocating temporary slices.

Now that recvs+params+results are stored in a single consecutive slice
anyway, we can just return different subslices and simplify the loops.

Change-Id: I84791b80dc099dfbfbbe6eddbc006135528c23b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/521375
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Matthew Dempsky 2023-08-20 15:07:00 -07:00 committed by Gopher Robot
parent 4b9a70a3b7
commit 3d15bfaa3e
6 changed files with 56 additions and 66 deletions

View file

@ -289,10 +289,8 @@ func (l *linker) relocFuncExt(w *pkgbits.Encoder, name *ir.Name) {
w.Uint64(uint64(name.Func.ABI))
// Escape analysis.
for _, fs := range &types.RecvsParams {
for _, f := range fs(name.Type()) {
w.String(f.Note)
}
for _, f := range name.Type().RecvParams() {
w.String(f.Note)
}
if inl := name.Func.Inl; w.Bool(inl != nil) {