cmd/compile/internal/ir: add Func.DeclareParams

There's several copies of this function. We only need one.

While here, normalize so that we always declare parameters, and always
use the names ~pNN for params and ~rNN for results.

Change-Id: I49e90d3fd1820f3c07936227ed5cfefd75d49a1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/528415
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Matthew Dempsky 2023-09-13 19:26:32 -07:00 committed by Gopher Robot
parent de4ead8102
commit d18e9407b0
15 changed files with 179 additions and 361 deletions

View file

@ -156,9 +156,9 @@ func hashFunc(t *types.Type) *ir.Func {
sym.Def = fn.Nname
fn.Pragma |= ir.Noinline // TODO(mdempsky): We need to emit this during the unified frontend instead, to allow inlining.
params, _ := typecheck.DeclFunc(fn)
np := params[0]
nh := params[1]
typecheck.DeclFunc(fn)
np := fn.Dcl[0]
nh := fn.Dcl[1]
switch t.Kind() {
case types.TARRAY:
@ -382,10 +382,10 @@ func eqFunc(t *types.Type) *ir.Func {
sym.Def = fn.Nname
fn.Pragma |= ir.Noinline // TODO(mdempsky): We need to emit this during the unified frontend instead, to allow inlining.
params, results := typecheck.DeclFunc(fn)
np := params[0]
nq := params[1]
nr := results[0]
typecheck.DeclFunc(fn)
np := fn.Dcl[0]
nq := fn.Dcl[1]
nr := fn.Dcl[2]
// Label to jump to if an equality test fails.
neq := typecheck.AutoLabel(".neq")