aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/walk/convert.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-08-26 12:11:14 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-08-27 20:43:31 +0000
commit72c003ef82ba7c997f49e187e953872bfcbf5263 (patch)
tree8dff1fb85bc1988630948fa972b849a15b95cf58 /src/cmd/compile/internal/walk/convert.go
parent94f2a03951ed1534ebd6b13392b87d8b8b807e20 (diff)
downloadgo-72c003ef82ba7c997f49e187e953872bfcbf5263.tar.xz
cmd/compile: unexport Type.Width and Type.Align [generated]
[git-generate] cd src/cmd/compile/internal : Workaround rf issue with types2 tests. rm types2/*_test.go : Rewrite uses. First a type-safe rewrite, : then a second pass to fix unnecessary conversions. rf ' ex ./abi ./escape ./gc ./liveness ./noder ./reflectdata ./ssa ./ssagen ./staticinit ./typebits ./typecheck ./walk { import "cmd/compile/internal/types" var t *types.Type t.Width -> t.Size() t.Align -> uint8(t.Alignment()) } ex ./abi ./escape ./gc ./liveness ./noder ./reflectdata ./ssa ./ssagen ./staticinit ./typebits ./typecheck ./walk { import "cmd/compile/internal/types" var t *types.Type int64(uint8(t.Alignment())) -> t.Alignment() } ' : Rename fields to lower case. ( cd types rf ' mv Type.Width Type.width mv Type.Align Type.align ' ) : Revert types2 changes. git checkout HEAD^ types2 Change-Id: I42091faece104c4ef619d9d4d50514fd48c8f029 Reviewed-on: https://go-review.googlesource.com/c/go/+/345480 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/walk/convert.go')
-rw-r--r--src/cmd/compile/internal/walk/convert.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/walk/convert.go b/src/cmd/compile/internal/walk/convert.go
index f724ca7cae..80a30d9455 100644
--- a/src/cmd/compile/internal/walk/convert.go
+++ b/src/cmd/compile/internal/walk/convert.go
@@ -145,7 +145,7 @@ func dataWord(n ir.Node, init *ir.Nodes, escapes bool) ir.Node {
case n.Op() == ir.ONAME && n.(*ir.Name).Class == ir.PEXTERN && n.(*ir.Name).Readonly():
// n is a readonly global; use it directly.
value = n
- case !escapes && fromType.Width <= 1024:
+ case !escapes && fromType.Size() <= 1024:
// n does not escape. Use a stack temporary initialized to n.
value = typecheck.Temp(fromType)
init.Append(typecheck.Stmt(ir.NewAssignStmt(base.Pos, value, n)))
@@ -326,11 +326,11 @@ func dataWordFuncName(from *types.Type) (fnname string, argType *types.Type, nee
base.Fatalf("can only handle non-interfaces")
}
switch {
- case from.Size() == 2 && from.Align == 2:
+ case from.Size() == 2 && uint8(from.Alignment()) == 2:
return "convT16", types.Types[types.TUINT16], false
- case from.Size() == 4 && from.Align == 4 && !from.HasPointers():
+ case from.Size() == 4 && uint8(from.Alignment()) == 4 && !from.HasPointers():
return "convT32", types.Types[types.TUINT32], false
- case from.Size() == 8 && from.Align == types.Types[types.TUINT64].Align && !from.HasPointers():
+ case from.Size() == 8 && uint8(from.Alignment()) == uint8(types.Types[types.TUINT64].Alignment()) && !from.HasPointers():
return "convT64", types.Types[types.TUINT64], false
}
if sc := from.SoleComponent(); sc != nil {