diff options
author | Matthew Dempsky <mdempsky@google.com> | 2017-04-21 18:44:34 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2017-04-22 17:43:43 +0000 |
commit | c87520c5981ecdeaa99e7ba636a6088f900c0c75 (patch) | |
tree | 8802684b5a4e8a466d8f8faefae8b64123b31a8a /src/cmd/compile/internal/ssa | |
parent | 8a07469663f7a876ec54d64f723395dd17e6d73d (diff) | |
download | go-c87520c5981ecdeaa99e7ba636a6088f900c0c75.tar.gz go-c87520c5981ecdeaa99e7ba636a6088f900c0c75.zip |
cmd: remove IntSize and Widthint
Use PtrSize and Widthptr instead. CL prepared mostly with sed and
uniq.
Passes toolstash-check -all.
Fixes #19954.
Change-Id: I09371bd7128672885cb8bc4e7f534ad56a88d755
Reviewed-on: https://go-review.googlesource.com/40506
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa')
-rw-r--r-- | src/cmd/compile/internal/ssa/config.go | 14 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/decompose.go | 12 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/export_test.go | 2 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/opt.go | 2 | ||||
-rw-r--r-- | src/cmd/compile/internal/ssa/rewrite.go | 2 |
5 files changed, 11 insertions, 21 deletions
diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index d87cbca61f..07d5e49649 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -17,9 +17,8 @@ import ( // and shared across all compilations. type Config struct { arch string // "amd64", etc. - IntSize int64 // 4 or 8 - PtrSize int64 // 4 or 8 - RegSize int64 // 4 or 8 + PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize + RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize Types Types lowerBlock blockRewriter // lowering function lowerValue valueRewriter // lowering function @@ -143,7 +142,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c := &Config{arch: arch, Types: types} switch arch { case "amd64": - c.IntSize = 8 c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockAMD64 @@ -155,7 +153,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.LinkReg = linkRegAMD64 c.hasGReg = false case "amd64p32": - c.IntSize = 4 c.PtrSize = 4 c.RegSize = 8 c.lowerBlock = rewriteBlockAMD64 @@ -168,7 +165,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.hasGReg = false c.noDuffDevice = true case "386": - c.IntSize = 4 c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlock386 @@ -180,7 +176,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.LinkReg = linkReg386 c.hasGReg = false case "arm": - c.IntSize = 4 c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlockARM @@ -192,7 +187,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.LinkReg = linkRegARM c.hasGReg = true case "arm64": - c.IntSize = 8 c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockARM64 @@ -208,7 +202,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.BigEndian = true fallthrough case "ppc64le": - c.IntSize = 8 c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockPPC64 @@ -224,7 +217,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.BigEndian = true fallthrough case "mips64le": - c.IntSize = 8 c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockMIPS64 @@ -237,7 +229,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.LinkReg = linkRegMIPS64 c.hasGReg = true case "s390x": - c.IntSize = 8 c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockS390X @@ -254,7 +245,6 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.BigEndian = true fallthrough case "mipsle": - c.IntSize = 4 c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlockMIPS diff --git a/src/cmd/compile/internal/ssa/decompose.go b/src/cmd/compile/internal/ssa/decompose.go index 56cb46ddac..b629a64e15 100644 --- a/src/cmd/compile/internal/ssa/decompose.go +++ b/src/cmd/compile/internal/ssa/decompose.go @@ -25,7 +25,7 @@ func decomposeBuiltIn(f *Func) { for _, name := range f.Names { t := name.Type switch { - case t.IsInteger() && t.Size() == 8 && f.Config.IntSize == 4: + case t.IsInteger() && t.Size() == 8 && f.Config.PtrSize == 4: var elemType Type if t.IsSigned() { elemType = f.Config.Types.Int32 @@ -95,8 +95,8 @@ func decomposeBuiltIn(f *Func) { } delete(f.NamedValues, name) case t.IsFloat(): - // floats are never decomposed, even ones bigger than IntSize - case t.Size() > f.Config.IntSize: + // floats are never decomposed, even ones bigger than PtrSize + case t.Size() > f.Config.PtrSize: f.Fatalf("undecomposed named type %v %v", name, t) default: newNames = append(newNames, name) @@ -107,7 +107,7 @@ func decomposeBuiltIn(f *Func) { func decomposeBuiltInPhi(v *Value) { switch { - case v.Type.IsInteger() && v.Type.Size() == 8 && v.Block.Func.Config.IntSize == 4: + case v.Type.IsInteger() && v.Type.Size() == 8 && v.Block.Func.Config.PtrSize == 4: if v.Block.Func.Config.arch == "amd64p32" { // Even though ints are 32 bits, we have 64-bit ops. break @@ -122,8 +122,8 @@ func decomposeBuiltInPhi(v *Value) { case v.Type.IsInterface(): decomposeInterfacePhi(v) case v.Type.IsFloat(): - // floats are never decomposed, even ones bigger than IntSize - case v.Type.Size() > v.Block.Func.Config.IntSize: + // floats are never decomposed, even ones bigger than PtrSize + case v.Type.Size() > v.Block.Func.Config.PtrSize: v.Fatalf("undecomposed type %s", v.Type) } } diff --git a/src/cmd/compile/internal/ssa/export_test.go b/src/cmd/compile/internal/ssa/export_test.go index e2d8a2d69b..228a33697e 100644 --- a/src/cmd/compile/internal/ssa/export_test.go +++ b/src/cmd/compile/internal/ssa/export_test.go @@ -30,7 +30,7 @@ func testConfigArch(tb testing.TB, arch string) *Conf { if !ok { tb.Fatalf("unknown arch %s", arch) } - if ctxt.Arch.IntSize != 8 { + if ctxt.Arch.PtrSize != 8 { tb.Fatal("dummyTypes is 64-bit only") } c := &Conf{ diff --git a/src/cmd/compile/internal/ssa/opt.go b/src/cmd/compile/internal/ssa/opt.go index f211488cd7..7703d8b704 100644 --- a/src/cmd/compile/internal/ssa/opt.go +++ b/src/cmd/compile/internal/ssa/opt.go @@ -11,7 +11,7 @@ func opt(f *Func) { func dec(f *Func) { applyRewrite(f, rewriteBlockdec, rewriteValuedec) - if f.Config.IntSize == 4 && f.Config.arch != "amd64p32" { + if f.Config.PtrSize == 4 && f.Config.arch != "amd64p32" { applyRewrite(f, rewriteBlockdec64, rewriteValuedec64) } } diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 8045ae4951..5dce8affdb 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -450,7 +450,7 @@ func isSamePtr(p1, p2 *Value) bool { // moveSize returns the number of bytes an aligned MOV instruction moves func moveSize(align int64, c *Config) int64 { switch { - case align%8 == 0 && c.IntSize == 8: + case align%8 == 0 && c.PtrSize == 8: return 8 case align%4 == 0: return 4 |