Remove misleading debug line entries
[official-gcc.git] / libgo / goarch.sh
bloba5b6217c931193f4cda5bac1f3577682b99035fc
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 # - int64align: alignment of int64 type in bytes
18 # - maxalign: maximum alignment of values of Go types in bytes
19 # - minframesize: size of smallest possible function frame in bytes
20 # (not currently used, may never be used)
21 # - pcquantum: minimum size of a single instruction in bytes
22 # - ptrsize: size of a pointer in bytes
24 if test $# -ne 2; then
25 echo 1>&2 "usage: goarch <goarch> <keyword>"
26 exit 1
29 goarch=$1
30 keyword=$2
32 # Default values
33 bigendian=false
34 cachelinesize=64
35 defaultphyspagesize=4096
36 family=unknown
37 int64align=8
38 maxalign=8
39 minframesize=0
40 pcquantum=1
41 ptrsize=8
43 case $goarch in
44 386)
45 family=I386
46 int64align=4
47 maxalign=4
48 ptrsize=4
50 alpha)
51 family=ALPHA
52 defaultphyspagesize=8192
53 pcquantum=4
55 amd64)
56 family=AMD64
58 amd64p32)
59 family=AMD64
60 ptrsize=4
62 arm | armbe)
63 family=ARM
64 cachelinesize=32
65 minframesize=4
66 pcquantum=4
67 ptrsize=4
68 case $goarch in
69 *be)
70 bigendian=true
72 esac
74 arm64 | arm64be)
75 family=ARM64
76 cachelinesize=32
77 defaultphyspagesize=65536
78 minframesize=8
79 pcquantum=4
80 case $goarch in
81 *be)
82 bigendian=true
84 esac
86 ia64)
87 family=IA64
88 cachelinesize=128
89 defaultphyspagesize=65536
91 m68k)
92 family=M68K
93 bigendian=true
94 cachelinesize=16
95 int64align=2
96 maxalign=2
97 pcquantum=4
98 ptrsize=4
100 mips | mipsle | mips64p32 | mips64p32le)
101 family=MIPS
102 bigendian=true
103 cachelinesize=32
104 defaultphyspagesize=16384
105 minframesize=4
106 pcquantum=4
107 ptrsize=4
108 case $goarch in
109 *le)
110 bigendian=false
112 esac
114 mips64 | mips64le)
115 family=MIPS64
116 bigendian=true
117 cachelinesize=32
118 defaultphyspagesize=16384
119 minframesize=8
120 pcquantum=4
121 case $goarch in
122 *le)
123 bigendian=false
125 esac
127 nios2)
128 family=NIOS2
129 cachelinesize=32
130 minframesize=16
131 pcquantum=4
132 ptrsize=4
134 ppc)
135 family=PPC
136 bigendian=true
137 defaultphyspagesize=65536
138 minframesize=32
139 pcquantum=4
140 ptrsize=4
142 ppc64 | ppc64le)
143 family=PPC64
144 bigendian=true
145 defaultphyspagesize=65536
146 minframesize=32
147 pcquantum=4
148 case $goarch in
149 *le)
150 bigendian=false
152 esac
154 riscv)
155 family=RISCV
156 pcquantum=2
157 ptrsize=4
159 riscv64)
160 family=RISCV64
161 pcquantum=2
163 s390)
164 family=S390
165 bigendian=true
166 cachelinesize=256
167 minframesize=4
168 pcquantum=2
169 ptrsize=4
171 s390x)
172 family=S390X
173 bigendian=true
174 cachelinesize=256
175 minframesize=8
176 pcquantum=2
178 sh | shbe)
179 family=SH
180 cachelinesize=16
181 int64align=4
182 minframesize=4
183 pcquantum=2
184 ptrsize=4
185 case $goarch in
186 *be)
187 bigendian=true
189 esac
191 sparc)
192 family=SPARC
193 bigendian=true
194 defaultphyspagesize=8192
195 pcquantum=4
196 ptrsize=4
198 sparc64)
199 family=SPARC64
200 bigendian=true
201 defaultphyspagesize=8192
202 pcquantum=4
204 wasm)
205 family=WASM
206 defaultphyspagesize=65536
209 echo 1>&2 "unrecognized goarch value \"$goarch\""
210 exit 1
212 esac
214 if test "$family" = "unknown"; then
215 echo 1>&2 "internal error: no family for goarch value \"$goarch\""
216 exit 1
219 case $keyword in
220 bigendian)
221 echo $bigendian
223 cachelinesize)
224 echo $cachelinesize
226 defaultphyspagesize)
227 echo $defaultphyspagesize
229 family)
230 echo $family
232 int64align)
233 echo $int64align
235 maxalign)
236 echo $maxalign
238 minframesize)
239 echo $minframesize
241 pcquantum)
242 echo $pcquantum
244 ptrsize)
245 echo $ptrsize
248 echo 1>&2 "unrecognized keyword \"$keyword\""
249 exit 1
251 esac
253 exit 0