Debian Codegraph @

cmd/gotype/sizesFor18.go

raw symbols SCIP
1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build !go1.9
6
7 // This file contains a copy of the implementation of types.SizesFor
8 // since this function is not available in go/types before Go 1.9.
9
10 package main
11
12 import "go/types"
13
14 const defaultCompiler = "gc"
15
16 var gcArchSizes = map[string]*types.StdSizes{
17 "386": {4, 4},
18 "arm": {4, 4},
19 "arm64": {8, 8},
20 "amd64": {8, 8},
21 "amd64p32": {4, 8},
22 "mips": {4, 4},
23 "mipsle": {4, 4},
24 "mips64": {8, 8},
25 "mips64le": {8, 8},
26 "ppc64": {8, 8},
27 "ppc64le": {8, 8},
28 "s390x": {8, 8},
29 }
30
31 func SizesFor(compiler, arch string) types.Sizes {
32 if compiler != "gc" {
33 return nil
34 }
35 s, ok := gcArchSizes[arch]
36 if !ok {
37 return nil
38 }
39 return s
40 }