diff options
| author | Keith Randall <khr@golang.org> | 2024-03-14 10:25:18 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2024-03-18 15:28:05 +0000 |
| commit | d25579293374bdc2d10864f7fa0ac9f89bb87fd9 (patch) | |
| tree | 7a7fe9eeb01afb42799d484229109939c2d9b0f1 /src/cmd/compile/internal/reflectdata/alg.go | |
| parent | 0a6f05e30f58023bf45f747a79c20751db2bcfe7 (diff) | |
| download | go-d25579293374bdc2d10864f7fa0ac9f89bb87fd9.tar.xz | |
cmd/compile: simplify algorithm kinds
Add a ANOALG kind which is "ANOEQ, plus has a part that is marked Noalg".
That way, AlgType can return just a kind.
The field we used to return was used only to get this bit of information.
Change-Id: Iaa409742825cc1f19ab414b1f5b74c1f112ed5f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/572075
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/alg.go')
| -rw-r--r-- | src/cmd/compile/internal/reflectdata/alg.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index a0f5522153..7cc50d866f 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -20,7 +20,7 @@ import ( // AlgType returns the fixed-width AMEMxx variants instead of the general // AMEM kind when possible. func AlgType(t *types.Type) types.AlgKind { - a, _ := types.AlgType(t) + a := types.AlgType(t) if a == types.AMEM { if t.Alignment() < int64(base.Ctxt.Arch.Alignment) && t.Alignment() < t.Size() { // For example, we can't treat [2]int16 as an int32 if int32s require @@ -254,7 +254,7 @@ func runtimeHashFor(name string, t *types.Type) *ir.Name { // hashfor returns the function to compute the hash of a value of type t. func hashfor(t *types.Type) *ir.Name { - switch a, _ := types.AlgType(t); a { + switch types.AlgType(t) { case types.AMEM: base.Fatalf("hashfor with AMEM type") case types.AINTER: @@ -293,7 +293,7 @@ func sysClosure(name string) *obj.LSym { // equality for two objects of type t. func geneq(t *types.Type) *obj.LSym { switch AlgType(t) { - case types.ANOEQ: + case types.ANOEQ, types.ANOALG: // The runtime will panic if it tries to compare // a type with a nil equality function. return nil @@ -643,7 +643,7 @@ func eqFunc(t *types.Type) *ir.Func { // EqFor returns ONAME node represents type t's equal function, and a boolean // to indicates whether a length needs to be passed when calling the function. func EqFor(t *types.Type) (ir.Node, bool) { - switch a, _ := types.AlgType(t); a { + switch types.AlgType(t) { case types.AMEM: return typecheck.LookupRuntime("memequal", t, t), true case types.ASPECIAL: |
