]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: add gccgo sizes information
authorIan Lance Taylor <iant@golang.org>
Tue, 22 Jan 2019 15:40:19 +0000 (07:40 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 26 Feb 2019 23:43:42 +0000 (23:43 +0000)
This will need to be updated from time to time as new targets are
added to gccgo. But that is better than always returning nil.

Change-Id: I04b8c4d0f8efa38e2a148eb2e38b16b09f0351c3
Reviewed-on: https://go-review.googlesource.com/c/158844
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/go/types/gccgosizes.go [new file with mode: 0644]
src/go/types/sizes.go

diff --git a/src/go/types/gccgosizes.go b/src/go/types/gccgosizes.go
new file mode 100644 (file)
index 0000000..d5c92c6
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This is a copy of the file generated during the gccgo build process.
+// Last update 2019-01-22.
+
+package types
+
+var gccgoArchSizes = map[string]*StdSizes{
+       "386":         {4, 4},
+       "alpha":       {8, 8},
+       "amd64":       {8, 8},
+       "amd64p32":    {4, 8},
+       "arm":         {4, 8},
+       "armbe":       {4, 8},
+       "arm64":       {8, 8},
+       "arm64be":     {8, 8},
+       "ia64":        {8, 8},
+       "m68k":        {4, 2},
+       "mips":        {4, 8},
+       "mipsle":      {4, 8},
+       "mips64":      {8, 8},
+       "mips64le":    {8, 8},
+       "mips64p32":   {4, 8},
+       "mips64p32le": {4, 8},
+       "nios2":       {4, 8},
+       "ppc":         {4, 8},
+       "ppc64":       {8, 8},
+       "ppc64le":     {8, 8},
+       "riscv":       {4, 8},
+       "riscv64":     {8, 8},
+       "s390":        {4, 8},
+       "s390x":       {8, 8},
+       "sh":          {4, 8},
+       "shbe":        {4, 8},
+       "sparc":       {4, 8},
+       "sparc64":     {8, 8},
+       "wasm":        {8, 8},
+}
index f890c303774ae16d43b99663a8f7bab715dc0587..6ab6157b82df48749e67bc12157066b530e54cd2 100644 (file)
@@ -182,10 +182,16 @@ var gcArchSizes = map[string]*StdSizes{
 // "386", "arm", "arm64", "amd64", "amd64p32", "mips", "mipsle",
 // "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x", "sparc64", "wasm".
 func SizesFor(compiler, arch string) Sizes {
-       if compiler != "gc" {
+       var m map[string]*StdSizes
+       switch compiler {
+       case "gc":
+               m = gcArchSizes
+       case "gccgo":
+               m = gccgoArchSizes
+       default:
                return nil
        }
-       s, ok := gcArchSizes[arch]
+       s, ok := m[arch]
        if !ok {
                return nil
        }