]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgo/goarch.sh
s390: testsuite: Fix risbg-ll-2.c
[thirdparty/gcc.git] / libgo / goarch.sh
CommitLineData
ffad1c54
ILT
1#!/bin/sh
2
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.
6
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
ffad1c54
ILT
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
23
24if test $# -ne 2; then
25 echo 1>&2 "usage: goarch <goarch> <keyword>"
26 exit 1
27fi
28
29goarch=$1
30keyword=$2
31
32# Default values
33bigendian=false
34cachelinesize=64
35defaultphyspagesize=4096
36family=unknown
ffad1c54
ILT
37int64align=8
38maxalign=8
39minframesize=0
40pcquantum=1
41ptrsize=8
c5b21c3f 42stackalign=8
ffad1c54
ILT
43
44case $goarch in
45 386)
46 family=I386
ffad1c54
ILT
47 int64align=4
48 maxalign=4
49 ptrsize=4
c5b21c3f 50 stackalign=4
ffad1c54
ILT
51 ;;
52 alpha)
53 family=ALPHA
54 defaultphyspagesize=8192
55 pcquantum=4
56 ;;
44ef0300 57 amd64)
ffad1c54 58 family=AMD64
ffad1c54 59 ;;
44ef0300
ILT
60 amd64p32)
61 family=AMD64
44ef0300 62 ptrsize=4
c5b21c3f 63 stackalign=4
44ef0300 64 ;;
ffad1c54
ILT
65 arm | armbe)
66 family=ARM
67 cachelinesize=32
68 minframesize=4
69 pcquantum=4
70 ptrsize=4
c5b21c3f 71 stackalign=4
ffad1c54
ILT
72 case $goarch in
73 *be)
74 bigendian=true
75 ;;
76 esac
77 ;;
78 arm64 | arm64be)
79 family=ARM64
80 cachelinesize=32
81 defaultphyspagesize=65536
82 minframesize=8
83 pcquantum=4
c5b21c3f 84 stackalign=16
ffad1c54
ILT
85 case $goarch in
86 *be)
87 bigendian=true
88 ;;
89 esac
90 ;;
91 ia64)
92 family=IA64
93 cachelinesize=128
94 defaultphyspagesize=65536
95 ;;
96 m68k)
97 family=M68K
98 bigendian=true
99 cachelinesize=16
100 int64align=2
101 maxalign=2
102 pcquantum=4
103 ptrsize=4
c5b21c3f 104 stackalign=4
ffad1c54
ILT
105 ;;
106 mips | mipsle | mips64p32 | mips64p32le)
107 family=MIPS
108 bigendian=true
109 cachelinesize=32
110 defaultphyspagesize=16384
111 minframesize=4
112 pcquantum=4
113 ptrsize=4
c5b21c3f 114 stackalign=4
ffad1c54
ILT
115 case $goarch in
116 *le)
117 bigendian=false
118 ;;
119 esac
120 ;;
121 mips64 | mips64le)
122 family=MIPS64
123 bigendian=true
124 cachelinesize=32
125 defaultphyspagesize=16384
126 minframesize=8
127 pcquantum=4
128 case $goarch in
129 *le)
130 bigendian=false
131 ;;
132 esac
133 ;;
746d6ed4
ILT
134 nios2)
135 family=NIOS2
136 cachelinesize=32
137 minframesize=16
138 pcquantum=4
139 ptrsize=4
c5b21c3f 140 stackalign=4
746d6ed4 141 ;;
ffad1c54
ILT
142 ppc)
143 family=PPC
144 bigendian=true
145 defaultphyspagesize=65536
146 minframesize=32
147 pcquantum=4
148 ptrsize=4
c5b21c3f 149 stackalign=4
ffad1c54
ILT
150 ;;
151 ppc64 | ppc64le)
152 family=PPC64
153 bigendian=true
154 defaultphyspagesize=65536
155 minframesize=32
156 pcquantum=4
c5b21c3f 157 stackalign=16
ffad1c54
ILT
158 case $goarch in
159 *le)
160 bigendian=false
161 ;;
162 esac
163 ;;
87cbbc45
ILT
164 riscv)
165 family=RISCV
166 pcquantum=2
167 ptrsize=4
c5b21c3f 168 stackalign=4
87cbbc45 169 ;;
b613cc2e
AS
170 riscv64)
171 family=RISCV64
172 pcquantum=2
173 ;;
ffad1c54
ILT
174 s390)
175 family=S390
176 bigendian=true
177 cachelinesize=256
178 minframesize=4
179 pcquantum=2
180 ptrsize=4
c5b21c3f 181 stackalign=4
ffad1c54
ILT
182 ;;
183 s390x)
184 family=S390X
185 bigendian=true
186 cachelinesize=256
187 minframesize=8
188 pcquantum=2
189 ;;
190 sh | shbe)
191 family=SH
192 cachelinesize=16
193 int64align=4
194 minframesize=4
195 pcquantum=2
196 ptrsize=4
c5b21c3f 197 stackalign=4
ffad1c54
ILT
198 case $goarch in
199 *be)
200 bigendian=true
201 ;;
202 esac
203 ;;
204 sparc)
205 family=SPARC
206 bigendian=true
207 defaultphyspagesize=8192
208 pcquantum=4
209 ptrsize=4
c5b21c3f 210 stackalign=4
ffad1c54
ILT
211 ;;
212 sparc64)
213 family=SPARC64
214 bigendian=true
215 defaultphyspagesize=8192
216 pcquantum=4
217 ;;
87cbbc45
ILT
218 wasm)
219 family=WASM
220 defaultphyspagesize=65536
221 ;;
ffad1c54
ILT
222 *)
223 echo 1>&2 "unrecognized goarch value \"$goarch\""
224 exit 1
225 ;;
226esac
227
228if test "$family" = "unknown"; then
229 echo 1>&2 "internal error: no family for goarch value \"$goarch\""
230 exit 1
231fi
232
233case $keyword in
234 bigendian)
235 echo $bigendian
236 ;;
237 cachelinesize)
238 echo $cachelinesize
239 ;;
240 defaultphyspagesize)
241 echo $defaultphyspagesize
242 ;;
243 family)
244 echo $family
245 ;;
ffad1c54
ILT
246 int64align)
247 echo $int64align
248 ;;
249 maxalign)
250 echo $maxalign
251 ;;
252 minframesize)
253 echo $minframesize
254 ;;
255 pcquantum)
256 echo $pcquantum
257 ;;
258 ptrsize)
259 echo $ptrsize
260 ;;
c5b21c3f
ILT
261 stackalign)
262 echo $stackalign
263 ;;
ffad1c54
ILT
264 *)
265 echo 1>&2 "unrecognized keyword \"$keyword\""
266 exit 1
267 ;;
268esac
269
270exit 0