Remove nfs bogon
[official-gcc.git] / libgo / goarch.sh
blobf5c0a34b1da2763d79eafc2453a59fe13b78129d
1 #!/bin/sh
3 # Copyright 2018 The Go Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
7 # Code in Makefile.am will invoke this script with two arguments.
8 # The first is a GOARCH value. The second is a keyword.
9 # The script will print the value of that keyword for that GOARCH.
10 # Keywords:
11 # - bigendian: true or false
12 # - cachelinesize: the cache line size in bytes
13 # (for performance only; it's not essential to get this right)
14 # - defaultphyspagesize: the default physical page size in bytes
15 # (not currently used, but maybe some day)
16 # - family: the processor family, from ALLGOARCHFAMILY in configure.ac
17 # - hugepagesize: size of a huge page in bytes
18 # (used only to decide when to use madvise with MADV_[NO]HUGEPAGE)
19 # (set to 0 if there are no huge pages)
20 # - int64align: alignment of int64 type in bytes
21 # - maxalign: maximum alignment of values of Go types in bytes
22 # - minframesize: size of smallest possible function frame in bytes
23 # (not currently used, may never be used)
24 # - pcquantum: minimum size of a single instruction in bytes
25 # - ptrsize: size of a pointer in bytes
27 if test $# -ne 2; then
28 echo 1>&2 "usage: goarch <goarch> <keyword>"
29 exit 1
32 goarch=$1
33 keyword=$2
35 # Default values
36 bigendian=false
37 cachelinesize=64
38 defaultphyspagesize=4096
39 family=unknown
40 hugepagesize=0
41 int64align=8
42 maxalign=8
43 minframesize=0
44 pcquantum=1
45 ptrsize=8
47 case $goarch in
48 386)
49 family=I386
50 hugepagesize="1 << 21"
51 int64align=4
52 maxalign=4
53 ptrsize=4
55 alpha)
56 family=ALPHA
57 defaultphyspagesize=8192
58 pcquantum=4
60 amd64 | amd64p32)
61 family=AMD64
62 hugepagesize="1 << 21"
64 arm | armbe)
65 family=ARM
66 cachelinesize=32
67 minframesize=4
68 pcquantum=4
69 ptrsize=4
70 case $goarch in
71 *be)
72 bigendian=true
74 esac
76 arm64 | arm64be)
77 family=ARM64
78 cachelinesize=32
79 defaultphyspagesize=65536
80 minframesize=8
81 pcquantum=4
82 case $goarch in
83 *be)
84 bigendian=true
86 esac
88 ia64)
89 family=IA64
90 cachelinesize=128
91 defaultphyspagesize=65536
93 m68k)
94 family=M68K
95 bigendian=true
96 cachelinesize=16
97 int64align=2
98 maxalign=2
99 pcquantum=4
100 ptrsize=4
102 mips | mipsle | mips64p32 | mips64p32le)
103 family=MIPS
104 bigendian=true
105 cachelinesize=32
106 defaultphyspagesize=16384
107 minframesize=4
108 pcquantum=4
109 ptrsize=4
110 case $goarch in
111 *le)
112 bigendian=false
114 esac
116 mips64 | mips64le)
117 family=MIPS64
118 bigendian=true
119 cachelinesize=32
120 defaultphyspagesize=16384
121 minframesize=8
122 pcquantum=4
123 case $goarch in
124 *le)
125 bigendian=false
127 esac
129 nios2)
130 family=NIOS2
131 cachelinesize=32
132 minframesize=16
133 pcquantum=4
134 ptrsize=4
136 ppc)
137 family=PPC
138 bigendian=true
139 defaultphyspagesize=65536
140 minframesize=32
141 pcquantum=4
142 ptrsize=4
144 ppc64 | ppc64le)
145 family=PPC64
146 bigendian=true
147 defaultphyspagesize=65536
148 minframesize=32
149 pcquantum=4
150 case $goarch in
151 *le)
152 bigendian=false
154 esac
156 riscv)
157 family=RISCV
158 pcquantum=2
159 ptrsize=4
161 riscv64)
162 family=RISCV64
163 pcquantum=2
165 s390)
166 family=S390
167 bigendian=true
168 cachelinesize=256
169 minframesize=4
170 pcquantum=2
171 ptrsize=4
173 s390x)
174 family=S390X
175 bigendian=true
176 cachelinesize=256
177 minframesize=8
178 pcquantum=2
180 sh | shbe)
181 family=SH
182 cachelinesize=16
183 int64align=4
184 minframesize=4
185 pcquantum=2
186 ptrsize=4
187 case $goarch in
188 *be)
189 bigendian=true
191 esac
193 sparc)
194 family=SPARC
195 bigendian=true
196 defaultphyspagesize=8192
197 pcquantum=4
198 ptrsize=4
200 sparc64)
201 family=SPARC64
202 bigendian=true
203 defaultphyspagesize=8192
204 pcquantum=4
206 wasm)
207 family=WASM
208 defaultphyspagesize=65536
211 echo 1>&2 "unrecognized goarch value \"$goarch\""
212 exit 1
214 esac
216 if test "$family" = "unknown"; then
217 echo 1>&2 "internal error: no family for goarch value \"$goarch\""
218 exit 1
221 case $keyword in
222 bigendian)
223 echo $bigendian
225 cachelinesize)
226 echo $cachelinesize
228 defaultphyspagesize)
229 echo $defaultphyspagesize
231 family)
232 echo $family
234 hugepagesize)
235 echo $hugepagesize
237 int64align)
238 echo $int64align
240 maxalign)
241 echo $maxalign
243 minframesize)
244 echo $minframesize
246 pcquantum)
247 echo $pcquantum
249 ptrsize)
250 echo $ptrsize
253 echo 1>&2 "unrecognized keyword \"$keyword\""
254 exit 1
256 esac
258 exit 0